本文整理汇总了C#中Session.Rollback方法的典型用法代码示例。如果您正苦于以下问题:C# Session.Rollback方法的具体用法?C# Session.Rollback怎么用?C# Session.Rollback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session.Rollback方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cmdAddLines_Click
//����ѡ����ֹ�ѡ��ɹ�������ϸ�����ջ��ķ�ʽ
//���ַ�ʽ��ʱ��������
protected void cmdAddLines_Click(object sender, EventArgs e)
{
string[] linesArray = this.txtPOLines.Value.Trim().Trim(';').Split(';');
if (linesArray == null || linesArray.Length <= 0) return;
using (ISession session = new Session())
{
RCVHead head = RCVHead.Retrieve(session, this.OrderNumber);
try
{
session.BeginTransaction();
foreach (string s in linesArray)
{
POLine poLine = null;
if (!string.IsNullOrEmpty(s) && s.Trim().Length > 0)
poLine = POLine.Retrieve(session, head.RefOrderNumber, s);
if (poLine != null)
head.AddLine(session, poLine);
}
head.Update(session, "CurrentLineNumber");
session.Commit();
}
catch (Exception er)
{
session.Rollback();
WebUtil.ShowError(this, er);
}
this.QueryAndBindData(session, head);
}
}
示例2: Close
public static void Close(RCVHead head)
{
try
{
using (ISession session = new Session())
{
try
{
session.BeginTransaction();
head.Close(session, false);
session.Commit();
}
catch (Exception er1)
{
session.Rollback();
log.Error(string.Format("�ջ���{0}ǩ����ɣ��Զ��ر�ʱ�����쳣", head.OrderNumber), er1);
return;
}
}
}
catch (Exception er)
{
log.Error(string.Format("�ջ���{0}ǩ����ɣ��Զ��ر�ʱ�����쳣�����������ݿ�", head.OrderNumber), er);
return;
}
}
示例3: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
using (ISession session = new Session())
{
try
{
StockInHead head = StockInHead.Retrieve(session, this.OrderNumber);
string msg = "";
session.BeginTransaction();
if (e.CommandName == "Save")
{
this.Save(session, head);
msg = "����ɹ�";
}
else if (e.CommandName == "Release")
{
this.Confirm(session, head);
msg = "���۸�������";
}
session.Commit();
this.QueryAndBindData(session, head);
this.SetView(head);
WebUtil.ShowMsg(this, msg);
}
catch (Exception er)
{
session.Rollback();
WebUtil.ShowError(this, er);
}
}
}
示例4: cmdDelete_Click
protected void cmdDelete_Click(object sender, EventArgs e)
{
LinkButton cmd = sender as LinkButton;
if (cmd == null) return;
string area = cmd.Attributes["area"];
if (string.IsNullOrEmpty(area) || area.Trim().Length <= 0) return;
try
{
using (ISession session = new Session())
{
INVCheckHead head = INVCheckHead.Retrieve(session, this.OrderNumber);
try
{
session.BeginTransaction();
head.RemoveArea(session, area);
session.Commit();
this.BindArea(session, head);
this.QueryAndBindData(session, head);
}
catch (Exception err)
{
session.Rollback();
WebUtil.ShowError(this, err);
return;
}
}
}
catch (Exception er)
{
WebUtil.ShowError(this, er);
}
}
示例5: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
using (ISession session = new Session())
{
bool deleted = false;
try
{
session.BeginTransaction();
foreach (RepeaterItem item in this.repeatControl.Items)
{
HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
if (chk != null && chk.Checked && chk.Value.Trim().Length > 0)
{
StockInHead.Delete(session, chk.Value.Trim());
deleted = true;
}
}
session.Commit();
if (deleted)
{
WebUtil.ShowMsg(this, "ѡ��IJ�Ʒ��ⵥ�Ѿ�ɾ��");
this.QueryAndBindData(session, this.magicPagerMain.CurrentPageIndex, this.magicPagerMain.PageSize, true);
}
}
catch (Exception er)
{
session.Rollback();
WebUtil.ShowError(this, er);
}
}
}
示例6: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
if (e.CommandName == "Delete")
{
try
{
using (ISession session = new Session())
{
session.BeginTransaction();
try
{
for (int i = 0; i < this.rptSDHead.Items.Count; i++)
{
System.Web.UI.HtmlControls.HtmlInputCheckBox objCheckBox = this.rptSDHead.Items[i].FindControl("checkbox") as System.Web.UI.HtmlControls.HtmlInputCheckBox;
if (objCheckBox.Checked)
INVCheckHead.Delete(session, objCheckBox.Attributes["value"].Trim());
}
session.Commit();
QueryAndBindData(session, 1, this.magicPagerMain.PageSize, true);
}
catch (Exception ex)
{
session.Rollback();
throw ex;
}
}
}
catch (Exception ex)
{
WebUtil.ShowError(this, "ɾ��ʧ��,�������Ա��ϵ!\r\nʧ����Ϣ:" + ex.Message);
return;
}
}
}
示例7: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
if (e.CommandName == "Delete")
{
bool deleted = false;
using (ISession session = new Session())
{
session.BeginTransaction();
try
{
foreach (RepeaterItem item in this.rptVendor.Items)
{
HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
if (chk != null && chk.Checked)
{
int mid = Cast.Int(chk.Attributes["mid"]), lid = Cast.Int(chk.Attributes["lid"]);
deleted = deleted || RestrictLogis2Member.Delete(session, lid, mid) > 0;
}
}
session.Commit();
if (deleted)
QueryAndBindData(session, magicPagerMain.CurrentPageIndex, magicPagerMain.PageSize, true);
}
catch (Exception ex)
{
session.Rollback();
WebUtil.ShowError(this, ex);
}
}
}
}
示例8: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
if (e.CommandName == "Delete")
{
bool deleted = false;
using (ISession session = new Session())
{
session.BeginTransaction();
try
{
foreach (RepeaterItem item in this.rpt.Items)
{
HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
if (chk != null && chk.Checked && Cast.Int(chk.Value) > 0)
{
ExcelTemplate.Delete(session, Cast.Int(chk.Value));
deleted = true;
}
}
session.Commit();
if (deleted)
{
this.QueryAndBindData(session);
WebUtil.ShowMsg(this, "选择的模板文件已经被删除", "操作成功");
}
}
catch (Exception ex)
{
session.Rollback();
WebUtil.ShowError(this, ex);
}
}
}
}
示例9: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
if (e.CommandName == "Save")
{
using (ISession session = new Session())
{
ICHead head = null;
bool created = false;
if (this.IsNew)
{
head = new ICHead();
head.OrderTypeCode = ICHead.ORDER_TYPE;
head.Status = InterchangeStatus.New;
head.ApproveResult = ApproveStatus.UnApprove;
head.ApproveUser = 0;
head.ApproveTime = new DateTime(1900, 1, 1);
head.CreateUser = SecuritySession.CurrentUser.UserId;
head.CreateTime = DateTime.Now;
head.CompanyUser = head.CreateUser;
head.InterchangeTime = DateTime.Now;
head.LogisticUser = this.txtLogisticsUser.Text.Trim();
head.Note = this.txtNote.Text.Trim();
head.LogisticCompID = Magic.Framework.Utils.Cast.Int(this.drpLogistic.SelectedValue);
try
{
session.BeginTransaction();
head.OrderNumber = ERPUtil.NextOrderNumber(head.OrderTypeCode);
head.Create(session);
head.AutoGenerateDetail(session);
session.Commit();
created = true;
//this.txtAction.Value = "edit";
//this.txtId.Value = head.OrderNumber;
//this.showInfo(session, head);
//this.setView(head);
//WebUtil.ShowMsg(this, string.Format("交接单{0}创建成功", head.OrderNumber));
}
catch (Exception er)
{
session.Rollback();
WebUtil.ShowError(this, er);
}
}
if (created)
{
this.Response.Redirect("InterchangeLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
}
head = ICHead.Retrieve(session, this.OrderNumber);
head.Note = this.txtNote.Text.Trim();
head.LogisticCompID = Magic.Framework.Utils.Cast.Int(this.drpLogistic.SelectedValue);
head.LogisticUser = this.txtLogisticsUser.Text.Trim();
head.Update(session, "Note", "LogisticCompID", "LogisticUser", "BoxNum");
WebUtil.ShowMsg(this, "保存成功");
}
}
}
示例10: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
if (e.CommandName == "Save")
{
using (ISession session = new Session())
{
POReturnHead head = null;
if (this.IsNew)
{
head = new POReturnHead();
head.Status = POReturnStatus.New;
head.ApproveResult = ApproveStatus.UnApprove;
head.ApproveUser = 0;
head.ApproveTime = new DateTime(1900, 1, 1);
head.CreateUser = SecuritySession.CurrentUser.UserId;
head.CreateTime = DateTime.Now;
head.Note = this.txtNote.Text.Trim();
head.LocationCode = this.drpLocation.SelectedValue;
head.VendorID = Cast.Int(this.drpVendor.SelectedValue);
try
{
session.BeginTransaction();
head.OrderNumber = ERPUtil.NextOrderNumber(head.OrderTypeCode);
head.Create(session);
session.Commit();
}
catch (Exception er)
{
session.Rollback();
WebUtil.ShowError(this, er);
return;
}
this.Response.Redirect("POReturnLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
return;
}
head = POReturnHead.Retrieve(session, this.OrderNumber);
try
{
session.BeginTransaction();
head.Update(session, Cast.Int(this.drpVendor.SelectedValue), this.drpLocation.SelectedValue, this.txtNote.Text.Trim());
session.Commit();
}
catch (Exception er)
{
session.Rollback();
WebUtil.ShowError(this, er);
return;
}
this.Response.Redirect("POReturnLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
}
}
}
示例11: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
if (e.CommandName == "Save")
{
using (ISession session = new Session())
{
StockInHead head = null;
if (this.IsNew)
{
head = new StockInHead();
head.OrderTypeCode = StockInHead.ORD_TYPE_PRD_IN;
head.Status = StockInStatus.New;
head.ApproveResult = ApproveStatus.UnApprove;
head.ApproveUser = 0;
head.ApproveTime = new DateTime(1900, 1, 1);
head.CreateUser = SecuritySession.CurrentUser.UserId;
head.CreateTime = DateTime.Now;
head.Note = this.txtNote.Text.Trim();
head.LocationCode = this.drpLocation.SelectedValue;
head.RefOrdNum = this.txtRefOrdNum.Text.Trim().ToUpper();
try
{
session.BeginTransaction();
head.OrderNumber = ERPUtil.NextOrderNumber(head.OrderTypeCode);
head.Create(session);
head.AddPrdOutDetail2ThisOrder(session);
session.Commit();
}
catch (Exception er)
{
session.Rollback();
WebUtil.ShowError(this, er);
}
this.Response.Redirect("ProductInLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
return;
}
head = StockInHead.Retrieve(session, this.OrderNumber);
head.Note = this.txtNote.Text.Trim();
head.LocationCode = this.drpLocation.SelectedValue;
head.RefOrdNum = this.txtRefOrdNum.Text.Trim().ToUpper();
head.Update(session, "Note", "LocationCode", "RefOrdNum");
//没有明细时,才考虑将库存领用明细添加进来
if (session.CreateEntityQuery<StockInLine>()
.Where(Magic.Framework.ORM.Query.Exp.Eq("OrderNumber", head.OrderNumber))
.Count() <= 0)
head.AddPrdOutDetail2ThisOrder(session);
this.Response.Redirect("ProductInLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
}
}
}
示例12: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
if (e.CommandName == "Save")
{
using (ISession session = new Session())
{
StockInHead head = null;
if (this.IsNew)
{
head = new StockInHead();
head.OrderTypeCode = StockInHead.ORD_TYPE_ASSIST_IN;
head.Status = StockInStatus.New;
head.ApproveResult = ApproveStatus.UnApprove;
head.ApproveUser = 0;
head.ApproveTime = new DateTime(1900, 1, 1);
head.CreateUser = SecuritySession.CurrentUser.UserId;
head.CreateTime = DateTime.Now;
head.Note = this.txtNote.Text.Trim();
head.LocationCode = this.drpLocation.SelectedValue;
try
{
session.BeginTransaction();
head.OrderNumber = ERPUtil.NextOrderNumber(head.OrderTypeCode);
head.Create(session);
session.Commit();
this.txtAction.Value = "edit";
this.txtId.Value = head.OrderNumber;
this.showInfo(session, head);
this.setView(head);
WebUtil.ShowMsg(this, string.Format("入库单{0}创建成功", head.OrderNumber));
}
catch (Exception er)
{
session.Rollback();
WebUtil.ShowError(this, er);
}
return;
}
head = StockInHead.Retrieve(session, this.OrderNumber);
head.Note = this.txtNote.Text.Trim();
head.LocationCode = this.drpLocation.SelectedValue;
head.Update(session, "Note", "LocationCode");
WebUtil.ShowMsg(this, "保存成功");
}
}
}
示例13: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
if (e.CommandName != "Save")
{
WebUtil.ShowError(this, "��������");
return;
}
bool saved = false;
using (ISession session = new Session())
{
try
{
HtmlInputText input;
DropDownList drp;
string typeCode;
OrderTypeDef typeDef;
session.BeginTransaction();
foreach (RepeaterItem item in this.repeatControl.Items)
{
input = item.FindControl("txtTypeCode") as HtmlInputText;
typeCode = input.Value;
typeDef = OrderTypeDef.Retrieve(session, typeCode);
if (typeDef != null)
{
drp = item.FindControl("drpNeedApprove") as DropDownList;
typeDef.NeedApprove = drp.SelectedValue == "1" ? true : false;
typeDef.Update(session, "NeedApprove");
saved = true;
}
}
session.Commit();
if (saved)
{
WebUtil.ShowMsg(this, "���������Ѿ�����ɹ�", "����ɹ�");
this.QueryAndBindData(session);
}
}
catch (Exception er)
{
session.Rollback();
WebUtil.ShowError(this, er);
}
}
}
示例14: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
if (e.CommandName == "Save")
{
using (ISession session = new Session())
{
ReturnHead head = null;
if (this.IsNew)
{
head = new ReturnHead();
try
{
head.LogisReturn(session, this.drpLocation.SelectedValue, this.txtSNNumber.Text, Cast.Int(this.drpReason.SelectedValue, 0), this.chkIsMalicious.Checked, this.chkHasTransported.Checked, this.txtNote.Text.Trim(), SecuritySession.CurrentUser.UserId);
head.OrderNumber = ERPUtil.NextOrderNumber(head.OrderTypeCode);
session.BeginTransaction();
head.Create(session);
session.Commit();
this.Response.Redirect("LogisReturnScan.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape("LogisReturnLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(this.ReturnUrl)));
}
catch (Exception er)
{
session.Rollback();
WebUtil.ShowError(this, er);
}
return;
}
try
{
head = ReturnHead.Retrieve(session, this.OrderNumber);
head.LogisReturn(session, this.drpLocation.SelectedValue, this.txtSNNumber.Text, Cast.Int(this.drpReason.SelectedValue, 0), this.chkIsMalicious.Checked, this.chkHasTransported.Checked, this.txtNote.Text.Trim(), SecuritySession.CurrentUser.UserId);
session.BeginTransaction();
head.Update(session, "Note", "LocationCode", "ReasonID", "ReasonText", "IsMalicious", "RefOrderID", "RefOrderNumber", "OrginalOrderNumber", "LogisticsName", "LogisticsID", "MemberName", "MemberID", "HasTransported");
session.Commit();
WebUtil.ShowMsg(this, "保存成功");
}
catch (Exception er2)
{
session.Rollback();
WebUtil.ShowError(this, er2);
}
}
}
}
示例15: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
if (e.CommandName == "Delete")
{
//MagicToolBar���¼�
bool deleted = false;
using (ISession session = new Session())
{
session.BeginTransaction();
try
{
foreach (RepeaterItem item in this.rptUser.Items)
{
HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
if (chk != null && chk.Checked && Cast.Int(chk.Value) > 0)
{
Magic.Sys.User user = Magic.Sys.User.Retrieve(session, Cast.Int(chk.Value));
if (user != null)
{
//��ɾ��������״̬update��UserStatus.Deleted
user.Status = UserStatus.Deleted;
user.ModifyBy = Magic.Security.SecuritySession.CurrentUser.UserId;
user.ModifyTime = DateTime.Now;
//Update������2���汾��
//1. ֻ��ISession������������ʵ�����������
//2. ��һ���������Ƶ��ַ������飬ֻ����ָ�����ֶ�
user.Update(session, "Status", "ModifyBy", "ModifyTime");
deleted = true;
}
}
}
session.Commit();
if (deleted)
this.QueryAndBindData(session, this.magicPagerMain.CurrentPageIndex, this.magicPagerMain.PageSize, true);
WebUtil.ShowMsg(this, "ѡ����û��Ѿ���ɾ��", "�����ɹ�");
}
catch (Exception err)
{
session.Rollback();
WebUtil.ShowError(this, err);
}
}
}
}