当前位置: 首页>>代码示例>>C#>>正文


C# Session.Commit方法代码示例

本文整理汇总了C#中Session.Commit方法的典型用法代码示例。如果您正苦于以下问题:C# Session.Commit方法的具体用法?C# Session.Commit怎么用?C# Session.Commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Session的用法示例。


在下文中一共展示了Session.Commit方法的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);
        }
    }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:32,代码来源:PurchaseRCVLine.aspx.cs

示例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;
     }
 }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:26,代码来源:RCVHeadImpl.cs

示例3: 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);
        }
    }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:33,代码来源:InventoryCheckWH.aspx.cs

示例4: 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);
            }
        }
    }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:32,代码来源:ProductInManage.aspx.cs

示例5: 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;
         }
     }
 }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:34,代码来源:InventoryCheckManage.aspx.cs

示例6: 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);
             }
         }
     }
 }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:31,代码来源:RestrictLogis2MemberManager.aspx.cs

示例7: 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);
         }
     }
 }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:31,代码来源:ProductInLine.aspx.cs

示例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);
             }
         }
     }
 }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:34,代码来源:ExcelTemplateManager.aspx.cs

示例9: MagicItemCommand

    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        try
        {
            if (e.CommandName == "Add" && !string.IsNullOrEmpty(this.drpArea.SelectedValue))
            {
                #region 添加库位
                using (ISession session = new Session())
                {
                    INVCheckHead head = INVCheckHead.Retrieve(session, this.OrderNumber);
                    try
                    {
                        session.BeginTransaction();
                        head.AddArea(session, this.drpArea.SelectedValue);
                        session.Commit();

                        this.BindArea(session, head);
                        this.QueryAndBindData(session, head);
                    }
                    catch (Exception er1)
                    {
                        session.Rollback();
                        WebUtil.ShowError(this, er1);
                        return;
                    }
                }
                #endregion
            }
            else if (e.CommandName == "Confirm")
            {
                #region 确定开始盘点作业
                bool success = false;
                using (ISession session = new Session())
                {
                    INVCheckHead head = INVCheckHead.Retrieve(session, this.OrderNumber);
                    try
                    {
                        session.BeginTransaction();
                        head.ConfirmCheckOrder(session);
                        session.Commit();
                        success = true;
                    }
                    catch (Exception er1)
                    {
                        session.Rollback();
                        WebUtil.ShowError(this, er1);
                        return;
                    }
                }
                #endregion
                if (success)
                    this.Response.Redirect("InventoryCheckDetail.aspx?ordNum="+this.OrderNumber+"&return="+WebUtil.escape(WebUtil.Param("return")));
            }
        }
        catch (Exception er)
        {
            WebUtil.ShowError(this, er);
        }
    }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:59,代码来源:InventoryCheckWH.aspx.cs

示例10: 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);
                }
            }
        }
    }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:46,代码来源:LogisReturnEdit.aspx.cs

示例11: 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, "保存成功");
            }
        }
    }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:57,代码来源:InterchangeEdit.aspx.cs

示例12: 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")));
            }
        }
    }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:54,代码来源:POReturnEdit.aspx.cs

示例13: 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")));
            }
        }
    }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:52,代码来源:ProductInEdit.aspx.cs

示例14: 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, "保存成功");
            }
        }
    }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:49,代码来源:AssistItemInEdit.aspx.cs

示例15: Setup

 public void Setup()
 {
     var eventStore = new TestInMemoryEventStore();
     _snapshotStore = new TestSnapshotStore();
     var snapshotStrategy = new DefaultSnapshotStrategy();
     var repository = new SnapshotRepository(_snapshotStore, snapshotStrategy, new Repository(eventStore), eventStore);
     var session = new Session(repository);
     var aggregate = new TestSnapshotAggregate();
     for (var i = 0; i < 200; i++)
     {
         aggregate.DoSomething();
     }
     session.Add(aggregate);
     session.Commit();
 }
开发者ID:Carevel,项目名称:CQRSlite,代码行数:15,代码来源:When_saving_a_snapshotable_aggregate.cs


注:本文中的Session.Commit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。