本文整理汇总了C#中LibraryChannel类的典型用法代码示例。如果您正苦于以下问题:C# LibraryChannel类的具体用法?C# LibraryChannel怎么用?C# LibraryChannel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LibraryChannel类属于命名空间,在下文中一共展示了LibraryChannel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CallReturnChannel
void CallReturnChannel(LibraryChannel channel, bool bEndLoop)
{
if (this.ReturnChannel == null)
return;
ReturnChannelEventArgs e = new ReturnChannelEventArgs();
e.Channel = channel;
e.EndLoop = bEndLoop;
this.ReturnChannel(this, e);
}
开发者ID:renyh1013,项目名称:dp2,代码行数:9,代码来源:KernelResTree.cs
示例2: DirItemLoader
public DirItemLoader(LibraryChannel channel,
DigitalPlatform.Stop stop,
string path,
string style,
string lang = "zh")
{
this.Channel = channel;
this.Stop = stop;
this.Path = path;
this.Style = style;
this.Lang = lang;
}
开发者ID:renyh1013,项目名称:dp2,代码行数:12,代码来源:DirItemLoader.cs
示例3: Initial
// 初始化数据成员
public int Initial(
MainForm mainform,
string[] aPaths,
string strMessage,
LibraryChannel channel,
Stop stop,
out string strError)
{
strError = "";
this.MainForm = mainform;
this.Channel = channel;
this.stop = stop;
this.aPaths = aPaths;
this.textBox_message.Text = strMessage;
this.InfoColor = InfoColor.LightRed; // 红色表示警告
return 0;
}
开发者ID:paopaofeng,项目名称:dp2,代码行数:22,代码来源:ItemBarcodeDupDlg.cs
示例4: ProcessFile
// 装入一个日志文件中的若干记录
// parameters:
// strStyle 如果包含 accessLog,表示这是需要获取只读日志
// strCacheDir 存储本地缓存文件的目录
// lServerFileSize 服务器端日志文件的尺寸。如果为-1,表示函数内会自动获取
// lSize 进度条所采用的最大尺寸。如果必要,可能会被本函数推动
// return:
// -2 此类型的日志尚未启用
// -1 error
// 0 正常结束
// 1 用户中断
static int ProcessFile(
IWin32Window owner,
Stop stop,
ProgressEstimate estimate,
LibraryChannel channel,
string strLogFileName,
int nLevel,
long lServerFileSize,
string strRange,
string strStyle,
string strCacheDir,
object param,
Delegate_doRecord procDoRecord,
ref long lProgressValue,
ref long lSize,
out string strError)
{
strError = "";
int nRet = 0;
long lRet = 0;
stop.SetMessage("正在装入日志文件 " + strLogFileName + " 中的记录。"
+ "剩余时间 " + ProgressEstimate.Format(estimate.Estimate(lProgressValue)) + " 已经过时间 " + ProgressEstimate.Format(estimate.delta_passed));
bool bAccessLog = StringUtil.IsInList("accessLog", strStyle);
string strXml = "";
long lAttachmentTotalLength = 0;
byte[] attachment_data = null;
long lFileSize = 0;
if (lServerFileSize == -1)
{
lServerFileSize = 0;
string strTempStyle = "level-" + nLevel.ToString();
if (bAccessLog)
strTempStyle += ",accessLog";
// 获得服务器端日志文件尺寸
lRet = channel.GetOperLog(
stop,
strLogFileName,
-1, // lIndex,
-1, // lHint,
strTempStyle,
"", // strFilter
out strXml,
out lServerFileSize,
0, // lAttachmentFragmentStart,
0, // nAttachmentFramengLength,
out attachment_data,
out lAttachmentTotalLength,
out strError);
// 2015/11/25
if (lRet == -1)
return -1;
// 2010/12/13
if (lRet == 0)
return 0;
if (lServerFileSize == -1)
{
strError = "日志尚未启用";
return -2;
}
}
Stream stream = null;
bool bCacheFileExist = false;
bool bRemoveCacheFile = false; // 是否要自动删除未全部完成的本地缓存文件
bool bAutoCache = StringUtil.IsInList("autocache", strStyle);
if (bAutoCache == true)
{
nRet = PrepareCacheFile(
strCacheDir,
bAccessLog ? strLogFileName + ".a" : strLogFileName,
lServerFileSize,
out bCacheFileExist,
out stream,
out strError);
if (nRet == -1)
return -1;
if (bCacheFileExist == false && stream != null)
bRemoveCacheFile = true;
}
//.........这里部分代码省略.........
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:OperLogForm.cs
示例5: GetRemoteBiblioDbNames
internal static int GetRemoteBiblioDbNames(
string strUrl,
string strUserName,
string strPassword,
out List<string> dbnames,
out string strError)
{
strError = "";
dbnames = new List<string>();
string strValue = "";
LibraryChannel channel = new LibraryChannel();
channel.Url = strUrl;
try
{
long lRet = channel.Login(strUserName,
strPassword,
"type=worker,client=dp2circulation|" + Program.ClientVersion,
out strError);
if (lRet != 1)
{
strError = "对服务器 '" + channel.Url + "' 以用户 '" + strUserName + "' 进行登录时发生错误: " + strError;
return -1;
}
lRet = channel.GetSystemParameter(null,
"system",
"biblioDbGroup",
out strValue,
out strError);
if (lRet == -1)
{
strError = "针对服务器 " + channel.Url + " 获得书目库信息过程发生错误:" + strError;
return -1;
}
}
finally
{
channel.Close();
}
{
// 解析 XML
XmlDocument dom = new XmlDocument();
dom.LoadXml("<root />");
try
{
dom.DocumentElement.InnerXml = strValue;
}
catch (Exception ex)
{
strError = "category=system,name=biblioDbGroup 所返回的 XML 片段在装入 InnerXml 时出错: " + ex.Message;
return -1;
}
XmlNodeList nodes = dom.DocumentElement.SelectNodes("database");
foreach (XmlNode node in nodes)
{
string strDbName = DomUtil.GetAttr(node, "biblioDbName");
dbnames.Add(strDbName);
}
}
return 0;
}
开发者ID:renyh1013,项目名称:dp2,代码行数:69,代码来源:PageCenter.cs
示例6: ReleaseAllChannelsBut
void ReleaseAllChannelsBut(LibraryChannel channel)
{
for (int i = 0; i < this.Channels.Count; i++)
{
LibraryChannel cur_channel = this.Channels[i];
if (cur_channel == channel)
continue;
channel.Abort();
this.Channels.RemoveChannel(channel);
i--;
}
}
开发者ID:renyh1013,项目名称:dp2,代码行数:14,代码来源:OperLogForm.cs
示例7: ProcessFiles
// return:
// -1 出错
// 0 正常结束
// 1 中断
/// <summary>
/// 处理日志文件
/// </summary>
/// <param name="owner">宿主窗口</param>
/// <param name="stop">停止对象</param>
/// <param name="estimate">剩余时间估算器</param>
/// <param name="channel">通讯通道</param>
/// <param name="filenames">要参与处理的日志文件名集合</param>
/// <param name="nLevel">从 dp2Library 服务器获取日志记录的详细级别</param>
/// <param name="strStyle">处理风格。autocache</param>
/// <param name="strCacheDir">日志本地缓存目录</param>
/// <param name="param">回调对象</param>
/// <param name="procDoRecord">回调函数</param>
/// <param name="strError">返回出错信息</param>
/// <returns>
/// -1 出错
/// 0 正常结束
/// 1 中断
/// </returns>
public static int ProcessFiles(
IWin32Window owner,
Stop stop,
ProgressEstimate estimate,
LibraryChannel channel,
List<string> filenames,
int nLevel,
string strStyle,
string strCacheDir,
object param,
Delegate_doRecord procDoRecord,
out string strError)
{
strError = "";
int nRet = 0;
bool bAccessLog = StringUtil.IsInList("accessLog", strStyle);
if (string.IsNullOrEmpty(strCacheDir) == false)
PathUtil.CreateDirIfNeed(strCacheDir);
// ProgressEstimate estimate = new ProgressEstimate();
bool bAutoCache = StringUtil.IsInList("autocache", strStyle);
if (bAutoCache == true)
{
long lServerFileSize = 0;
long lCacheFileSize = 0;
// 象征性获得一个日志文件的尺寸,主要目的是为了触发一次通道登录
// return:
// -1 error
// 0 file not found
// 1 found
nRet = GetFileSize(
stop,
channel,
strCacheDir,
"20121001.log",
bAccessLog,
out lServerFileSize,
out lCacheFileSize,
out strError);
if (nRet == -1)
return -1;
// 检查日志文件缓存目录的版本是否和当前用户的信息一致
// return:
// -1 出错
// 0 一致
// 1 不一致
nRet = DetectCacheVersionFile(
strCacheDir,
"version.xml",
channel.LibraryCodeList,
channel.Url,
out strError);
if (nRet == -1)
return -1;
if (nRet == 1)
{
// 清空当前缓存目录
nRet = Global.DeleteDataDir(
owner,
strCacheDir,
out strError);
if (nRet == -1)
return -1;
PathUtil.CreateDirIfNeed(strCacheDir); // 重新创建目录
// 创建版本文件
nRet = CreateCacheVersionFile(
strCacheDir,
"version.xml",
channel.LibraryCodeList,
channel.Url,
out strError);
if (nRet == -1)
//.........这里部分代码省略.........
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:OperLogForm.cs
示例8: SaveBiblioToDatabase
// 保存书目记录到数据库
// parameters:
// bIncludeFileID (书目记录XML)是否要根据当前rescontrol内容合成<dprms:file>元素?
// return:
// -1 出错
// 0 没有保存
// 1 已经保存
/// <summary>
/// 保存书目记录到数据库
/// </summary>
/// <param name="channel_param">通讯通道。如果为 null,表示函数内使用自动获得的通道</param>
/// <param name="bIncludeFileID">(书目记录XML)是否要根据当前对象控件内容合成<dprms:file>元素?</param>
/// <param name="strHtml">返回新记录的 OPAC 格式内容</param>
/// <param name="strStyle">风格。由 displaysuccess / searchdup 之一或者逗号间隔组合而成。displaysuccess 显示最后的成功消息在框架窗口的状态条; searchdup 保存成功后发送查重消息</param>
/// <returns>
/// <para>-1 出错</para>
/// <para>0 没有保存</para>
/// <para>1 已经保存</para>
/// </returns>
public int SaveBiblioToDatabase(
LibraryChannel channel_param,
bool bIncludeFileID,
out string strHtml,
string strStyle = "displaysuccess,searchdup")
{
string strError = "";
strHtml = "";
int nRet = 0;
bool bDisplaySuccess = StringUtil.IsInList("displaysuccess", strStyle);
bool bSearchDup = StringUtil.IsInList("searchdup", strStyle);
if (this.Cataloging == false)
{
strError = "当前不允许编目功能,因此也不允许保存书目信息的功能";
return -1;
}
// 如果刚才在删除后模式,现在取消这个模式 2007/10/15
if (this.DeletedMode == true)
{
// TODO: 除了册信息,也要考虑期、采购信息
int nEntityCount = this.entityControl1.ItemCount;
if (nEntityCount > 0)
{
DialogResult result = MessageBox.Show(this,
"如果您用本功能将刚删除的书目记录保存回数据库,那么书目记录下属的 "
+ nEntityCount.ToString()
+ " 条实体记录将不会被保存回实体库。\r\n\r\n如果要在保存书目数据的同时也完整保存这些被删除的实体记录,请先在种册窗工具条上选择“.../使能编辑保存”功能,然后再使用“全部保存”按钮"
+ "\r\n\r\n是否要在不保存实体记录的情况下单独保存书目记录? (Yes 是 / No 放弃单独保存书目记录的操作)",
"EntityForm",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2);
if (result == DialogResult.No)
{
strError = "放弃保存书目记录";
goto ERROR1;
}
}
}
string strTargetPath = this.BiblioRecPath;
if (string.IsNullOrEmpty(strTargetPath) == true)
{
// 需要询问保存的路径
BiblioSaveToDlg dlg = new BiblioSaveToDlg();
MainForm.SetControlFont(dlg, this.Font, false);
dlg.MainForm = this.MainForm;
dlg.Text = "仅保存书目记录";
dlg.MessageText = "请指定新书目记录要保存到的位置";
dlg.EnableCopyChildRecords = false;
dlg.BuildLink = false;
dlg.CopyChildRecords = false;
{
string strMarcSyntax = this.GetCurrentMarcSyntax();
if (string.IsNullOrEmpty(strMarcSyntax) == true)
strMarcSyntax = this.MarcSyntax; // 外来数据的 MARC 格式
dlg.MarcSyntax = strMarcSyntax;
}
dlg.CurrentBiblioRecPath = this.BiblioRecPath;
this.MainForm.AppInfo.LinkFormState(dlg, "entityform_BiblioSaveToDlg_state");
dlg.ShowDialog(this);
// this.MainForm.AppInfo.UnlinkFormState(dlg);
if (dlg.DialogResult != DialogResult.OK)
return 0;
strTargetPath = dlg.RecPath;
}
// 保存前的准备工作
{
//.........这里部分代码省略.........
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:EntityForm.cs
示例9: LoadObject
// return:
// -1 error
// 0 没有装载
// 1 已经装载
public int LoadObject(
LibraryChannel channel,
string strBiblioRecPath,
string strXml,
string dp2library_version,
out string strError)
{
strError = "";
this.ErrorInfo = "";
// 2007/12/2
if (String.IsNullOrEmpty(strXml) == true)
{
this.Changed = false;
return 0;
}
this.BiblioRecPath = strBiblioRecPath;
XmlDocument dom = new XmlDocument();
try
{
dom.LoadXml(strXml);
}
catch (Exception ex)
{
strError = "XML记录装载到DOM时出错: " + ex.Message;
return -1;
}
XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
nsmgr.AddNamespace("dprms", DpNs.dprms);
XmlNodeList nodes = dom.DocumentElement.SelectNodes("//dprms:file", nsmgr);
return LoadObject(
channel,
nodes,
dp2library_version,
out strError);
}
开发者ID:renyh1013,项目名称:dp2,代码行数:46,代码来源:BinaryResControl.cs
示例10: SearchAllBatchNo
// 检索出盘点库内全部批次号名称
int SearchAllBatchNo(
LibraryChannel channel,
Stop stop,
string strInventoryDbName,
out string strError)
{
strError = "";
this.listView_records.Items.Clear();
// EnableControls(false);
stop.OnStop += new StopEventHandler(channel.DoStop);
stop.Initial("正在列出全部批次号 ...");
stop.BeginLoop();
try
{
// 构造检索式
StringBuilder text = new StringBuilder();
text.Append("<target list='"
+ StringUtil.GetXmlStringSimple(strInventoryDbName + ":" + "批次号")
+ "'>");
// 当前是否为全局用户
bool bGlobalUser = this._libraryCodeList.Count == 0 || this._libraryCodeList.IndexOf("") != -1;
// 全局用户只认列表中 "" 一个值。这样可以检索出全部批次号,包括各个分馆的
if (bGlobalUser == true && this._libraryCodeList.Count != 1)
{
this._libraryCodeList.Clear();
this._libraryCodeList.Add("");
}
int i = 0;
foreach (string librarycode in this.LibraryCodeList)
{
if (i > 0)
text.Append("<operator value='OR' />");
text.Append("<item><word>"
+ StringUtil.GetXmlStringSimple(bGlobalUser ? "" : librarycode + "-")
+ "</word><match>left</match><relation>=</relation><dataType>string</dataType><maxCount>-1</maxCount></item><lang>zh</lang>");
i++;
}
if (bGlobalUser == true)
{
if (i > 0)
text.Append("<operator value='OR' />");
// 针对空批次号的检索。空只能被全局用户可见
text.Append("<item><word>"
+ StringUtil.GetXmlStringSimple("")
+ "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>-1</maxCount></item><lang>zh</lang>");
i++;
}
text.Append("</target>");
#if NO
// 构造检索式
string strQueryXml = "<target list='"
+ StringUtil.GetXmlStringSimple(strInventoryDbName + ":" + "批次号")
+ "'><item><word>"
+ StringUtil.GetXmlStringSimple("")
+ "</word><match>left</match><relation>=</relation><dataType>string</dataType><maxCount>-1</maxCount></item><lang>zh</lang>";
strQueryXml += "<operator value='OR' />";
strQueryXml += "<item><word>"
+ StringUtil.GetXmlStringSimple("")
+ "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>-1</maxCount></item><lang>zh</lang></target>";
#endif
long lRet = channel.Search(
stop,
text.ToString(),
"batchno",
"keycount", // strOutputStyle
out strError);
if (lRet == 0)
{
strError = "not found";
return 0; // not found
}
if (lRet == -1)
return -1;
long lHitCount = lRet;
long lStart = 0;
long lCount = lHitCount;
DigitalPlatform.CirculationClient.localhost.Record[] searchresults = null;
// 装入浏览格式
for (; ; )
{
Application.DoEvents(); // 出让界面控制权
if (stop != null && stop.State != 0)
{
strError = "用户中断";
return -1;
//.........这里部分代码省略.........
开发者ID:paopaofeng,项目名称:dp2,代码行数:101,代码来源:SelectBatchNoDialog.cs
示例11: GetOneObjectMetadata
// 获得一个对象资源的元数据
int GetOneObjectMetadata(
LibraryChannel channel,
string strBiblioRecPath,
string strID,
out string strMetadataXml,
out byte[] timestamp,
out string strError)
{
timestamp = null;
strError = "";
string strResPath = strBiblioRecPath + "/object/" + strID;
strResPath = strResPath.Replace(":", "/");
#if NO
Stop.OnStop += new StopEventHandler(this.DoStop);
Stop.Initial("正在下载对象的元数据 " + strResPath);
Stop.BeginLoop();
#endif
Stop.Initial("正在下载对象的元数据 " + strResPath);
try
{
string strOutputPath = "";
// EnableControlsInLoading(true);
string strResult = "";
// 只得到metadata
long lRet = channel.GetRes(
Stop,
strResPath,
"metadata,timestamp,outputpath",
out strResult,
out strMetadataXml,
out timestamp,
out strOutputPath,
out strError);
if (lRet == -1)
{
strError = "下载对象 " + strResPath + " 元数据失败,原因: " + strError;
return -1;
}
return 0;
}
finally
{
// EnableControlsInLoading(false);
#if NO
Stop.EndLoop();
Stop.OnStop -= new StopEventHandler(this.DoStop);
Stop.Initial("");
#endif
Stop.Initial("");
}
}
开发者ID:renyh1013,项目名称:dp2,代码行数:58,代码来源:BinaryResControl.cs
示例12: LoadData
//.........这里部分代码省略.........
out strError);
}
else if (this.DbType == "comment")
{
lRet = channel.GetCommentInfo(
this.Stop,
"@path:" + strRecPath,
"xml",
out strXml,
out strOutputRecPath,
out baTimestamp,
"",
out strBiblio,
out strBiblioRecPath,
out strError);
}
else if (this.DbType == "patron")
{
string[] results = null;
// 获得读者记录
lRet = channel.GetReaderInfo(
this.Stop,
"@path:" + strRecPath,
"xml",
out results,
out strOutputRecPath,
out baTimestamp,
out strError);
if (lRet == 1)
{
if (results == null || results.Length == 0)
{
strError = "results error";
nRet = -1;
}
else
strXml = results[0];
}
}
else
{
lRet = -1;
strError = "无法识别的 DbType '"+this.DbType+"'";
}
if (lRet == 0)
{
nRet = -1;
strError = "获取记录 " + strRecPath + " 时出错: " + strError;
}
else if (lRet == -1)
{
nRet = -1;
strError = "获取记录 " + strRecPath + " 时出错: " + strError;
}
else
{
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 = "";
if (nRet == -1)
{
strHtml2 = HttpUtility.HtmlEncode(strError);
}
else
{
nRet = ItemSearchForm.GetXmlHtml(info,
out strXml1,
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 = strXml1;
return true;
}
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:ItemPropertyTask.cs
示例13: InitialInfo
// 从服务器端得到XML数据,初始化若干变量
// parameters:
// page 如果!=null,允许灵敏中断
// return:
// -1 出错
// 0 正常结束
// 1 被用户中断
public int InitialInfo(
System.Web.UI.Page page,
LibraryChannel channel,
out string strError)
{
strError = "";
Line line = this;
if (this.m_bInfoInitilized == true)
return 0;
if (String.IsNullOrEmpty(this.m_strRecPath) == true)
{
strError = "m_strRecPath尚未初始化";
return -1;
}
string strStyle = "content,data";
string strContent;
string strMetaData;
byte[] baTimeStamp;
string strOutputPath;
Debug.Assert(channel != null, "Channels.GetChannel 异常");
if (page != null
&& page.Response.IsClientConnected == false) // 灵敏中断
return 1;
long nRet = channel.GetRes(null,
this.m_strRecPath,
strStyle,
out strContent,
out strMetaData,
out baTimeStamp,
out strOutputPath,
out strError);
if (nRet == -1)
{
strError = "获取记录 '" + this.m_strRecPath + "' 时出错: " + strError;
return -1;
}
if (page != null
&& page.Response.IsClientConnected == false) // 灵敏中断
return 1;
// 处理数据
nRet = line.ProcessXml(
page,
strContent,
out strError);
if (nRet == -1)
{
return -1;
}
this.m_bInfoInitilized = true;
return 0;
}
开发者ID:renyh1013,项目名称:dp2,代码行数:70,代码来源:ColumnStorage.cs
示例14: SearchAllLocation
// 检索出实体库全部可用的馆藏地名称
int SearchAllLocation(
LibraryChannel channel,
Stop stop,
out string strError)
{
strError = "";
long lTotalCount = 0;
this.listView_records.Items.Clear();
// EnableControls(false);
stop.OnStop += new StopEventHandler(channel.DoStop);
stop.Initial("正在列出全部馆藏地 ...");
stop.BeginLoop();
try
{
for (int i = 0; i < 2; i++)
{
long lRet = Channel.SearchItem(
stop,
"<all>",
"", // strBatchNo
-1,
"馆藏地点",
i == 0 ? "left" : "exact", // 第二次为检索空值
"zh",
"batchno", // strResultSetName
"", // "desc",
"keycount", // strOutputStyle
out strError);
if (lRet == 0)
{
#if NO
strError = "not found";
return 0; // not found
#endif
continue;
}
if (lRet == -1)
return -1;
long lHitCount = lRet;
long lStart = 0;
long lCount = lHitCount;
DigitalPlatform.CirculationClient.localhost.Record[] searchresults = null;
// 装入浏览格式
for (; ; )
{
Application.DoEvents(); // 出让界面控制权
if (stop != null && stop.State != 0)
{
strError = "用户中断";
return -1;
}
lRet = channel.GetSearchResult(
stop,
"batchno", // strResultSetName
lStart,
lCount,
"keycount",
"zh",
out searchresults,
out strError);
if (lRet == -1)
{
strError = "GetSearchResult() error: " + strError;
return -1;
}
if (lRet == 0)
{
// MessageBox.Show(this, "未命中");
continue;
}
// 处理浏览结果
foreach (Record record in searchresults)
{
if (record.Cols == null)
{
strError = "请更新应用服务器和数据库内核到最新版本,才能使用列出馆藏地的功能";
return -1;
}
if (this._libraryCodeList.Count > 0
&& MatchLibraryCode(this._libraryCodeList, record.Path) == false)
continue;
// 跳过数字为 0 的事项
if (record.Cols.Length > 0 && record.Cols[0] == "0")
continue;
ListViewItem item = new ListViewItem();
//.........这里部分代码省略.........
开发者ID:paopaofeng,项目名称:dp2,代码行数:101,代码来源:SelectBatchNoDialog.cs
示例15: Save
// 保存资源到服务器
// return:
// -1 error
// >=0 实际上载的资源对象数
public int Save(
LibraryChannel channel,
string dp2library_version,
out string strError)
{
strError = "";
if (this.ListView.Items.Count == 0)
return 0;
if (String.IsNullOrEmpty(this.BiblioRecPath) == true)
{
strError = "尚未指定BiblioRecPath";
return -1;
}
if (IsNewPath(this.BiblioRecPath) == true)
{
strError = "书目记录路径 '" + this.BiblioRecPath + "' 不是已保存的记录路径,无法用于对象资源上载";
return -1;
}
#if NO
if (this.Channel == null)
{
strError = "BinaryResControl尚未指定Channel";
return -1;
}
#endif
StopStyle old_stop_style = StopStyle.None;
if (Stop != null)
{
old_stop_style = Stop.Style;
Stop.Style = StopStyle.EnableHalfStop;
#if NO
Stop.OnStop += new StopEventHandler(this.DoStop);
Stop.Initial("正在上载资源 ...");
Stop.BeginLoop();
#endif
Stop.Initial("正在上载资源 ...");
}
int nUploadCount = 0; // 实际上载的资源个数
try
{
// bNotAskTimestampMismatchWhenOverwrite = false;
for (int i = 0; i < this.ListView.Items.Count; i++)
{
ListViewItem item = this.ListView.Items[i];
LineInfo info = (LineInfo)item.Tag;
// string strUsage = ListViewUtil.GetItemText(item, COLUMN_USAGE);
LineState state = GetLineState(item);
bool bOnlyChangeMetadata = false;
if (state == LineState.Changed ||
state == LineState.New)
{
if (state == LineState.Changed)
{
if (info != null
&& info.ResChanged == false)
{
if (StringUtil.CompareVersion(dp2library_version, "2.59") < 0)
{
strError = "单独修改对象 metadata 的操作需要连接的 dp2library 版本在 2.59 以上 (然而当前 dp2library 版本为 " + dp2library_version + ")";
return -1;
}
// 这种情况应该是 metadata 修改过
bOnlyChangeMetadata = true;
#if NO
SetLineInfo(item,
// strUsage,
LineState.Normal);
SetXmlChanged(item, false);
SetResChanged(item, false);
continue; // 资源没有修改的,则跳过上载
#endif
}
}
}
else
{
// 标记删除的事项,只要书目XML重新构造的时候
// 不包含其ID,书目XML保存后,就等于删除了该事项。
// 所以本函数只是简单Remove这样的listview事项即可
if (state == LineState.Deleted)
{
this.ListView.Items.Remove(item);
i--;
}
//.........这里部分代码省略.........
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:BinaryResControl.cs
示例16: PrepareSearch
/// <summary>
/// 准备进行检索
/// </summary>
/// <returns>0: 没有成功; 1: 成功</returns>
public int PrepareSearch()
{
if (String.IsNullOrEmpty(this.LibraryServerUrlList) == true)
return 0;
if (this.Channel == null)
this.Channel = new LibraryChannel();
this.Channel.Url = GetFirstUrl(this.LibraryServerUrlList);
this.Channel.BeforeLogin -= new DigitalPlatform.LibraryClient.BeforeLoginEventHandle(Channel_BeforeLogin);
this.Channel.BeforeLogin += new DigitalPlatform.LibraryClient.BeforeLoginEventHandle(Channel_BeforeLogin);
Stop = new DigitalPlatform.Stop();
Stop.Register(stopManager, true); // 和容器关联
return 1;
}
开发者ID:renyh1013,项目名称:dp2,代码行数:22,代码来源:MainForm.cs
示例17: SearchComments
// 检索出评注数据
// return:
// 命中的全部结果数量。
public static long SearchComments(
OpacApplication app,
LibraryChannel channel,
string strBiblioRecPath,
out string strError)
{
strError = "";
// string strXml = "";
Debug.Assert(String.IsNullOrEmpty(strBiblioRecPath) == false, "");
//string strBiblioDbName = ResPath.GetDbName(strBiblioRecPath);
string strBiblioDbName = StringUtil.GetDbName(strBiblioRecPath);
if (String.IsNullOrEmpty(strBiblioDbName) == true)
{
strError = "从书目记录路径 '" + strBiblioRecPath + "' 中无法获得库名部分";
return -1;
}
string strCommentDbName = "";
// 根据书目库名, 找到对应的评注库名
// return:
// -1 出错
// 0 没有找到
// 1 找到
int nRet = app.GetCommentDbName(strBiblioDbName,
out strCommentDbName,
out strError);
if (nRet == -1)
return -1;
//string strBiblioRecId = ResPath.GetRecordId(strBiblioRecPath);
string strBiblioRecId = StringUtil.GetRecordId(strBiblioRecPath);
string strQueryXml = "<target list='"
+ StringUtil.GetXmlStringSimple(strCommentDbName + ":" + "父记录") // 2007/9/14
|
请发表评论