本文整理汇总了C#中LibraryChannel.GetBiblioInfos方法的典型用法代码示例。如果您正苦于以下问题:C# LibraryChannel.GetBiblioInfos方法的具体用法?C# LibraryChannel.GetBiblioInfos怎么用?C# LibraryChannel.GetBiblioInfos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LibraryChannel
的用法示例。
在下文中一共展示了LibraryChannel.GetBiblioInfos方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOneRecord
//.........这里部分代码省略.........
if (dp2_searchform == null)
{
strError = "没有打开的dp2检索窗,无法GetOneRecordSyntax()";
return -1;
}
// 获得server url
string strServerUrl = dp2_searchform.GetServerUrl(strServerName);
if (strServerUrl == null)
{
strError = "没有找到服务器名 '" + strServerName + "' 对应的URL";
return -1;
}
this.Channel = this.Channels.GetChannel(strServerUrl);
stop.OnStop += new StopEventHandler(this.DoStop);
stop.Initial("正在初始化浏览器组件 ...");
stop.BeginLoop();
this.Update();
this.MainForm.Update();
try
{
stop.SetMessage("正在装入书目记录 " + strPath + " ...");
string[] formats = null;
formats = new string[1];
formats[0] = "xml";
string[] results = null;
long lRet = Channel.GetBiblioInfos(
stop,
strPurePath,
"",
formats,
out results,
out baTimestamp,
out strError);
if (lRet == 0)
{
strError = "路径为 '" + strPath + "' 的书目记录没有找到 ...";
goto ERROR1; // not found
}
if (lRet == -1)
goto ERROR1;
// this.BiblioTimestamp = baTimestamp;
if (results == null)
{
strError = "results == null";
goto ERROR1;
}
if (results.Length != formats.Length)
{
strError = "result.Length != formats.Length";
goto ERROR1;
}
string strXml = results[0];
if (strStyle == "marc")
示例2: LoadBiblioRecord
//.........这里部分代码省略.........
#if NO
Global.SetHtmlString(this.webBrowser_biblioRecord, "(空白)");
#endif
this.m_webExternalHost_biblio.SetHtmlString("(空白)", "entityform_error");
Progress.SetMessage("正在装入书目记录 " + strBiblioRecPath + " ...");
bool bCataloging = this.Cataloging;
/*
long lRet = Channel.GetBiblioInfo(
stop,
strBiblioRecPath,
"html",
out strHtml,
out strError);
* */
List<string> format_list = new List<string>();
format_list.Add("outputpath");
format_list.Add("html");
if (bCataloging == true)
{
format_list.Add("xml");
}
if (bLoadSubrecords)
{
format_list.Add("subrecords:all"
+ (this.DisplayOtherLibraryItem == true ? "|getotherlibraryitem" : ""));
}
string[] results = null;
byte[] baTimestamp = null;
long lRet = channel.GetBiblioInfos(
Progress,
strBiblioRecPath,
"",
format_list.ToArray(),
out results,
out baTimestamp,
out strError);
if (lRet == 0)
{
// Global.SetHtmlString(this.webBrowser_biblioRecord, "路径为 '" + strBiblioRecPath + "' 的书目记录没有找到 ...");
this.m_webExternalHost_biblio.SetHtmlString("路径为 '" + strBiblioRecPath + "' 的书目记录没有找到 ...",
"entityform_error");
return 0; // not found
}
string strHtml = "";
bool bError = false;
string strErrorText = "";
if (results != null && results.Length >= 1)
strOutputBiblioRecPath = results[0];
if (results != null && results.Length >= 2)
strHtml = results[1];
if (lRet == -1)
{
// 暂时不报错
bError = true;
strErrorText = strError;
示例3: BuildRssFile
//.........这里部分代码省略.........
return -1;
}
nRet = OpacApplication.LoadToDom(strItemXml,
out itemdom,
out strError);
if (nRet == -1)
{
strError = "装载记录 '" + strPath + "' 进入XML DOM时发生错误: " + strError;
return -1;
}
string strParentID = DomUtil.GetElementText(itemdom.DocumentElement,
"parent");
strBiblioRecPath = strBiblioDbName + "/" + strParentID;
}
else if (strDbType == "biblio")
{
strBiblioRecPath = strPath;
}
// 从数据库中获取
string strBiblioXml = "";
byte[] timestamp = null;
string[] formats = new string[3];
formats[0] = "xml";
formats[1] = "summary";
formats[2] = "metadata";
string[] results = null;
lRet = channel.GetBiblioInfos(
null,
strBiblioRecPath,
"",
formats,
out results,
out timestamp,
out strError);
if (lRet == -1)
return -1;
if (lRet == 0)
continue; // TODO: 产生一条占位记录?
/*
LibraryServerResult result = this.App.GetBiblioInfos(
sessioninfo,
strBiblioRecPath,
formats,
out results,
out timestamp);
if (result.Value == -1)
{
strError = result.ErrorInfo;
return -1;
}
if (result.Value == 0)
continue; // TODO: 产生一条占位记录?
*/
if (results == null || results.Length != 3)
{
strError = "results error {5E0FC5A1-819D-4655-AB3B-5CE6AAAB1BFE}";
示例4: GetBiblioInfo
int GetBiblioInfo(
bool bCheckSearching,
ListViewItem item,
out BiblioInfo info,
out string strError)
{
strError = "";
info = null;
if (this.m_biblioTable == null)
return 0;
string strRecPath = item.Text;
if (string.IsNullOrEmpty(strRecPath) == true)
return 0;
// 存储所获得书目记录 XML
info = (BiblioInfo)this.m_biblioTable[strRecPath];
if (info == null || string.IsNullOrEmpty(info.OldXml) == true)
{
if (bCheckSearching == true && this._linkMarcFile == null)
{
if (this.InSearching == true)
return 0;
}
// 解析记录路径
string strServerName = "";
string strPurePath = "";
ParseRecPath(strRecPath,
out strServerName,
out strPurePath);
// 获得server url
dp2Server server = this.dp2ResTree1.Servers.GetServerByName(strServerName);
if (server == null)
{
strError = "名为 '" + strServerName + "' 的服务器在检索窗中尚未定义...";
return -1;
}
string strServerUrl = server.Url;
this.Channel = this.Channels.GetChannel(strServerUrl);
string[] results = null;
byte[] baTimestamp = null;
// 获得书目记录
long lRet = Channel.GetBiblioInfos(
stop,
strPurePath,
"",
new string[] { "xml" }, // formats
out results,
out baTimestamp,
out strError);
if (lRet == 0)
return -1; // 是否设定为特殊状态?
if (lRet == -1)
return -1;
if (results == null || results.Length == 0)
{
strError = "results error";
return -1;
}
string strXml = results[0];
// 滞后创建新对象,避免在 hashtable 中存在一个尚未初始化的对象,而被其他线程抢先使用了
if (info == null)
{
info = new BiblioInfo();
info.RecPath = strRecPath;
this.m_biblioTable[strRecPath] = info;
}
info.OldXml = strXml;
info.Timestamp = baTimestamp;
info.RecPath = strRecPath;
}
return 1;
}
示例5: DeleteSelectedRecords
// 删除所选择的书目记录
public void DeleteSelectedRecords()
{
string strError = "";
if (this._linkMarcFile != null)
{
strError = "暂不支持从 MARC 文件中直接删除记录";
goto ERROR1;
}
if (this.listView_browse.SelectedItems.Count == 0)
{
strError = "尚未选择要删除的书目记录";
goto ERROR1;
}
DialogResult result = MessageBox.Show(this,
"确实要从数据库中删除所选定的 " + this.listView_browse.SelectedItems.Count.ToString() + " 个书目记录?\r\n\r\n(警告:书目记录被删除后,无法恢复。如果删除书目记录,则其下属的册、期、订购、评注记录和对象资源会一并删除)\r\n\r\n(OK 删除;Cancel 取消)",
"dp2SearchForm",
MessageBoxButtons.OKCancel,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2);
if (result == System.Windows.Forms.DialogResult.Cancel)
return;
List<ListViewItem> items = new List<ListViewItem>();
foreach (ListViewItem item in this.listView_browse.SelectedItems)
{
items.Add(item);
}
stop.Style = StopStyle.EnableHalfStop;
stop.OnStop += new StopEventHandler(this.DoStop);
stop.Initial("正在删除书目记录 ...");
stop.BeginLoop();
this.EnableControlsInSearching(false);
// 暂时禁止因为 listview 选择发生改变而频繁刷新状态行
this.listView_browse.SelectedIndexChanged -= new System.EventHandler(this.listView_browse_SelectedIndexChanged);
this._processing++;
try
{
stop.SetProgressRange(0, items.Count);
for (int i = 0; i < items.Count; i++)
{
if (stop != null && stop.State != 0)
{
strError = "已中断";
goto ERROR1;
}
ListViewItem item = items[i];
string strRecPath = ListViewUtil.GetItemText(item, 0);
// 解析记录路径
string strServerName = "";
string strPurePath = "";
ParseRecPath(strRecPath,
out strServerName,
out strPurePath);
// 获得server url
dp2Server server = this.dp2ResTree1.Servers.GetServerByName(strServerName);
if (server == null)
{
strError = "名为 '" + strServerName + "' 的服务器在检索窗中尚未定义...";
goto ERROR1;
}
string strServerUrl = server.Url;
this.Channel = this.Channels.GetChannel(strServerUrl);
string[] results = null;
byte[] baTimestamp = null;
string strOutputPath = "";
stop.SetMessage("正在删除书目记录 " + strPurePath);
long lRet = Channel.GetBiblioInfos(
stop,
strPurePath,
"",
null, // formats
out results,
out baTimestamp,
out strError);
if (lRet == -1)
{
result = MessageBox.Show(this,
"在获得记录 '" + strRecPath + "' 的时间戳的过程中出现错误: " + strError + "。\r\n\r\n是否继续强行删除此记录? (Yes 强行删除;No 不删除;Cancel 放弃当前未完成的全部删除操作)",
"dp2SearchForm",
MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1);
if (result == System.Windows.Forms.DialogResult.Cancel)
goto ERROR1;
if (result == System.Windows.Forms.DialogResult.No)
continue;
//.........这里部分代码省略.........
示例6: SaveChangedRecords
int SaveChangedRecords(List<ListViewItem> items,
out string strError)
{
strError = "";
int nReloadCount = 0;
int nSavedCount = 0;
stop.Style = StopStyle.EnableHalfStop;
stop.OnStop += new StopEventHandler(this.DoStop);
stop.Initial("正在保存书目记录 ...");
stop.BeginLoop();
this.EnableControlsInSearching(false);
this.listView_browse.Enabled = false;
try
{
stop.SetProgressRange(0, items.Count);
for (int i = 0; i < items.Count; i++)
{
if (stop != null && stop.State != 0)
{
strError = "已中断";
return -1;
}
ListViewItem item = items[i];
string strRecPath = item.Text;
if (string.IsNullOrEmpty(strRecPath) == true)
{
stop.SetProgressValue(i);
goto CONTINUE;
}
BiblioInfo info = (BiblioInfo)this.m_biblioTable[strRecPath];
if (info == null)
goto CONTINUE;
if (string.IsNullOrEmpty(info.NewXml) == true)
goto CONTINUE;
stop.SetMessage("正在保存书目记录 " + strRecPath);
// 解析记录路径
string strServerName = "";
string strPurePath = "";
ParseRecPath(strRecPath,
out strServerName,
out strPurePath);
// 获得server url
dp2Server server = this.dp2ResTree1.Servers.GetServerByName(strServerName);
if (server == null)
{
strError = "名为 '" + strServerName + "' 的服务器在检索窗中尚未定义...";
return -1;
}
string strServerUrl = server.Url;
this.Channel = this.Channels.GetChannel(strServerUrl);
string strOutputPath = "";
byte[] baNewTimestamp = null;
long lRet = Channel.SetBiblioInfo(
stop,
"change",
strPurePath,
"xml",
info.NewXml,
info.Timestamp,
"",
out strOutputPath,
out baNewTimestamp,
out strError);
if (lRet == -1)
{
if (Channel.ErrorCode == ErrorCode.TimestampMismatch)
{
DialogResult result = MessageBox.Show(this,
"保存书目记录 " + strRecPath + " 时遭遇时间戳不匹配: " + strError + "。\r\n\r\n此记录已无法被保存。\r\n\r\n请问现在是否要顺便重新装载此记录? \r\n\r\n(Yes 重新装载;\r\nNo 不重新装载、但继续处理后面的记录保存; \r\nCancel 中断整批保存操作)",
"BiblioSearchForm",
MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1);
if (result == System.Windows.Forms.DialogResult.Cancel)
break;
if (result == System.Windows.Forms.DialogResult.No)
goto CONTINUE;
// 重新装载书目记录到 OldXml
string[] results = null;
// byte[] baTimestamp = null;
lRet = Channel.GetBiblioInfos(
stop,
strPurePath,
"",
new string[] { "xml" }, // formats
out results,
//.........这里部分代码省略.........
示例7: LoadData
// 装载数据
public override bool LoadData()
{
string strError = "";
int nRet = 0;
BiblioInfo info = this.BiblioInfo;
string strRecPath = this.BiblioInfo.RecPath;
if (string.IsNullOrEmpty(info.OldXml) == true)
{
lock (syncRoot)
{
channel = this.Container.MainForm.GetChannel();
}
try
{
// 显示 正在处理
this.HTML = GetWaitingHtml("正在获取书目记录 " + strRecPath);
ShowData();
string[] results = null;
byte[] baTimestamp = null;
// 获得书目记录
channel.Timeout = new TimeSpan(0, 0, 5);
long lRet = channel.GetBiblioInfos(
Stop,
strRecPath,
"",
new string[] { "xml" }, // formats
out results,
out baTimestamp,
out strError);
if (lRet == 0)
{
nRet = -1;
strError = "获取书目记录 "+strRecPath+" 时出错: " + strError;
}
else if (lRet == -1)
{
nRet = -1;
strError = "获取书目记录 " + strRecPath + " 时出错: " + strError;
}
else
{
if (results == null || results.Length == 0)
{
strError = "results error";
throw new Exception(strError);
}
// TODO: 对 BiblioInfo 的成员进行操作的时候,是否要 lock 一下对象?
string strXml = results[0];
info.OldXml = strXml;
info.Timestamp = baTimestamp;
info.RecPath = strRecPath;
}
}
finally
{
LibraryChannel temp_channel = channel;
lock (syncRoot)
{
channel = null;
}
this.Container.MainForm.ReturnChannel(temp_channel);
}
}
string strXml1 = "";
string strHtml2 = "";
string strXml2 = "";
if (nRet == -1)
{
strHtml2 = HttpUtility.HtmlEncode(strError);
}
else
{
nRet = BiblioSearchForm.GetXmlHtml(info,
out strXml1,
out strXml2,
out strHtml2,
out strError);
if (nRet == -1)
throw new Exception(strError);
}
this.HTML = "<html>" +
this.Container.MainForm.GetMarcHtmlHeadString(true) +
"<body>" +
strHtml2 +
EntityForm.GetTimestampHtml(info.Timestamp) +
"</body></html>";
this.XML = BiblioSearchForm.MergeXml(strXml1, strXml2);
return true;
}