本文整理汇总了C#中SessionInfo.CloseSession方法的典型用法代码示例。如果您正苦于以下问题:C# SessionInfo.CloseSession方法的具体用法?C# SessionInfo.CloseSession怎么用?C# SessionInfo.CloseSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionInfo
的用法示例。
在下文中一共展示了SessionInfo.CloseSession方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateOneLocationResultset
// 创建一个馆藏地的限定结果集
void CreateOneLocationResultset(string strLocation)
{
string strError = "";
// 临时的SessionInfo对象
SessionInfo session = new SessionInfo(this);
try
{
string strQueryXml = "";
// 构造检索实体库的 XML 检索式
// return:
// -1 出错
// 0 没有发现任何实体库定义
// 1 成功
int nRet = this.BuildSearchItemQuery(
"<全部>",
strLocation + "/",
-1,
"馆藏地点",
"left",
"zh",
"", // strSearchStyle,
out strQueryXml,
out strError);
if (nRet == -1)
goto ERROR1;
if (nRet == 0)
return;
this._app_down.Token.ThrowIfCancellationRequested();
RmsChannel channel = session.Channels.GetChannel(this.WsUrl);
if (channel == null)
{
strError = "get channel error";
goto ERROR1;
}
#if DETAIL_LOG
this.WriteErrorLog("开始检索");
#endif
long lHitCount = channel.DoSearch(strQueryXml,
"default",
"", // strOutputStyle,
out strError);
if (lHitCount == -1)
goto ERROR1;
if (lHitCount == 0)
{
// 没有命中任何记录,也要继续后面的处理
}
this._app_down.Token.ThrowIfCancellationRequested();
DpResultSet resultset = new DpResultSet(true);
try
{
if (lHitCount > 0)
{
nRet = GetResultset(channel,
"default",
resultset,
out strError);
if (nRet == -1)
goto ERROR1;
}
// 写入 dp2kernel 成为永久结果集
nRet = UploadPermanentResultset(channel,
strLocation,
resultset,
out strError);
if (nRet == -1)
goto ERROR1;
}
finally
{
resultset.Close();
}
return;
}
finally
{
session.CloseSession();
session = null;
}
ERROR1:
this.WriteErrorLog("馆藏地结果集创建出错: " + strError);
return;
}
示例2: LocationResultsetExists
// 探测一个结果集在 dp2kernel 一侧是否已经存在
bool LocationResultsetExists(string strLocation)
{
string strError = "";
// 临时的SessionInfo对象
SessionInfo session = new SessionInfo(this);
try
{
this._app_down.Token.ThrowIfCancellationRequested();
RmsChannel channel = session.Channels.GetChannel(this.WsUrl);
if (channel == null)
return false;
#if DETAIL_LOG
this.WriteErrorLog("开始探测结果集 " + strLocation);
#endif
Record[] searchresults = null;
// 获得检索结果的浏览格式
// 浅包装版本
long lHitCount = channel.DoGetSearchResult(
"#" + strLocation,
0,
0,
"id",
"zh",
null,
out searchresults,
out strError);
if (lHitCount == -1)
{
if (channel.ErrorCode == ChannelErrorCode.NotFound)
return false;
return false;
}
return true;
}
finally
{
session.CloseSession();
session = null;
}
}
示例3: ResetPassword
//.........这里部分代码省略.........
DomUtil.SetElementText(node, "tempPassword", strReaderTempPassword);
DomUtil.SetElementText(node, "expireTime", expire.ToLongTimeString());
DomUtil.SetElementText(node, "period", "一小时");
DomUtil.SetElementText(node, "refID", strRefID); // 在所提供的姓名或者电话号码命中不止一条读者记录的情形,调用者后面使用读者记录的 refID 来绑定特别重要。
}
else
{
if (string.IsNullOrEmpty(strMessageTemplate) == true)
strMessageTemplate = "%name% 您好!\n您的读者帐户(证条码号为 %barcode%)已设临时密码 %temppassword%,在 %period% 内登录会成为正式密码";
string strBody = strMessageTemplate.Replace("%barcode%", strBarcode)
.Replace("%name%", strName)
.Replace("%temppassword%", strReaderTempPassword)
.Replace("%expiretime%", expire.ToLongTimeString())
.Replace("%period%", "一小时");
// string strBody = "读者(证条码号) " + strBarcode + " 的帐户密码已经被重设为 " + strReaderNewPassword + "";
// 向手机号码发送短信
{
// 发送消息
try
{
// 发送一条消息
// parameters:
// strPatronBarcode 读者证条码号
// strPatronXml 读者记录XML字符串。如果需要除证条码号以外的某些字段来确定消息发送地址,可以从XML记录中取
// strMessageText 消息文字
// strError [out]返回错误字符串
// return:
// -1 发送失败
// 0 没有必要发送
// >=1 发送成功,返回实际发送的消息条数
nRet = external_interface.HostObj.SendMessage(
strBarcode,
readerdom.DocumentElement.OuterXml,
strBody,
strLibraryCode,
out strError);
}
catch (Exception ex)
{
strError = external_interface.Type + " 类型的外部消息接口Assembly中SendMessage()函数抛出异常: " + ex.Message;
nRet = -1;
}
if (nRet == -1)
{
strError = "向读者 '" + strBarcode + "' 发送" + external_interface.Type + " message时出错: " + strError;
if (this.Statis != null)
this.Statis.IncreaseEntryValue(
strLibraryCode,
"重设密码通知",
external_interface.Type + " message 重设密码通知消息发送错误数",
1);
this.WriteErrorLog(strError);
return -1;
}
else
{
if (this.Statis != null)
this.Statis.IncreaseEntryValue(
strLibraryCode,
"重设密码通知",
external_interface.Type + " message 重设密码通知消息发送数",
nRet); // 短信条数可能多于次数
if (this.Statis != null)
this.Statis.IncreaseEntryValue(strLibraryCode,
"重设密码通知",
external_interface.Type + " message 重设密码通知人数",
1);
}
}
}
byte[] output_timestamp = null;
nRet = ChangeReaderTempPassword(
sessioninfo,
record.RecPath,
readerdom,
strReaderTempPassword,
strExpireTime,
record.Timestamp,
out output_timestamp,
out strError);
if (nRet == -1)
return -1; // 此时短信已经发出,但临时密码并未修改成功
}
if (StringUtil.IsInList("returnMessage", strStyle) == true)
strMessage = output_dom.DocumentElement.OuterXml;
}
finally
{
sessioninfo.CloseSession();
sessioninfo = null;
}
if (bReturnMessage == false)
strError = "临时密码已通过短信方式发送到手机 " + strTelParam + "。请按照手机短信提示进行操作";
return 1;
}
示例4: GetBiblioSummary
// 获得图书摘要信息
// 调用时不需要SessionInfo
public int GetBiblioSummary(string strItemBarcode,
string strConfirmItemRecPath,
string strBiblioRecPathExclude,
int nMaxLength,
out string strBiblioRecPath,
out string strSummary,
out string strError)
{
strError = "";
strSummary = "";
strBiblioRecPath = "";
// 临时的SessionInfo对象
SessionInfo sessioninfo = new SessionInfo(this);
// 模拟一个账户
Account account = new Account();
account.LoginName = "内部调用";
account.Password = "";
account.Rights = "getbibliosummary";
account.Type = "";
account.Barcode = "";
account.Name = "内部调用";
account.UserID = "内部调用";
account.RmsUserName = this.ManagerUserName;
account.RmsPassword = this.ManagerPassword;
sessioninfo.Account = account;
try
{
RmsChannel channel = sessioninfo.Channels.GetChannel(this.WsUrl);
if (channel == null)
{
strError = "get channel error";
return -1;
}
LibraryServerResult result = this.GetBiblioSummary(
sessioninfo,
channel,
strItemBarcode,
strConfirmItemRecPath,
strBiblioRecPathExclude,
out strBiblioRecPath,
out strSummary);
if (result.Value == -1)
{
strError = result.ErrorInfo;
return -1;
}
else
{
if (nMaxLength != -1)
{
// 截断
if (strSummary.Length > nMaxLength)
strSummary = strSummary.Substring(0, nMaxLength) + "...";
}
}
}
finally
{
sessioninfo.CloseSession();
sessioninfo = null;
}
return 0;
}
示例5: LoadCfg
//.........这里部分代码省略.........
// goto ERROR1;
}
else
{
#if LOG_INFO
app.WriteErrorLog("INFO: CheckKernelVersion");
#endif
// 检查 dpKernel 版本号
nRet = CheckKernelVersion(session.Channels,
out strError);
if (nRet == -1)
goto ERROR1;
}
#if LOG_INFO
app.WriteErrorLog("INFO: InitialVdbs");
#endif
// 2008/6/6 重新初始化虚拟库定义
// 这样,其他地方调用的InitialVdbs()就可以去除了
// TODO: 为了提高运行速度,可以优化为,只有当<virtualDatabases>元素下的内容有改变时,才重新进行这个初始化
this.vdbs = null;
nRet = app.InitialVdbs(session.Channels,
out strError);
if (nRet == -1)
{
app.WriteErrorLog("ERR002 首次初始化vdbs失败: " + strError);
}
}
finally
{
session.CloseSession();
session = null;
#if LOG_INFO
app.WriteErrorLog("INFO: 临时 session 使用完毕");
#endif
}
}
// 时钟
string strClock = DomUtil.GetElementText(dom.DocumentElement, "clock");
try
{
this.Clock.Delta = Convert.ToInt64(strClock);
}
catch
{
// TODO: 写入错误日志
}
// *** 初始化操作日志环境
if (bReload == false) // 2014/4/2
{
// this.OperLogDir = strOperLogDir; // 2006/12/7
#if LOG_INFO
app.WriteErrorLog("INFO: OperLog.Initial");
#endif
// oper log
nRet = this.OperLog.Initial(this,
strOperLogDir,
out strError);