当前位置: 首页>>代码示例>>C#>>正文


C# RmsChannel.DoGetSearchResult方法代码示例

本文整理汇总了C#中DigitalPlatform.rms.Client.RmsChannel.DoGetSearchResult方法的典型用法代码示例。如果您正苦于以下问题:C# RmsChannel.DoGetSearchResult方法的具体用法?C# RmsChannel.DoGetSearchResult怎么用?C# RmsChannel.DoGetSearchResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DigitalPlatform.rms.Client.RmsChannel的用法示例。


在下文中一共展示了RmsChannel.DoGetSearchResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SearchAndBrowse

        /// <summary>
        /// 检索并获取浏览结果
        /// </summary>
        /// <param name="strServerUrl">服务器URL。如果==""或者==null,表示用this.ServerUrl</param>
        /// <param name="strQueryXml"></param>
        /// <param name="bGetBrowseCols">是否要获得浏览列</param>
        /// <param name="strError"></param>
        /// <returns>-2	用户中断;-1	一般错误;0	未命中;	>=1	正常结束,返回命中条数</returns>
		public long SearchAndBrowse(
			string strServerUrl,
			string strQueryXml,
            bool bGetBrowseCols,
			out string strError)
		{
			strError = "";
			
			if (strServerUrl == null || strServerUrl == null)
				strServerUrl = this.ServerUrl;

			RmsChannel channelSave = channel;


			channel = Channels.GetChannel(strServerUrl);
			if (channel == null)
			{
				strError = "get channel error";
				return -1;
			}

			try 
			{

				// 检索
				long lRet = channel.DoSearch(strQueryXml,
                    "default",
                    "", // strOuputStyle
                    out strError);
				if (lRet == -1) 
					return -1;

				if (lRet == 0) 
					return 0;

				// 循环获取结果
				long nHitCount = lRet;
				long nStart = 0;
				long nCount = 10;
				long nIndex = 0;

				for(;;)
				{
					Application.DoEvents();	// 出让界面控制权

					if (stop != null) 
					{
						if (stop.State != 0)
						{
							strError = "用户中断";
							return -2;
						}
					}

					List<string> aPath = null;
                    ArrayList aLine = null;
                    if (bGetBrowseCols == false)
                    {
                        lRet = channel.DoGetSearchResult(
                    "default",
                            nStart,
                            nCount,
                            "zh",
                            this.stop,
                            out aPath,
                            out strError);
                    }
                    else
                    {
                        lRet = channel.DoGetSearchFullResult(
                    "default",
                            nStart,
                            nCount,
                            "zh",
                            this.stop,
                            out aLine,
                            out strError);
                    }
					if (lRet == -1) 
					{
						strError = "获取检索结果时出错: " + strError;
						return -1;
					}

                    if (bGetBrowseCols == false)
					    nStart += aPath.Count;
                    else
                        nStart += aLine.Count;


					// 触发事件
					if (this.BrowseRecord != null)
//.........这里部分代码省略.........
开发者ID:paopaofeng,项目名称:dp2,代码行数:101,代码来源:SearchPanel.cs

示例2: SearchInventoryRecDup

        // 根据馆代码、批次号和册条码号对盘点库进行查重
        // 本函数只负责查重, 并不获得记录体
        // return:
        //      -1  error
        //      其他    命中记录条数(不超过nMax规定的极限)
        public int SearchInventoryRecDup(
            RmsChannel channel,
            string strLibraryCode,
            string strBatchNo,
            string strBarcode,
            string strRefID,
            int nMax,
            out List<string> aPath,
            out string strError)
        {
            strError = "";
            aPath = null;

            string strInventoryDbName = GetInventoryDbName();

            if (string.IsNullOrEmpty(strInventoryDbName) == true)
            {
                strError = "当前尚未配置盘点库,因此无法对盘点库进行查重";
                return -1;
            }

            string strKey = "";

            if (string.IsNullOrEmpty(strBarcode) == false)
                strKey = strLibraryCode + "|" + strBatchNo + "|" + strBarcode;
            else
                strKey = strLibraryCode + "|" + strBatchNo + "|@refID:" + strRefID;

            // 构造检索式
            string strQueryXml = "<target list='"
                    + StringUtil.GetXmlStringSimple(strInventoryDbName + ":" + "查重键")
                    + "'><item><word>"
                    + StringUtil.GetXmlStringSimple(strKey)
                    + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>" + nMax.ToString() + "</maxCount></item><lang>zh</lang></target>";

            Debug.Assert(channel != null, "");

            long lRet = channel.DoSearch(strQueryXml,
                "default",
                "", // strOuputStyle
                out strError);
            if (lRet == -1)
            {
                // TODO: 为了跟踪问题的方便,可以在strError中加上strQueryXml内容
                strError = "SearchInventoryRecDup() DoSearch() error: " + strError;
                goto ERROR1;
            }

            // not found
            if (lRet == 0)
            {
                strError = "查重键 '" + strKey + "' 没有找到";
                return 0;
            }

            long lHitCount = lRet;

            lRet = channel.DoGetSearchResult(
                "default",
                0,
                nMax,
                "zh",
                null,
                out aPath,
                out strError);
            if (lRet == -1)
            {
                strError = "SearchInventoryRecDup() DoGetSearchResult() error: " + strError;
                goto ERROR1;
            }

            if (aPath.Count == 0)
            {
                strError = "DoGetSearchResult aPath error 和前面已经命中的条件矛盾";
                goto ERROR1;
            }

            return (int)lHitCount;
        ERROR1:
            return -1;
        }
开发者ID:renyh1013,项目名称:dp2,代码行数:86,代码来源:LibraryApplication.cs

示例3: GetReaderRecXmlForLogin


//.........这里部分代码省略.........
                strError = "get channel error";
                return -1;
            }
#endif

            long lRet = channel.DoSearch(strQueryXml,
                "default",
                "", // strOuputStyle
                out strError);
            if (lRet == -1)
            {
                strError = "channel.DoSearch() error : " + strError;
                goto ERROR1;
            }

            // not found
            if (lRet == 0)
            {
                strError = "没有找到";
                return 0;
            }

            long lHitCount = lRet;

            if (lHitCount > 1 && bBarcode == true)
            {
                strError = "系统错误: 证条码号为 '" + strQueryWord + "' 的读者记录多于一个";
                return -1;
            }

            lHitCount = Math.Min(lHitCount, 100);

            List<string> aPath = null;
            lRet = channel.DoGetSearchResult(
                "default",
                0,
                lHitCount,
                "zh",
                null,
                out aPath,
                out strError);
            if (lRet == -1)
                goto ERROR1;
            if (aPath.Count == 0)
            {
                strError = "DoGetSearchResult aPath error";
                goto ERROR1;
            }

            /*
            // 只命中一个
            if (aPath.Count == 1)
                goto LOADONE;
             * */

            // 排除掉证状态挂失的那些
            List<string> aPathNew = new List<string>();
            List<string> aXml = new List<string>();
            List<string> aOutputPath = new List<string>();
            List<byte[]> aTimestamp = new List<byte[]>();

            for (int i = 0; i < aPath.Count; i++)
            {
                string strMetaData = "";
                byte[] timestamp = null;
开发者ID:renyh1013,项目名称:dp2,代码行数:66,代码来源:LibraryApplication.cs

示例4: GetOnePinyin

		// 获得一个汉字的拼音
		// 所获得的拼音, 是一个分号间隔的字符串, 表示对应于这个汉字的多音
		// return:
		//		-1	error
		//		1	found
		//		0	not found
		int GetOnePinyin(string strOneHanzi,
			out string strPinyin,
			out string strError)
		{
			strPinyin = "";
			strError = "";

			// 拼音库路径
			string strPinyinDbPath = MainForm.AppInfo.GetString("pinyin",
				"pinyin_db_path",
				"");

            if (String.IsNullOrEmpty(strPinyinDbPath) == true)
            {
                strError = "拼音库路径尚未配置。请先用菜单“帮助/系统参数设置”功能配置适当的拼音库路径。";
                return -1;
            }

			ResPath respath = new ResPath(strPinyinDbPath);

			string strDbName = respath.Path;

            // 2007/4/5 改造 加上了 GetXmlStringSimple()
			string strQueryXml = "<target list='" + strDbName + ":" + "汉字'><item><word>"
				+ StringUtil.GetXmlStringSimple(strOneHanzi)
                + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>10</maxCount></item><lang>chi</lang></target>";

			// 使用Channel
			RmsChannel channelSave = channel;

			channel = Channels.GetChannel(respath.Url);
			Debug.Assert(channel != null, "Channels.GetChannel 异常");

			try 
			{

                stop.OnStop += new StopEventHandler(this.DoStop);
                stop.Initial("正在检索拼音 '" + strOneHanzi + "'");
				stop.BeginLoop();

				try 
				{

					long nRet = channel.DoSearch(strQueryXml,
                        "default",
                        out strError);
					if (nRet == -1) 
					{
						strError = "检索拼音库时出错: " + strError;
						return -1;
					}
					if (nRet == 0)
						return 0;	// not found

					List<string> aPath = null;
					nRet = channel.DoGetSearchResult(
                        "default",
						1,
						this.Lang,
						stop,
						out aPath,
						out strError);
					if (nRet == -1) 
					{
						strError = "检索拼音库获取检索结果时出错: " + strError;
						return -1;
					}

					if (aPath.Count == 0)
					{
						strError = "检索拼音库获取的检索结果为空";
						return -1;
					}

					string strStyle = "content,data";

					string strContent;
					string strMetaData;
					byte[] baTimeStamp;
					string strOutputPath;

					nRet = channel.GetRes((string)aPath[0],
						strStyle,
						// this.eventClose,
						out strContent,
						out strMetaData,
						out baTimeStamp,
						out strOutputPath,
						out strError);
					if (nRet == -1) 
					{
						strError = "获取拼音记录体时出错: " + strError;
						return -1;
					}
//.........这里部分代码省略.........
开发者ID:paopaofeng,项目名称:dp2,代码行数:101,代码来源:DetailForm.cs

示例5: SearchOneFrom

        // 针对一个from进行检索
        // parameters:
        //      strExcludeBiblioRecPath 要排除掉的记录路径
        // return:
        //      -1  error
        //      0   not found
        //      1   found
        int SearchOneFrom(
            // RmsChannelCollection Channels,
            RmsChannel channel,
            string strDbName,
            string strFrom,
            string strKey,
            string strSearchStyle,
            int nWeight,
            int nThreshold,
            long nMax,
            string strExcludeBiblioRecPath,
            out DupResultSet dupset,
            out string strError)
        {
            strError = "";
            dupset = null;
            long lRet = 0;

            if (strSearchStyle == "")
                strSearchStyle = "exact";

            string strQueryXml = "<target list='"
                + StringUtil.GetXmlStringSimple(strDbName + ":" + strFrom)       // 2007/9/14
                + "'><item><word>"
                + StringUtil.GetXmlStringSimple(strKey)
                + "</word><match>" + strSearchStyle + "</match><relation>=</relation><dataType>string</dataType><maxCount>" + nMax.ToString() + "</maxCount></item><lang>zh</lang></target>";

            string strSearchReason = "key='" + strKey + "', from='" + strFrom + "', weight=" + Convert.ToString(nWeight);

            /*
            RmsChannel channel = Channels.GetChannel(this.WsUrl);
            if (channel == null)
            {
                strError = "get channel error";
                goto ERROR1;
            }
             * */
            Debug.Assert(channel != null, "");

            lRet = channel.DoSearch(strQueryXml,
                "dup",
                "", // strOuputStyle
                out strError);
            if (lRet == -1)
                goto ERROR1;

            if (lRet == 0)
                return 0;   // not found

            long lHitCount = lRet;

            long lStart = 0;
            long lPerCount = Math.Min(50, lHitCount);
            List<string> aPath = null;

            dupset = new DupResultSet();
            dupset.Open(false, getTempFileName);

            // 获得结果集,对逐个记录进行处理
            for (; ; )
            {
                // TODO: 中间要可以中断

                lRet = channel.DoGetSearchResult(
                    "dup",   // strResultSetName
                    lStart,
                    lPerCount,
                    "zh",
                    null,   // stop
                    out aPath,
                    out strError);
                if (lRet == -1)
                    goto ERROR1;

                if (lRet == 0)
                {
                    strError = "未命中";
                    break;  // ??
                }

                // TODO: 要判断 aPath.Count == 0 跳出循环。否则容易进入死循环

                // 处理浏览结果
                for (int i = 0; i < aPath.Count; i++)
                {
                    string strPath = aPath[i];

                    // 忽略发起记录的路径
                    if (strPath == strExcludeBiblioRecPath)
                        continue;

                    DupLineItem item = new DupLineItem();
                    item.Path = strPath;
//.........这里部分代码省略.........
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:AppDup.cs

示例6: GetUserRecord

        // 获得用户记录
        // return:
        //      -1  error
        //      0   not found
        //      >=1   检索命中的条数
        public static int GetUserRecord(
            RmsChannel channel,
            string strUserName,
            out string strRecPath,
            out string strXml,
            out byte[] baTimeStamp,
            out string strError)
        {
            strError = "";

            strXml = "";
            strRecPath = "";
            baTimeStamp = null;

            if (strUserName == "")
            {
                strError = "用户名为空";
                return -1;
            }

            string strQueryXml = "<target list='" + Defs.DefaultUserDb.Name
                + ":" + Defs.DefaultUserDb.SearchPath.UserName + "'><item><word>"
                + strUserName + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>10</maxCount></item><lang>chi</lang></target>";

            long nRet = channel.DoSearch(strQueryXml,
                "default",
                "", // strOutputStyle
                out strError);
            if (nRet == -1)
            {
                strError = "检索帐户库时出错: " + strError;
                return -1;
            }

            if (nRet == 0)
                return 0;	// not found

            long nSearchCount = nRet;

            List<string> aPath = null;
            nRet = channel.DoGetSearchResult(
                "default",
                1,
                "zh",
                null,	// stop,
                out aPath,
                out strError);
            if (nRet == -1)
            {
                strError = "检索注册用户库获取检索结果时出错: " + strError;
                return -1;
            }
            if (aPath.Count == 0)
            {
                strError = "检索注册用户库获取的检索结果为空";
                return -1;
            }

            // strRecID = ResPath.GetRecordId((string)aPath[0]);
            strRecPath = (string)aPath[0];

            string strStyle = "content,data,timestamp,withresmetadata";
            string strMetaData;
            string strOutputPath;

            nRet = channel.GetRes((string)aPath[0],
                strStyle,
                out strXml,
                out strMetaData,
                out baTimeStamp,
                out strOutputPath,
                out strError);
            if (nRet == -1)
            {
                strError = "获取注册用户库记录体时出错: " + strError;
                return -1;
            }


            return (int)nSearchCount;
        }
开发者ID:paopaofeng,项目名称:dp2,代码行数:86,代码来源:InstallLibraryParamDlg.cs

示例7: GetItemRecXml

        // 获得事项记录
        // 本函数可获得超过1条以上的路径
        // parameters:
        //      timestamp   返回命中的第一条的timestamp
        //      strStyle    如果包含 withresmetadata ,表示要在XML记录中返回<dprms:file>元素内的 __xxx 属性
        // return:
        //      -1  error
        //      0   not found
        //      1   命中1条
        //      >1  命中多于1条
        public int GetItemRecXml(
            // RmsChannelCollection channels,
            RmsChannel channel,
            List<string> locateParams,
            string strStyle,
            out string strXml,
            int nMax,
            out List<string> aPath,
            out byte[] timestamp,
            out string strError)
        {
            aPath = null;

            strXml = "";
            strError = "";
            timestamp = null;
            // 构造检索式

            /*
            string strQueryXml = "<target list='"
                    + StringUtil.GetXmlStringSimple(strIssueDbName + ":" + "出版时间")
                    + "'><item><word>"
                    + StringUtil.GetXmlStringSimple(strPublishTime)
                    + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>-1</maxCount></item><lang>zh</lang></target>";

            strQueryXml += "<operator value='AND'/>";


            strQueryXml += "<target list='"
                    + StringUtil.GetXmlStringSimple(strIssueDbName + ":" + "父记录")
                    + "'><item><word>"
                    + StringUtil.GetXmlStringSimple(strParentID)
                    + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>-1</maxCount></item><lang>zh</lang></target>";

            strQueryXml = "<group>" + strQueryXml + "</group>";
             * */
            // 构造用于获取事项记录的XML检索式
            string strQueryXml = "";
            int nRet = MakeGetItemRecXmlSearchQuery(
                locateParams,
                nMax,
                out strQueryXml,
                out strError);
            if (nRet == -1)
                goto ERROR1;

#if NO
            RmsChannel channel = channels.GetChannel(this.App.WsUrl);
            if (channel == null)
            {
                strError = "get channel error";
                return -1;
            }
#endif

            long lRet = channel.DoSearch(strQueryXml,
                "default",
                "", // strOuputStyle
                out strError);
            if (lRet == -1)
                goto ERROR1;

            // not found
            if (lRet == 0)
            {
                string strText = "";
                // 构造定位提示信息。用于报错。
                nRet = GetLocateText(
                    locateParams,
                    out strText,
                    out strError);
                if (nRet == -1)
                {
                    strError = "定位信息没有找到。并且GetLocateText()函数报错: " + strError;
                    return 0;
                }


                strError = strText + " 的事项没有找到";
                return 0;
            }

            long lHitCount = lRet;

            // List<string> aPath = null;
            lRet = channel.DoGetSearchResult(
                "default",
                0,
                Math.Min(nMax, lHitCount),
                "zh",
//.........这里部分代码省略.........
开发者ID:paopaofeng,项目名称:dp2,代码行数:101,代码来源:ItemDatabase.cs

示例8: SearchReaderDisplayNameDup

        // TODO: 判断strDisplayName是否为空
        // 根据显示名对读者库进行查重
        // 本函数只负责查重, 并不获得记录体
        // parameters:
        //      strBarcode  读者证条码号
        // return:
        //      -1  error
        //      其他    命中记录条数(不超过nMax规定的极限)
        public int SearchReaderDisplayNameDup(
            // RmsChannelCollection channels,
            RmsChannel channel,
            string strDisplayName,
            int nMax,
            out List<string> aPath,
            out string strError)
        {
            strError = "";
            aPath = null;

            LibraryApplication app = this;

            Debug.Assert(String.IsNullOrEmpty(strDisplayName) == false, "");

            // 构造检索式
            // 查重要针对全部读者库进行
            string strQueryXml = "";
            int nCount = 0;
            for (int i = 0; i < app.ReaderDbs.Count; i++)
            {
                string strDbName = app.ReaderDbs[i].DbName;

                Debug.Assert(String.IsNullOrEmpty(strDbName) == false, "");

                if (nCount > 0)
                {
                    Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, "");
                    strQueryXml += "<operator value='OR'/>";
                }

                string strOneDbQuery = "<target list='"
        + StringUtil.GetXmlStringSimple(strDbName + ":" + "显示名")
        + "'><item><word>"
        + StringUtil.GetXmlStringSimple(strDisplayName)
        + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>" + nMax.ToString() + "</maxCount></item><lang>zh</lang></target>";
                nCount++;

                strQueryXml += strOneDbQuery;
            }

            if (nCount > 0)
            {
                strQueryXml = "<group>" + strQueryXml + "</group>";
            }

#if NO
            RmsChannel channel = channels.GetChannel(app.WsUrl);
            if (channel == null)
            {
                strError = "get channel error";
                return -1;
            }
#endif

            string strResultSetName = "search_reader_dup_001";

            // TODO: 两种检索点的结果不会产生重复吧,需要测试验证

            long lRet = channel.DoSearch(strQueryXml,
                strResultSetName,
                "", // strOuputStyle
                out strError);
            if (lRet == -1)
                goto ERROR1;

            // not found
            if (lRet == 0)
            {
                strError = "显示名 '" + strDisplayName + "' 没有找到";
                return 0;
            }

            long lHitCount = lRet;

            lRet = channel.DoGetSearchResult(
                strResultSetName,
                0,
                nMax,
                "zh",
                null,
                out aPath,
                out strError);
            if (lRet == -1)
                goto ERROR1;

            if (aPath.Count == 0)
            {
                strError = "DoGetSearchResult aPath error 和前面已经命中的条件矛盾";
                goto ERROR1;
            }

//.........这里部分代码省略.........
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:LibraryApplication.cs

示例9: SearchReaderState

        // 根据读者证状态对读者库进行检索
        // parameters:
        //      strMatchStyle   匹配方式 left exact right middle
        //      strState  读者证状态
        //      bOnlyIncirculation  是否仅仅包括参与流通的数据库? true :仅仅包括; false : 包括全部
        //      bGetPath    == true 获得path; == false 获得barcode
        // return:
        //      -1  error
        //      其他    命中记录条数(不超过nMax规定的极限)
        public int SearchReaderState(
            // RmsChannelCollection channels,
            RmsChannel channel,
            string strState,
            string strMatchStyle,
            bool bOnlyIncirculation,
            bool bGetPath,
            int nMax,
            out List<string> aPathOrBarcode,
            out string strError)
        {
            strError = "";
            aPathOrBarcode = null;

            LibraryApplication app = this;

            // 构造检索式
            string strQueryXml = "";
            int nDbCount = 0;
            for (int i = 0; i < app.ReaderDbs.Count; i++)
            {
                string strDbName = app.ReaderDbs[i].DbName;

                if (bOnlyIncirculation == true)
                {
                    if (app.ReaderDbs[i].InCirculation == false)
                        continue;
                }

                Debug.Assert(String.IsNullOrEmpty(strDbName) == false, "");

                string strOneDbQuery = "<target list='"
                    + StringUtil.GetXmlStringSimple(strDbName + ":" + "状态")
                    + "'><item><word>"
                    + StringUtil.GetXmlStringSimple(strState)
                    + "</word><match>" + strMatchStyle + "</match><relation>=</relation><dataType>string</dataType><maxCount>" + nMax.ToString() + "</maxCount></item><lang>zh</lang></target>";

                if (nDbCount > 0)
                {
                    Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, "");
                    strQueryXml += "<operator value='OR'/>";
                }

                strQueryXml += strOneDbQuery;
                nDbCount++;
            }

            if (nDbCount > 0)
            {
                strQueryXml = "<group>" + strQueryXml + "</group>";
            }
            else
            {
                strError = "目前尚没有参与流通的读者库";
                return -1;
            }

#if NO
            RmsChannel channel = channels.GetChannel(app.WsUrl);
            if (channel == null)
            {
                strError = "get channel error";
                return -1;
            }
#endif

            string strResultSetName = "search_reader_state_001";

            long lRet = channel.DoSearch(strQueryXml,
                strResultSetName,
                "", // strOuputStyle
                out strError);
            if (lRet == -1)
                goto ERROR1;

            // not found
            if (lRet == 0)
            {
                strError = "读者证状态 '" + strState + "' (匹配方式: " + strMatchStyle + ") 没有命中";
                return 0;
            }

            long lHitCount = lRet;

            if (bGetPath == true)
            {
                lRet = channel.DoGetSearchResult(
                    strResultSetName,
                    0,
                    nMax,
                    "zh",
//.........这里部分代码省略.........
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:LibraryApplication.cs

示例10: GetReaderRecXml


//.........这里部分代码省略.........
                    + StringUtil.GetXmlStringSimple(strBarcode)
                    + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>1000</maxCount></item><lang>zh</lang></target>";

                if (String.IsNullOrEmpty(strQueryXml) == false) // i > 0
                {
                    Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, "");
                    strQueryXml += "<operator value='OR'/>";
                }

                strQueryXml += strOneDbQuery;

                // nInCount++;
            }

            if (string.IsNullOrEmpty(strQueryXml) == true /*nInCount == 0*/)
            {
                if (app.ReaderDbs.Count == 0)
                    strError = "当前尚没有配置读者库";
                else
                    strError = "当前没有可以操作的读者库";
                return -1;
            }

            if (dbnames.Count > 0/*nInCount > 0*/)
            {
                strQueryXml = "<group>" + strQueryXml + "</group>";
            }

#if NO
            RmsChannel channel = channels.GetChannel(app.WsUrl);
            if (channel == null)
            {
                strError = "get channel error";
                return -1;
            }
#endif

            Record[] records = null;
            long lRet = channel.DoSearchEx(strQueryXml,
                "default",
                "", // strOuputStyle
                1,
                "zh",
                "id,xml,timestamp",
                out records,
                out strError);
            if (lRet == -1)
                goto ERROR1;

            // not found
            if (lRet == 0)
            {
                strError = "读者证条码号 '" + strBarcode + "' 没有找到";
                return 0;
            }

            long lHitCount = lRet;

            if (records == null || records.Length == 0)
            {
                strError = "records error";
                return -1;
            }

            Debug.Assert(records[0].RecordBody != null, "");

            // strOutputPath = records[0].Path;
            if (nMax >= 1)
                recpaths.Add(records[0].Path);
            strXml = records[0].RecordBody.Xml;
            timestamp = records[0].RecordBody.Timestamp;

            // 如果命中结果多余一条,则继续获得第一条以后的各条的path
            if (lHitCount > 1 && nMax > 1)
            {
                // List<string> temp = null;
                lRet = channel.DoGetSearchResult(
                    "default",
                    0,
                    Math.Min(nMax, lHitCount),
                    "zh",
                    null,
                    out recpaths,
                    out strError);
                if (lRet == -1)
                    goto ERROR1;

                Debug.Assert(recpaths != null, "");

                if (recpaths.Count == 0)
                {
                    strError = "DoGetSearchResult recpaths error";
                    goto ERROR1;
                }
            }

            return (int)lHitCount;
        ERROR1:
            return -1;
        }
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:LibraryApplication.cs

示例11: GetReaderRecXmlByFrom


//.........这里部分代码省略.........
            // 构造检索式
            string strQueryXml = "";
            for (int i = 0; i < dbnames.Count; i++)
            {
                string strDbName = dbnames[i];

                Debug.Assert(String.IsNullOrEmpty(strDbName) == false, "");

                string strOneDbQuery = "<target list='"
                    + StringUtil.GetXmlStringSimple(strDbName + ":" + strFrom)       // 2007/9/14 
                    + "'><item><word>"
                    + StringUtil.GetXmlStringSimple(strWord)
                    + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>1000</maxCount></item><lang>zh</lang></target>";

                if (i > 0)
                {
                    Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, "");
                    strQueryXml += "<operator value='OR'/>";
                }

                strQueryXml += strOneDbQuery;
            }

            if (dbnames.Count > 0)
            {
                strQueryXml = "<group>" + strQueryXml + "</group>";
            }

#if NO
            RmsChannel channel = channels.GetChannel(app.WsUrl);
            if (channel == null)
            {
                strError = "get channel error";
                return -1;
            }
#endif

            Record[] records = null;
            long lRet = channel.DoSearchEx(strQueryXml,
                "default",
                "", // strOuputStyle
                1,
                "zh",
                "id,xml,timestamp",
                out records,
                out strError);
            if (lRet == -1)
                goto ERROR1;

            // not found
            if (lRet == 0)
            {
                strError = "读者" + strFrom + " '" + strWord + "' 没有找到";
                return 0;
            }

            long lHitCount = lRet;

            if (records == null || records.Length == 0)
            {
                strError = "records error";
                return -1;
            }

            Debug.Assert(records[0].RecordBody != null, "");

            // strOutputPath = records[0].Path;
            if (nMax >= 1)
                recpaths.Add(records[0].Path);
            strXml = records[0].RecordBody.Xml;
            timestamp = records[0].RecordBody.Timestamp;

            // 如果命中结果多于一条,则继续获得第一条以后的各条的path
            if (lHitCount > 1 && nMax > 1)
            {
                // List<string> temp = null;
                lRet = channel.DoGetSearchResult(
                    "default",
                    0,
                    Math.Min(nMax, lHitCount),
                    "zh",
                    null,
                    out recpaths,
                    out strError);
                if (lRet == -1)
                    goto ERROR1;

                Debug.Assert(recpaths != null, "");

                if (recpaths.Count == 0)
                {
                    strError = "DoGetSearchResult aPath error";
                    goto ERROR1;
                }
            }

            return (int)lHitCount;
        ERROR1:
            return -1;
        }
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:LibraryApplication.cs

示例12: GetRecXml

        // 2007/6/27
        // 获得通用记录
        // 本函数可获得超过1条以上的路径
        // return:
        //      -1  error
        //      0   not found
        //      1   命中1条
        //      >1  命中多于1条
        public int GetRecXml(
            // RmsChannelCollection channels,
            RmsChannel channel,
            string strQueryXml,
            out string strXml,
            int nMax,
            out List<string> aPath,
            out byte[] timestamp,
            out string strError)
        {
            aPath = null;

            strXml = "";
            strError = "";
            timestamp = null;

            LibraryApplication app = this;

#if NO
            RmsChannel channel = channels.GetChannel(app.WsUrl);
            if (channel == null)
            {
                strError = "get channel error";
                return -1;
            }
#endif

            long lRet = channel.DoSearch(strQueryXml,
                "default",
                "", // strOuputStyle
                out strError);
            if (lRet == -1)
                goto ERROR1;

            // not found
            if (lRet == 0)
            {
                strError = "没有命中记录";
                return 0;
            }

            long lHitCount = lRet;

            // List<string> aPath = null;
            lRet = channel.DoGetSearchResult(
                "default",
                0,
                Math.Min(nMax, lHitCount),
                "zh",
                null,
                out aPath,
                out strError);
            if (lRet == -1)
                goto ERROR1;

            Debug.Assert(aPath != null, "");

            if (aPath.Count == 0)
            {
                strError = "DoGetSearchResult aPath error";
                goto ERROR1;
            }

            string strMetaData = "";
            string strOutputPath = "";

            lRet = channel.GetRes(aPath[0],
                out strXml,
                out strMetaData,
                out timestamp,
                out strOutputPath,
                out strError);
            if (lRet == -1)
                goto ERROR1;

            return (int)lHitCount;
        ERROR1:
            return -1;
        }
开发者ID:renyh1013,项目名称:dp2,代码行数:87,代码来源:LibraryApplication.cs

示例13: GetArrivedQueueRecXml

        // TODO:判断strItemBarcode是否为空
        // 获得预约到书队列记录
        // parameters:
        //      strItemBarcodeParam  册条码号。可以使用 @refID: 前缀
        // return:
        //      -1  error
        //      0   not found
        //      1   命中1条
        //      >1  命中多于1条
        public int GetArrivedQueueRecXml(
            // RmsChannelCollection channels,
            RmsChannel channel,
            string strItemBarcodeParam,
            out string strXml,
            out byte[] timestamp,
            out string strOutputPath,
            out string strError)
        {
            strOutputPath = "";
            strXml = "";
            strError = "";
            timestamp = null;

            LibraryApplication app = this;
            string strFrom = "册条码";

            // 注:旧的,也就是 2015/5/7 以前的 预约到书队列库里面并没有 参考ID 检索点,所以直接用带着 @refID 前缀的字符串进行检索即可。
            // 等队列库普遍刷新检索点以后,改为使用下面一段代码
            if (this.ArrivedDbKeysContainsRefIDKey() == true)
            {
                string strHead = "@refID:";

                if (StringUtil.HasHead(strItemBarcodeParam, strHead, true) == true)
                {
                    strFrom = "册参考ID";
                    strItemBarcodeParam = strItemBarcodeParam.Substring(strHead.Length).Trim();
                    if (string.IsNullOrEmpty(strItemBarcodeParam) == true)
                    {
                        strError = "参数 strItemBarcodeParam 值中参考ID部分不应为空";
                        return -1;
                    }
                }
            }

            // 构造检索式
            // 2007/4/5 改造 加上了 GetXmlStringSimple()
            string strQueryXml = "<target list='"
                + StringUtil.GetXmlStringSimple(app.ArrivedDbName + ":" + strFrom)
                + "'><item><word>"
                + StringUtil.GetXmlStringSimple(strItemBarcodeParam)
                + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>1000</maxCount></item><lang>zh</lang></target>";

#if NO
            RmsChannel channel = channels.GetChannel(app.WsUrl);
            if (channel == null)
            {
                strError = "get channel error";
                return -1;
            }
#endif

            long lRet = channel.DoSearch(strQueryXml,
                "default",
                "", // strOuputStyle
                out strError);
            if (lRet == -1)
                goto ERROR1;

            if (lRet == 0)
            {
                strError = "没有找到";
                return 0;
            }

            long lHitCount = lRet;

            List<string> aPath = null;
            lRet = channel.DoGetSearchResult(
                "default",
                0,
                1,
                "zh",
                null,
                out aPath,
                out strError);
            if (lRet == -1)
                goto ERROR1;
            if (aPath.Count == 0)
            {
                strError = "DoGetSearchResult aPath error";
                goto ERROR1;
            }

            string strMetaData = "";

            lRet = channel.GetRes(aPath[0],
                out strXml,
                out strMetaData,
                out timestamp,
                out strOutputPath,
//.........这里部分代码省略.........
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:LibraryApplication.cs

示例14: SearchMultiPath

        /// <summary>
        /// 检索得到若干命中结果
        /// </summary>
        /// <param name="strServerUrl">服务器URL</param>
        /// <param name="strQueryXml">检索式XML</param>
        /// <param name="nMax">最大结果数</param>
        /// <param name="aPath">返回的记录路径数组</param>
        /// <param name="strError">返回的错误信息</param>
        /// <returns>-1	一般错误;0	not found;1	found;>1	命中多于一条</returns>
        public int SearchMultiPath(
            string strServerUrl,
            string strQueryXml,
            int nMax,
            out List<string> aPath,
            out string strError)
        {
            aPath = null;
            strError = "";

            if (String.IsNullOrEmpty(strServerUrl) == true)
                strServerUrl = this.ServerUrl;

            RmsChannel channelSave = channel;

            channel = Channels.GetChannel(strServerUrl);
            if (channel == null)
            {
                strError = "get channel error";
                return -1;
            }

            try
            {


                long lRet = channel.DoSearch(strQueryXml,
                    "default",
                    "", // strOuputStyle
                    out strError);
                if (lRet == -1)
                    return -1;

                if (lRet == 0)
                {
                    return 0;	// 没有找到
                }

                long lCount = lRet;

                lCount = Math.Min(lCount, nMax);

                if (lRet > 1)
                {
                    strError = "命中 " + Convert.ToString(lRet) + " 条。";
                }

                lRet = channel.DoGetSearchResult(
                    "default",
                    0,
                    lCount,
                    "zh",
                    this.stop,
                    out aPath,
                    out strError);
                if (lRet == -1)
                {
                    strError = "获取检索结果时出错: " + strError;
                    return -1;
                }

                return (int)lCount;
            }
            finally
            {
                channel = channelSave;
            }
        }
开发者ID:paopaofeng,项目名称:dp2,代码行数:77,代码来源:SearchPanel.cs

示例15: GetOneItemRec


//.........这里部分代码省略.........
                // 新方法只用一个 item 元素,把各个库的 dbname 和 from 都拍紧到同一个 targetlist 中
                StringBuilder targetList = new StringBuilder();
                for (int i = 0; i < dbnames.Count; i++)
                {
                    string strDbName = dbnames[i];

                    if (String.IsNullOrEmpty(strDbName) == true)
                        continue;
                    if (targetList.Length > 0)
                        targetList.Append(";");
                    targetList.Append(strDbName + ":" + strFrom);
                }

                if (targetList.Length == 0)
                {
                    strError = "没有任何可检索的目标数据库";
                    return -1;
                }

                strQueryXml = "<target list='"
        + StringUtil.GetXmlStringSimple(targetList.ToString())
        + "' " + strHint + "><item><word>"
        + StringUtil.GetXmlStringSimple(strBarcode)
        + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>" + nMax.ToString() + "</maxCount></item><lang>zh</lang></target>";
            }

            if (channel == null)
                throw new ArgumentException("channel 参数不应为空", "channel");

            Record[] records = null;
            long lRet = channel.DoSearchEx(strQueryXml,
                "default",
                "", // strOuputStyle
                1,
                "zh",
                strStyle + ",id",    // "id,xml,timestamp",
                out records,
                out strError);
            if (lRet == -1)
                goto ERROR1;

            // not found
            if (lRet == 0)
            {
                strError = strFrom + " '" + strBarcode + "' 没有找到";
                return 0;
            }

            long lHitCount = lRet;

            if (records == null || records.Length == 0)
            {
                strError = "records error";
                return -1;
            }

#if DEBUG
            if (StringUtil.IsInList("xml", strStyle) == true
                || StringUtil.IsInList("timestamp", strStyle) == true)
            {
                Debug.Assert(records[0].RecordBody != null, "");
            }
#endif

            aPath = new List<string>();
            aPath.Add(records[0].Path);
            if (records[0].RecordBody != null)
            {
                strXml = records[0].RecordBody.Xml;
                timestamp = records[0].RecordBody.Timestamp;
            }

            // 如果命中结果多余一条,则继续获得第一条以后的各条的path
            if (lHitCount > 1)  // TODO: && nMax > 1
            {
                // List<string> aPath = null;
                lRet = channel.DoGetSearchResult(
                    "default",
                    0,
                    Math.Min(nMax, lHitCount),
                    "zh",
                    null,
                    out aPath,
                    out strError);
                if (lRet == -1)
                    goto ERROR1;

                Debug.Assert(aPath != null, "");

                if (aPath.Count == 0)
                {
                    strError = "DoGetSearchResult aPath error";
                    goto ERROR1;
                }
            }

            return (int)lHitCount;
        ERROR1:
            return -1;
        }
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:LibraryApplication.cs


注:本文中的DigitalPlatform.rms.Client.RmsChannel.DoGetSearchResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。