本文整理汇总了C#中LibraryChannel.GetEntities方法的典型用法代码示例。如果您正苦于以下问题:C# LibraryChannel.GetEntities方法的具体用法?C# LibraryChannel.GetEntities怎么用?C# LibraryChannel.GetEntities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LibraryChannel
的用法示例。
在下文中一共展示了LibraryChannel.GetEntities方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadBiblioSubItems
// 将一条书目记录下属的若干册记录装入列表
// return:
// -2 用户中断
// -1 出错
// >=0 装入的册记录条数
int LoadBiblioSubItems(
out string strError)
{
strError = "";
int nRet = 0;
_biblio.ClearEntityEditControls("normal");
string strBiblioRecPath = this._biblio.BiblioRecPath;
if (string.IsNullOrEmpty(strBiblioRecPath) == true)
{
// 册信息部分显示为空
// this._biblio.TrySetBlank("none");
this._biblio.AddPlus();
return 0;
}
AccountInfo _currentAccount = _base.GetAccountInfo(this._biblio.ServerName);
if (_currentAccount == null)
{
strError = "服务器名 '" + this._biblio.ServerName + "' 没有配置";
return -1;
}
// 如果不是本地服务器,则不需要装入册记录
if (_currentAccount.IsLocalServer == false)
{
_base.CurrentAccount = null;
// 册信息部分显示为空
// this._biblio.TrySetBlank("none");
this._biblio.AddPlus();
return 0;
}
_channel = _base.GetChannel(_currentAccount.ServerUrl, _currentAccount.UserName);
this.Progress.OnStop += new StopEventHandler(this.DoStop);
//this.Progress.Initial("正在装入书目记录 '" + strBiblioRecPath + "' 下属的册记录 ...");
this.Progress.BeginLoop();
try
{
int nCount = 0;
long lPerCount = 100; // 每批获得多少个
long lStart = 0;
long lResultCount = 0;
long lCount = -1;
for (; ; )
{
if (Progress.State != 0)
{
strError = "用户中断";
return -2;
}
EntityInfo[] entities = null;
long lRet = _channel.GetEntities(
Progress,
strBiblioRecPath,
lStart,
lCount,
"", // bDisplayOtherLibraryItem == true ? "getotherlibraryitem" : "",
"zh",
out entities,
out strError);
if (lRet == -1)
return -1;
lResultCount = lRet;
if (lRet == 0)
{
// 册信息部分显示为空
// this._biblio.TrySetBlank("none");
// return nCount;
goto END1;
}
Debug.Assert(entities != null, "");
foreach (EntityInfo entity in entities)
{
// string strXml = entity.OldRecord;
if (entity.ErrorCode != ErrorCodeValue.NoError)
{
// TODO: 显示错误信息
continue;
}
EntityEditControl edit_control = null;
// 添加一个新的册对象
nRet = this._biblio.NewEntity(entity.OldRecPath,
entity.OldTimestamp,
entity.OldRecord,
//.........这里部分代码省略.........
示例2: OpacSearchItems
// 检索出册数据
// 带有偏移量的版本
// 2009/6/9
// return:
// -2 实体库没有定义
// -1 出错
// 其他 命中的全部结果数量。
//
public static int OpacSearchItems(
OpacApplication app,
LibraryChannel channel,
ItemLoadEventHandler itemLoadProc,
string strBiblioRecPath,
int nStart,
int nMaxCount,
string strLang,
string strLibraryCode,
out string strError)
{
strError = "";
// string strXml = "";
// LibraryChannel channel = this.GetChannel(true, this.m_strParameters);
try
{
string strStyle = "opac";
if (string.IsNullOrEmpty(strLibraryCode) == true)
strStyle += ",getotherlibraryitem";
else
strStyle += ",librarycode:" + strLibraryCode;
long lStart = nStart;
long lCount = nMaxCount;
long lTotalCount = 0;
for (; ; )
{
EntityInfo[] iteminfos = null;
long lRet = // this.Channel.
channel.GetEntities(
null,
strBiblioRecPath,
lStart,
lCount,
strStyle,
strLang,
out iteminfos,
out strError);
if (lRet == -1)
{
if (//this.Channel.
channel.ErrorCode == ErrorCode.ItemDbNotDef)
return -2;
return -1;
}
if (lRet == 0)
{
strError = "没有找到";
return 0;
}
lTotalCount = lRet;
if (lCount < 0)
lCount = lTotalCount - lStart;
if (lStart + lCount > lTotalCount)
lCount = lTotalCount - lStart;
// 处理
for (int i = 0; i < iteminfos.Length; i++)
{
EntityInfo info = iteminfos[i];
if (//this.ItemLoad != null
itemLoadProc != null)
{
ItemLoadEventArgs e = new ItemLoadEventArgs();
e.Path = info.OldRecPath;
e.Index = i; // +nStart;
e.Count = nMaxCount; // (int)lTotalCount - nStart;
e.Timestamp = info.OldTimestamp;
e.Xml = info.OldRecord;
//this.ItemLoad(this, e);
itemLoadProc(null, e);
}
}
lStart += iteminfos.Length;
lCount -= iteminfos.Length;
if (lStart >= lTotalCount)
break;
if (lCount <= 0)
break;
}
return (int)lTotalCount;
}
//.........这里部分代码省略.........
示例3: OutputEntities
public static int OutputEntities(
Stop stop,
LibraryChannel channel,
string strBiblioRecPath,
string strDbType,
XmlTextWriter writer,
out string strError)
{
strError = "";
bool bBegin = false;
long lPerCount = 100; // 每批获得多少个
long lStart = 0;
long lResultCount = 0;
long lCount = -1;
for (; ; )
{
if (stop != null && stop.State != 0)
{
strError = "用户中断";
return -1;
}
EntityInfo[] entities = null;
long lRet = 0;
channel.Timeout = new TimeSpan(0, 5, 0);
if (strDbType == "item")
{
lRet = channel.GetEntities(
stop,
strBiblioRecPath,
lStart,
lCount,
"", // "onlygetpath",
"zh",
out entities,
out strError);
}
if (strDbType == "order")
{
lRet = channel.GetOrders(
stop,
strBiblioRecPath,
lStart,
lCount,
"", // "onlygetpath",
"zh",
out entities,
out strError);
}
if (strDbType == "issue")
{
lRet = channel.GetIssues(
stop,
strBiblioRecPath,
lStart,
lCount,
"", // "onlygetpath",
"zh",
out entities,
out strError);
}
if (strDbType == "comment")
{
lRet = channel.GetComments(
stop,
strBiblioRecPath,
lStart,
lCount,
"", // "onlygetpath",
"zh",
out entities,
out strError);
}
if (lRet == -1)
return -1;
lResultCount = lRet;
if (lRet == 0)
return 0;
Debug.Assert(entities != null, "");
foreach (EntityInfo info in entities)
{
if (info.ErrorCode != ErrorCodeValue.NoError)
{
strError = "路径为 '" + info.OldRecPath + "' 的册记录装载中发生错误: " + info.ErrorInfo; // NewRecPath
return -1;
}
if (bBegin == false)
{
writer.WriteStartElement("dprms", strDbType + "Collection", DpNs.dprms);
bBegin = true;
}
//.........这里部分代码省略.........
示例4: LoadBiblioSubItems
// 将一条书目记录下属的若干册记录装入列表
// return:
// -2 用户中断
// -1 出错
// >=0 装入的册记录条数
int LoadBiblioSubItems(
LibraryChannel channel,
string strBiblioRecPath,
out string strError)
{
strError = "";
Progress.SetMessage("正在装入书目记录 '" + strBiblioRecPath + "' 下属的册记录 ...");
if (this.FunctionType == "read")
{
AddBiblioLine(strBiblioRecPath);
}
int nCount = 0;
long lPerCount = 100; // 每批获得多少个
long lStart = 0;
long lResultCount = 0;
long lCount = -1;
for (; ; )
{
if (Progress.State != 0)
{
strError = "用户中断";
return -2;
}
EntityInfo[] entities = null;
long lRet = channel.GetEntities(
Progress,
strBiblioRecPath,
lStart,
lCount,
"", // bDisplayOtherLibraryItem == true ? "getotherlibraryitem" : "",
"zh",
out entities,
out strError);
if (lRet == -1)
return -1;
lResultCount = lRet;
if (lRet == 0)
return nCount;
Debug.Assert(entities != null, "");
foreach (EntityInfo entity in entities)
{
string strXml = entity.OldRecord;
XmlDocument dom = new XmlDocument();
{
try
{
if (string.IsNullOrEmpty(strXml) == false)
dom.LoadXml(strXml);
else
dom.LoadXml("<root />");
}
catch (Exception ex)
{
strError = "XML 装入 DOM 出错: " + ex.Message;
return -1;
}
}
DpRow row = new DpRow();
string strState = DomUtil.GetElementText(dom.DocumentElement, "state");
string strBorrower = DomUtil.GetElementText(dom.DocumentElement, "borrower");
if (this.FunctionType == "borrow")
{
// 在借的册、或者状态有值的需要显示为灰色
if (string.IsNullOrEmpty(strBorrower) == false
|| string.IsNullOrEmpty(strState) == false)
SetGrayText(row);
}
else if (this.FunctionType == "return")
{
// 没有在借的册需要显示为灰色
if (string.IsNullOrEmpty(strBorrower) == true)
SetGrayText(row);
if (string.IsNullOrEmpty(this.VerifyBorrower) == false)
{
// 验证还书时,不是要求的读者所借阅的册,显示为灰色
if (strBorrower != this.VerifyBorrower)
SetGrayText(row);
}
}
else if (this.FunctionType == "renew")
{
// 没有在借的册需要显示为灰色
//.........这里部分代码省略.........