本文整理汇总了C#中DigitalPlatform.rms.Client.RmsChannel.DoSearch方法的典型用法代码示例。如果您正苦于以下问题:C# RmsChannel.DoSearch方法的具体用法?C# RmsChannel.DoSearch怎么用?C# RmsChannel.DoSearch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DigitalPlatform.rms.Client.RmsChannel
的用法示例。
在下文中一共展示了RmsChannel.DoSearch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoSimpleSearch
public void DoSimpleSearch(bool bOutputKeyID)
{
textBox_simpleQuery_comment.Text = "";
// 第一阶段
TargetItemCollection targets = treeView_simpleQueryResTree.
GetSearchTarget();
Debug.Assert(targets != null, "GetSearchTarget() 异常");
int i;
// 第二阶段
for(i=0;i<targets.Count;i++)
{
TargetItem item = (TargetItem)targets[i];
item.Words = textBox_simpleQueryWord.Text;
}
targets.MakeWordPhrases(
Convert.ToBoolean(MainForm.AppInfo.GetInt("simple_query_property", "auto_split_words", 1)),
Convert.ToBoolean( MainForm.AppInfo.GetInt("simple_query_property", "auto_detect_range", 0) ),
Convert.ToBoolean( MainForm.AppInfo.GetInt("simple_query_property", "auto_detect_relation", 0) )
);
// 参数
for(i=0;i<targets.Count;i++)
{
TargetItem item = (TargetItem)targets[i];
item.MaxCount = MainForm.AppInfo.GetInt("simple_query_property", "maxcount", -1);
}
// 第三阶段
targets.MakeXml();
// 正式检索
string strError;
if (bOutputKeyID == true)
this.m_bFirstColumnIsKey = true;
else
this.m_bFirstColumnIsKey = false;
this.ClearListViewPropertyCache();
this.ClearListViewItems();
stop.OnStop += new StopEventHandler(this.DoStop);
stop.Initial("正在检索 ...");
stop.BeginLoop();
EnableControlsInSearching(true);
long lTotalCount = 0; // 命中记录总数
for(i=0;i<targets.Count;i++)
{
if (stop.State >= 1)
break;
TargetItem item = (TargetItem)targets[i];
channel = Channels.GetChannel(item.Url);
Debug.Assert(channel != null, "Channels.GetChannel 异常");
textBox_simpleQuery_comment.Text += "检索式XML:\r\n" + DomUtil.GetIndentXml(item.Xml) + "\r\n";
// 2010/5/18
string strBrowseStyle = "id,cols";
string strOutputStyle = "";
if (bOutputKeyID == true)
{
strOutputStyle = "keyid";
strBrowseStyle = "keyid,id,key,cols";
}
// MessageBox.Show(this, item.Xml);
long nRet = channel.DoSearch(item.Xml,
"default",
strOutputStyle,
out strError);
if (nRet == -1)
{
textBox_simpleQuery_comment.Text += "出错: " + strError + "\r\n";
MessageBox.Show(this, strError);
continue;
}
lTotalCount += nRet;
textBox_simpleQuery_comment.Text += "命中记录数: " + Convert.ToString(nRet) + "\r\n";
if (nRet == 0)
continue;
// 获取结果集
nRet = channel.DoBrowse(listView_browse,
listView_browse.Lang,
stop,
"default",
strBrowseStyle,
out strError);
if (nRet == -1)
//.........这里部分代码省略.........
示例2: 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;
}
}
示例3: SearchChildItems
// TODO: 是否检查流通信息,需要可以通过参数控制
// 检索书目记录下属的事项记录,返回少量必要的信息,可以提供后面实做删除时使用
// parameters:
// strStyle return_record_xml 要在DeleteEntityInfo结构中返回OldRecord内容
// check_circulation_info 检查是否具有流通信息。如果具有则会报错 2012/12/19 把缺省行为变为此参数
// 当包含 limit: 时,定义最多取得记录的个数。例如希望最多取得 10 条,可以定义 limit:10
// return:
// -1 error
// 0 not exist item dbname
// 1 exist item dbname
public int SearchChildItems(RmsChannel channel,
string strBiblioRecPath,
string strStyle,
DigitalPlatform.LibraryServer.LibraryApplication.Delegate_checkRecord procCheckRecord,
object param,
out long lHitCount,
out List<DeleteEntityInfo> entityinfos,
out string strError)
{
strError = "";
lHitCount = 0;
entityinfos = new List<DeleteEntityInfo>();
int nRet = 0;
bool bReturnRecordXml = StringUtil.IsInList("return_record_xml", strStyle);
bool bCheckCirculationInfo = StringUtil.IsInList("check_circulation_info", strStyle);
bool bOnlyGetCount = StringUtil.IsInList("only_getcount", strStyle);
string strLimit = StringUtil.GetParameterByPrefix(strStyle, "limit", ":");
string strBiblioDbName = ResPath.GetDbName(strBiblioRecPath);
string strBiblioRecId = ResPath.GetRecordId(strBiblioRecPath);
// 获得书目库对应的事项库名
string strItemDbName = "";
nRet = this.GetItemDbName(strBiblioDbName,
out strItemDbName,
out strError);
if (nRet == -1)
goto ERROR1;
if (String.IsNullOrEmpty(strItemDbName) == true)
return 0;
// 检索实体库中全部从属于特定id的记录
string strQueryXml = "<target list='"
+ StringUtil.GetXmlStringSimple(strItemDbName + ":" + "父记录")
+ "'><item><word>"
+ strBiblioRecId
+ "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>-1</maxCount></item><lang>" + "zh" + "</lang></target>";
long lRet = channel.DoSearch(strQueryXml,
"entities",
"", // strOuputStyle
out strError);
if (lRet == -1)
goto ERROR1;
if (lRet == 0)
{
strError = "没有找到属于书目记录 '" + strBiblioRecPath + "' 的任何" + this.ItemName + "记录";
return 0;
}
lHitCount = lRet;
// 仅返回命中条数
if (bOnlyGetCount == true)
return 0;
int nResultCount = (int)lRet;
int nMaxCount = 10000;
if (nResultCount > nMaxCount)
{
strError = "命中" + this.ItemName + "记录数 " + nResultCount.ToString() + " 超过 " + nMaxCount.ToString() + ", 暂时不支持针对它们的删除操作";
goto ERROR1;
}
string strColumnStyle = "id,xml,timestamp";
int nLimit = -1;
if (string.IsNullOrEmpty(strLimit) == false)
Int32.TryParse(strLimit, out nLimit);
int nStart = 0;
int nPerCount = 100;
if (nLimit != -1 && nPerCount > nLimit)
nPerCount = nLimit;
for (; ; )
{
#if NO
List<string> aPath = null;
lRet = channel.DoGetSearchResult(
"entities",
nStart,
nPerCount,
//.........这里部分代码省略.........
示例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;
}
//.........这里部分代码省略.........
示例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;
//.........这里部分代码省略.........
示例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;
}
示例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",
//.........这里部分代码省略.........
示例8: GetCommentRecXml
// TODO:判断strRedID是否为空
// 获得评注记录
// 本函数为了执行效率方面的原因, 不去获得超过1条以上的路径
// return:
// -1 error
// 0 not found
// 1 命中1条
// >1 命中多于1条(即便在这种情况下, strOutputPath也返回了第一条的路径)
public int GetCommentRecXml(
// RmsChannelCollection channels,
RmsChannel channel,
string strRefID,
out string strXml,
out string strOutputPath,
out byte[] timestamp,
out string strError)
{
strOutputPath = "";
strXml = "";
strError = "";
timestamp = null;
LibraryApplication app = this;
// 构造检索式
string strQueryXml = "";
int nDbCount = 0;
for (int i = 0; i < app.ItemDbs.Count; i++)
{
string strDbName = app.ItemDbs[i].CommentDbName;
if (String.IsNullOrEmpty(strDbName) == true)
continue;
string strOneDbQuery = "<target list='"
+ StringUtil.GetXmlStringSimple(strDbName + ":" + "参考ID")
+ "'><item><word>"
+ StringUtil.GetXmlStringSimple(strRefID) + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>1000</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>";
}
#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 = "参考ID '" + strRefID + "' 没有找到";
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,
//.........这里部分代码省略.........
示例9: SearchItemRecDup
// TODO: 判断strBarcode是否为空
// 根据册条码号对实体库进行查重
// 本函数只负责查重, 并不获得记录体
// return:
// -1 error
// 其他 命中记录条数(不超过nMax规定的极限)
public int SearchItemRecDup(
// RmsChannelCollection channels,
RmsChannel channel,
string strBarcode,
int nMax,
out List<string> aPath,
out string strError)
{
strError = "";
aPath = null;
LibraryApplication app = this;
/* 导致内核出问题但是没有strError内容的式子
<group>
<operator value='OR'/>
<target list='图书编目实体:册条码'>
<item><word>0000001</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>-1</maxCount></item>
<lang>zh</lang>
</target>
</group> * */
// 构造检索式
string strQueryXml = "";
int nDbCount = 0;
for (int i = 0; i < app.ItemDbs.Count; i++)
{
string strDbName = app.ItemDbs[i].DbName;
// 2008/10/16
if (String.IsNullOrEmpty(strDbName) == true)
continue;
// 2007/4/5 改造 加上了 GetXmlStringSimple()
string strOneDbQuery = "<target list='"
+ StringUtil.GetXmlStringSimple(strDbName + ":" + "册条码") // 2007/9/14
+ "'><item><word>"
+ StringUtil.GetXmlStringSimple(strBarcode)
+ "</word><match>exact</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>";
}
/*
RmsChannel channel = channels.GetChannel(app.WsUrl);
if (channel == null)
{
strError = "get channel error";
return -1;
}
* */
Debug.Assert(channel != null, "");
long lRet = channel.DoSearch(strQueryXml,
"default",
"", // strOuputStyle
out strError);
if (lRet == -1)
{
// TODO: 为了跟踪问题的方便,可以在strError中加上strQueryXml内容
strError = "SearchItemRecDup() DoSearch() error: " + strError;
goto ERROR1;
}
// not found
if (lRet == 0)
{
strError = "册条码号 '" + strBarcode + "' 没有找到";
return 0;
}
long lHitCount = lRet;
lRet = channel.DoGetSearchResult(
"default",
0,
nMax,
"zh",
null,
out aPath,
out strError);
//.........这里部分代码省略.........
示例10: 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;
}
//.........这里部分代码省略.........
示例11: 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",
//.........这里部分代码省略.........
示例12: GetReaderRecXml
// TODO: 判断strBorrowItemBarcode是否为空
// 通过“所借册条码号”获得读者记录
// 本函数可获得超过1条以上的路径
// return:
// -1 error
// 0 not found
// 1 命中1条
// >1 命中多于1条
public int GetReaderRecXml(
// RmsChannelCollection channels,
RmsChannel channel,
string strBorrowItemBarcode,
out string strXml,
int nMax,
out List<string> aPath,
out byte[] timestamp,
out string strError)
{
aPath = null;
strXml = "";
strError = "";
timestamp = null;
LibraryApplication app = this;
// 构造检索式
string strQueryXml = "";
for (int i = 0; i < app.ReaderDbs.Count; i++)
{
string strDbName = app.ReaderDbs[i].DbName;
Debug.Assert(String.IsNullOrEmpty(strDbName) == false, "");
string strOneDbQuery = "<target list='"
+ StringUtil.GetXmlStringSimple(strDbName + ":" + "所借册条码")
+ "'><item><word>"
+ StringUtil.GetXmlStringSimple(strBorrowItemBarcode)
+ "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>" + nMax.ToString() + "</maxCount></item><lang>zh</lang></target>";
if (i > 0)
strQueryXml += "<operator value='OR'/>";
strQueryXml += strOneDbQuery;
}
if (app.ReaderDbs.Count > 0)
{
strQueryXml = "<group>" + strQueryXml + "</group>";
}
#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 = "所借册条码号 '" + strBorrowItemBarcode + "' 没有找到";
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 = "";
// byte[] timestamp = null;
string strOutputPath = "";
//.........这里部分代码省略.........
示例13: 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;
}
示例14: 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,
//.........这里部分代码省略.........
示例15: DoXmlSearch
public void DoXmlSearch(bool bOutputKeyID)
{
textBox_xmlQuery_comment.Text = "";
// 第一阶段
TargetItemCollection targets = treeView_simpleQueryResTree.
GetSearchTarget();
Debug.Assert(targets != null, "GetSearchTarget() 异常");
// 正式检索
string strError;
if (bOutputKeyID == true)
this.m_bFirstColumnIsKey = true;
else
this.m_bFirstColumnIsKey = false;
this.ClearListViewPropertyCache();
this.ClearListViewItems();
stop.OnStop += new StopEventHandler(this.DoStop);
stop.Initial("正在检索 ...");
stop.BeginLoop();
EnableControlsInSearching(true);
// 2010/5/18
string strBrowseStyle = "id,cols";
string strOutputStyle = "";
if (bOutputKeyID == true)
{
strOutputStyle = "keyid";
strBrowseStyle = "keyid,id,key,cols";
}
long lTotalCount = 0; // 命中记录总数
for(int i=0;i<targets.Count;i++)
{
if (stop.State >= 1)
break;
TargetItem item = (TargetItem)targets[i];
channel = Channels.GetChannel(item.Url);
Debug.Assert(channel != null, "Channels.GetChannel 异常");
// MessageBox.Show(this, item.Xml);
long nRet = channel.DoSearch(textBox_xmlQueryString.Text,
"default",
strOutputStyle,
out strError);
if (nRet == -1)
{
textBox_xmlQuery_comment.Text += "出错: " + strError + "\r\n";
MessageBox.Show(this, strError);
continue;
}
lTotalCount += nRet;
textBox_xmlQuery_comment.Text += "命中记录数: " + Convert.ToString(nRet) + "\r\n";
if (nRet == 0)
continue;
// 获取结果集
nRet = channel.DoBrowse(listView_browse,
listView_browse.Lang,
stop,
"default",
strBrowseStyle,
out strError);
if (nRet == -1)
{
textBox_xmlQuery_comment.Text += "装载浏览信息时出错: " + strError + "\r\n";
MessageBox.Show(this, strError);
continue;
}
}
if (targets.Count > 1)
{
textBox_xmlQuery_comment.Text += "命中总条数: " + Convert.ToString(lTotalCount) + "\r\n";
}
stop.EndLoop();
stop.OnStop -= new StopEventHandler(this.DoStop);
stop.Initial("");
if (lTotalCount == 0)
{
MessageBox.Show(this, "未命中");
}
EnableControlsInSearching(false);
channel = null;
}