本文整理汇总了C#中Estar.Business.DataManager.QueryDataRes.RollbackAndClose方法的典型用法代码示例。如果您正苦于以下问题:C# QueryDataRes.RollbackAndClose方法的具体用法?C# QueryDataRes.RollbackAndClose怎么用?C# QueryDataRes.RollbackAndClose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Estar.Business.DataManager.QueryDataRes
的用法示例。
在下文中一共展示了QueryDataRes.RollbackAndClose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
string strResult = "";
if (null == this.Session["userid"])
{
strResult = leofun.setvaltag("", "成功", "false");
strResult = leofun.setvaltag(strResult, "提示", "无效用户,请重新登录!");
this.Response.Write(leofun.Escape(strResult));
return;
}
//User userInfo = new User(this.Session["userid"].ToString());
XmlDocument xmldoc = new XmlDocument();
//读取用户参数
StreamReader streamreader = new StreamReader(this.Request.InputStream, Encoding.UTF8);
xmldoc.LoadXml(streamreader.ReadToEnd());
NameObjectList paramlist = BuildParamList.BuildParams(xmldoc);
string[] dataItems = BuildParamList.getValue(xmldoc, "workdataitems").Split(',');
string datasrcFile = BuildParamList.getValue(xmldoc, "DataSrcFile");
QueryDataRes query = new QueryDataRes(datasrcFile);
//QueryDataRes query = new QueryDataRes(unitItem.DataSrcFile);
try
{
query.BeginTransaction();
for (int i = 0; i < dataItems.Length; i++)
{
//WorkItem workItem = this.unitItem.WorkItemList[i];
//检测一
//强行置入ip地址做为参数
BuildParamList.setValue(xmldoc, "ip", HttpContext.Current.Request.UserHostAddress);
//NameObjectList[] paramInsList = this.CreateParamLists("new", xmldoc, paramlist, workItem);
NameObjectList[] paramInsList = this.CreateParamLists("new", xmldoc, paramlist, dataItems[i]);
NameObjectList[] paramUptList = this.CreateParamLists("modify", xmldoc, paramlist, dataItems[i]);
NameObjectList[] paramDelList = this.CreateParamLists("delete", xmldoc, paramlist, dataItems[i]);
bool bSuccess = query.ExecuteNonQuery(dataItems[i], paramInsList, paramUptList, paramDelList);
if (false == bSuccess)
throw (new Exception("保存项目失败:请检查配置和错误日志!"));
if ("系统数据源" == Path.GetFileName(datasrcFile).ToLower() && "系统信息配置" == dataItems[i])
{
this.ConfigSystem(paramInsList);
this.ConfigSystem(paramUptList);
}
}
query.Commit();
strResult = leofun.setvaltag("", "成功", "true");
strResult = leofun.setvaltag(strResult, "提示", "保存成功!");
this.Response.Write(leofun.Escape(strResult));
}
catch (Exception ex)
{
query.RollbackAndClose();
strResult = leofun.setvaltag("", "成功", "false");
strResult = leofun.setvaltag(strResult, "提示", ex.Message);
this.Response.Write(leofun.Escape(strResult));
}
finally
{
query.Close();
}
}