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


C# ISession.Rollback方法代码示例

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


在下文中一共展示了ISession.Rollback方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SMSSender

        private static void SMSSender(ISession session, Notification message, ConfigParam config, SendResult state)
        {
            object s = null;
            string errorMessage = null, mobile;
            bool error = false;
            string errorCode = string.Empty ;
            foreach (NotificationReceiver receiver in message.Receivers)
            {
               s = null;
                error = false;
                errorMessage = null;
                errorCode = "";
                //合法性检查
                mobile = receiver.PostTo;
                if (!CheckSms(ref mobile))
                {
                    log.ErrorFormat("message {0}, receiver: {1} not send: 无效的手机号码", message.NotifyID, receiver.PostTo);
                    errorMessage = "无效的手机号码";
                    error = true;
                }

                //尝试发送
                if (!error)
                    try
                    {
                        s = _smsService.SendMessage(config.SMSAccount, config.SMSPassword, message.Content, mobile);
                        error =_smsService.ParseSendResult(s,out errorCode, out errorMessage);
                        log.DebugFormat("message {0} sent, receiver: {1}, content: {2}", message.NotifyID, mobile, message.Content);
                    }
                    catch (Exception er)
                    {
                        //发送过程如果发生异常,异常信息将尝试记入数据库
                        error = true;
                        errorMessage = er.Message;
                    }

                //记录发送结果状态
                try
                {
                    session.BeginTransaction();
                    bool success = message.AfterSendDo(receiver, error ? "-99998" : "-99999", errorMessage);
                    session.Commit();
                    if (success) state.SuccessCount++;
                    else state.ErrorCount++;
                }
                catch (Exception er)
                {
                    //如果记录发送结果状态时发生异常,只能将异常信息记入日志文件
                    session.Rollback();
                    state.ErrorCount++;
                    log.ErrorFormat("message: {0}, receiver: {1}, result code: {2}, result error: {3}, exception: {4}", message.NotifyID, receiver.PostTo, error?"-99998":errorCode, errorMessage, er.Message);
                }
            }
            message.AfterSendDo();
        }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:55,代码来源:SendService.cs

示例2: UpdateLines

        public int UpdateLines(ISession session, IList<RCVLine> linesValue)
        {
            if (linesValue == null || linesValue.Count <= 0) return 0;

            #region ���
            IList<RCVLine> lines = new List<RCVLine>(linesValue.Count);
            bool error = false, errorHead = false;
            System.Text.StringBuilder builder = new System.Text.StringBuilder();
            bool hasSection = false;
            foreach (RCVLine lv in linesValue)
            {
                errorHead = false;
                //�ջ������Ƿ���Ч
                if (lv.RCVTotalQty <= 0M)
                {
                    error = true;
                    if (!errorHead) builder.Append("�к�").Append(lv.LineNumber).Append(": ");
                    errorHead = true;
                    builder.Append("�ջ�����С��0; ");
                    continue;
                }
                RCVLine l = RCVLine.Retrieve(session, lv.OrderNumber, lv.LineNumber);
                //���Բ���д���ܣ��������д�ˣ����������Ч��
                WHSection section = null;
                hasSection = false;
                //��������������
                WHArea area = WHArea.Retrieve(session, l.AreaCode);
                if (!string.IsNullOrEmpty(l.SectionCode) && l.SectionCode.Trim().Length > 0)
                {
                    hasSection = true;
                    section = WHSection.Retrieve(session, l.AreaCode, l.SectionCode);
                }
                decimal capacityFree = 0M;
                //ȡ��λ����������
                if (hasSection) capacityFree = section.SectionCapacity;
                else capacityFree = area.AreaCapacity;
                //��λ�����ۼ���ǰ�Ѵ����
                if (hasSection)
                    capacityFree = capacityFree - Cast.Decimal(session.CreateObjectQuery(@"
            select sum(StockQty) from StockDetail
            where AreaCode=?area and SectionCode=?section")
                        .Attach(typeof(StockDetail))
                        .SetValue("?area", area.AreaCode, "AreaCode")
                        .SetValue("?section", section.SectionCode, "SectionCode")
                        .Scalar(), 0M);
                else
                    capacityFree = capacityFree - Cast.Decimal(session.CreateObjectQuery(@"select sum(StockQty) from StockDetail where AreaCode=?area")
                        .Attach(typeof(StockDetail))
                        .SetValue("?area", area.AreaCode, "AreaCode")
                        .Scalar(), 0M);
                //ʣ�������ͱ���������Ƚ�
                if (capacityFree < lv.QualifiedQty)
                {
                    builder.Append("�к�").Append(lv.LineNumber).Append(": ");
                    error = true;
                    builder.Append("�����").Append(lv.QualifiedQty).Append("����ʣ������").Append(capacityFree);
                }
                if (!error) lines.Add(l);
            }
            if (error)
                throw new Exception(builder.ToString());
            #endregion

            int count = 0;
            DbSession dbsession = session.DbSession as DbSession;
            session.BeginTransaction();
            for (int i = 0; i < lines.Count; i++)
            {
                RCVLine line = lines[i];
                POLine poLine = null;
                if (!string.IsNullOrEmpty(this._refOrderNumber) && this._refOrderNumber.Trim().Length > 0
                    && !string.IsNullOrEmpty(line.RefOrderLine) && line.RefOrderLine.Trim().Length > 0)
                    poLine = POLine.Retrieve(session, this._refOrderNumber, line.RefOrderLine);
                if (poLine != null)
                {
                    IDbCommand cmd = dbsession.CreateStoredProcCommand("F_PUR_RCV_TOLERANCE_RATIO", new object[] { 0, poLine.OrderNumber });
                    dbsession.ExecuteNonQuery(cmd);
                    IDbDataParameter p = cmd.Parameters[0] as IDbDataParameter;
                    decimal ration = Cast.Decimal(p.Value);
                    if (poLine.PurchaseQty * (1 + ration) - poLine.ReceiveQty - poLine.UnfinishedReceiveQty - linesValue[i].QualifiedQty + line.QualifiedQty < 0)
                    {
                        error = true;
                        builder.Append("�к�").Append(line.LineNumber).Append("�ջ�����").Append(linesValue[i].QualifiedQty)
                            .Append("����PO�����ջ�����").Append(Math.Floor(poLine.PurchaseQty * (1 + ration)) - poLine.ReceiveQty - poLine.UnfinishedReceiveQty + line.QualifiedQty);
                        break;
                    }
                    poLine.UnfinishedReceiveQtyChange(session, linesValue[i].QualifiedQty - line.QualifiedQty);
                }
                line.RCVTotalQty = linesValue[i].RCVTotalQty;
                line.QualifiedQty = linesValue[i].QualifiedQty;
                line.Update(session, "RCVTotalQty", "QualifiedQty");

                count++;
            }
            if (error)
            {
                session.Rollback();
                throw new Exception(builder.ToString());
            }
            else
//.........这里部分代码省略.........
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:101,代码来源:RCVHeadImpl.cs

示例3: RollbackIfNecessary

        /// <summary> Rollback the Session if not within a distributed transaction.</summary>
        /// <remarks>Needs investigation - no distributed tx in EMS</remarks>
        /// <param name="session">the NMS Session to rollback
        /// </param>
        /// <throws>  NMSException if committing failed </throws>
	    public static void RollbackIfNecessary(ISession session)
        {
		    AssertUtils.ArgumentNotNull(session, "ISession must not be null");
			session.Rollback();

			// TODO Investigate

//		    try {
//			    session.Rollback();
//		    }
//		    catch (TransactionInProgressException ex) {
//			    // Ignore -> can only happen in case of a JTA transaction.
//		    }
//		    catch (IllegalStateException ex) {
//			    // Ignore -> can only happen in case of a JTA transaction.
//		    }
	    }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:22,代码来源:MessageUtils.cs

示例4: MailSender

        private static void MailSender(ISession session, Notification message, ConfigParam config, SendResult state)
        {
            bool error = false;
            string errorMessage = null, code = null;
            foreach (NotificationReceiver receiver in message.Receivers)
            {
                error = false;
                errorMessage = "";
                code = "0";
                //合法性检查
                if (!CheckMail(receiver.PostTo))
                {
                    log.ErrorFormat("message {0}, receiver: {1} not send: 无效的EMail地址", message.NotifyID, receiver.PostTo);
                    errorMessage = "无效的EMail地址";
                    code = "-99999";
                    error = true;
                }

                //尝试发送
                if (!error)
                    try
                    {
                        _mailService.Subject = message.Title;
                        _mailService.HTMLBody = message.Content;
                        _mailService.ClearRecipients();
                        _mailService.AddRecipient(receiver.PostTo, receiver.UserName, null);
                        error = !_mailService.Send(config.MailServer, false);
                        code = _mailService.ErrorCode.ToString();
                        errorMessage = _mailService.ErrorMessage + " " + _mailService.Log;
                        _mailService.Close();
                        if (error)
                        {
                            log.ErrorFormat("message {0}, receiver: {1} not send: {2} - {3}", message.NotifyID, receiver.PostTo, _mailService.ErrorCode, _mailService.ErrorMessage);
                        }
                        else
                            log.DebugFormat("message {0} sent, receiver: {1}", message.NotifyID, receiver.PostTo);
                    }
                    catch (Exception er)
                    {
                        //发送过程如果发生异常,异常信息将尝试记入数据库
                        error = true;
                        errorMessage = er.Message;
                        code = "-99999";
                    }

                //记录发送结果状态
                try
                {
                    session.BeginTransaction();
                    bool success = message.AfterSendDo(receiver, code, errorMessage);
                    session.Commit();
                    if (success) state.SuccessCount++;
                    else state.ErrorCount++;
                }
                catch (Exception er)
                {
                    //如果记录发送结果状态时发生异常,只能将异常信息记入日志文件
                    session.Rollback();
                    state.ErrorCount++;
                    log.ErrorFormat("message: {0}, receiver: {1}, result code: {2}, result error: {3}, exception: {4}", message.NotifyID, receiver.ReceiverID, code, errorMessage, er.Message);
                }
            }
            message.AfterSendDo();
        }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:64,代码来源:SendService.cs

示例5: cmdProduct_Click

    protected void cmdProduct_Click(object sender, EventArgs e)
    {
        if (this.txtSkuId.Value.Trim().Length <= 0) return;

        bool added = false;
        using (_session = new Session())
        {
            string[] idArray = this.txtSkuId.Value.Trim().Trim(';').Split(';');
            try
            {
                POHead head = POHead.Retrieve(_session, this.OrderNumber);
                if (head == null || head.Status != POStatus.New) return;

                _session.BeginTransaction();
                foreach (string s in idArray)
                {
                    POLine poLine = new POLine();
                    poLine.OrderNumber = this.OrderNumber;
                    poLine.SKUID = Cast.Int(s, 0);
                    if (poLine.SKUID <= 0) continue;
                    poLine.LineNumber = head.NextLineNumber();
                    poLine.LineStatus = POLineStatus.Open;
                    poLine.PurchaseQty = 0M;
                    poLine.Price = 0M;
                    //Vendor vendor = null;
                    //if (head.VendorID > 0) vendor = Vendor.Retrieve(_session, head.VendorID);
                    //if (vendor != null)
                    //{
                    //    poLine.TaxID = vendor.TaxID;
                    //    poLine.TaxValue = vendor.Tax;
                    //}
                    //else
                    //{
                    //    poLine.TaxID = 0;
                    //    poLine.TaxValue = 0M;
                    //}
                    poLine.TaxID = 0;
                    poLine.TaxValue = 0M;
                    poLine.TaxInclusiveAmt = 0M;
                    poLine.TaxAmt = 0M;
                    poLine.TaxExlusiveAmt = 0M;
                    poLine.PlanDate = head.DefaultPlanDate;
                    poLine.ActualDate = new DateTime(1900, 1, 1);
                    poLine.ReceiveQty = 0M;
                    poLine.IQCQty = 0M;
                    poLine.UnfinishedReceiveQty = 0M;
                    poLine.ModifyUser = SecuritySession.CurrentUser.UserId;
                    poLine.ModifyTime = DateTime.Now;
                    poLine.UnitID = 0;

                    poLine.Create(_session);
                    added = true;
                }
                head.Update(_session, "CurrentLineNumber");
                _session.Commit();
                if (added)
                {
                    BindPOLine(_session, head);
                    WebUtil.ShowMsg(this, "订单明细保存成功", "操作成功");
                }
            }
            catch (Exception ex)
            {
                _session.Rollback();
                logger.Info("保存POLine", ex);
                WebUtil.ShowError(this, "发生未处理的异常,请刷新页面重新操作,或者联系系统管理员");
            }
        }
    }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:69,代码来源:POLineManage.aspx.cs

示例6: SaveCheckOrder

    private void SaveCheckOrder()
    {
        try
        {
            DataSet ds = Session["InvAdjustmentItem"] as DataSet;

            Dictionary<int, int> lstCurrentQuantity = new Dictionary<int, int>();
            for (int i = 0; i < this.rptInvCheck.Items.Count; i++)
            {
                TextBox objBox = this.rptInvCheck.Items[i].FindControl("txtCurrentQuantity") as TextBox;
                System.Web.UI.HtmlControls.HtmlInputHidden objSKU = this.rptInvCheck.Items[i].FindControl("hidSKUID") as System.Web.UI.HtmlControls.HtmlInputHidden;
                try
                {
                    lstCurrentQuantity.Add(Cast.Int(objSKU.Value), Cast.Int(objBox.Text));
                }
                catch (Exception ex)
                {
                    WebUtil.ShowMsg(this, "调整数量非法,请重新输入!");
                    return;
                }
            }

            using (_session = new Session())
            {
                _session.BeginTransaction();
                try
                {
                    INVCheckHead objHead = INVCheckHead.Retrieve(_session, this.txtInvCheckNumber.Text);

                    bool blnInsert = false;
                    if (objHead == null)
                    {
                        blnInsert = true;
                        objHead = new INVCheckHead();
                        objHead.CreateTime = DateTime.Now;
                        objHead.CreateUser = Magic.Security.SecuritySession.CurrentUser.UserId;
                        objHead.Note = this.txtMemo.Text;
                        objHead.OrderNumber = Magic.ERP.ERPUtil.NextOrderNumber(Magic.ERP.Orders.INVCheckHead.ORDER_TYPE_ADJ);
                        objHead.OrderTypeCode = INVCheckHead.ORDER_TYPE_ADJ;
                        objHead.Status = Magic.ERP.INVCheckStatus.New;
                        objHead.Create(_session);
                    }
                    else
                    {
                        if ((objHead.Status == Magic.ERP.INVCheckStatus.Release) || (objHead.Status == Magic.ERP.INVCheckStatus.Close))
                        {
                            WebUtil.ShowMsg(this, "发布以后的盘点单不可以进行修改");
                            return;
                        }

                        objHead.Note = this.txtMemo.Text;
                        blnInsert = false;
                        _session.CreateEntityQuery<INVCheckLine>().Where(Exp.Eq("OrderNumber", objHead.OrderNumber)).Delete();
                    }

                    objHead.CurrentLineNumber = "";

                    List<INVCheckLine> List = new List<INVCheckLine>();
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        INVCheckLine objLine = new INVCheckLine();
                        objLine.SKUID = Cast.Int(ds.Tables[0].Rows[i]["SKUID"]);
                        objLine.AreaCode = Cast.String(ds.Tables[0].Rows[i]["AreaCode"]);
                        objLine.BeforeQty = Cast.Decimal(ds.Tables[0].Rows[i]["BeforeQty"]);
                        objLine.CurrentQty = lstCurrentQuantity[objLine.SKUID];
                        objLine.LineNumber = objHead.NextLineNumber();
                        objLine.LocationCode = Cast.String(ds.Tables[0].Rows[i]["LocationCode"]);
                        objLine.OrderNumber = objHead.OrderNumber;
                        objLine.SectionCode = Cast.String(ds.Tables[0].Rows[i]["SectionCode"]);
                        objLine.Create(_session);
                    }

                    objHead.Update(_session, "CurrentLineNumber");

                    this.txtInvCheckNumber.Text = objHead.OrderNumber;
                    _session.Commit();
                }
                catch (Exception ex)
                {
                    _session.Rollback();
                    throw ex;
                }
            }
            WebUtil.ShowMsg(this, "库存盘点单保存成功", "操作成功");
        }
        catch (Exception ex)
        {
            logger.Info("保存库存盘点单", ex);
            WebUtil.ShowMsg(this, "发生未处理的异常,请刷新页面重新操作,或者联系系统管理员");
        }
    }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:91,代码来源:StockAdjustment.aspx.cs

示例7: SetupRollbackExpectations

 private static void SetupRollbackExpectations(IConnection connection, IConnectionFactory connectionFactory, ISession session)
 {
     Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once();
     Expect.Call(connection.CreateSession(AcknowledgementMode.Transactional)).Return(session).Repeat.Once();
     session.Rollback();
     LastCall.On(session).Repeat.Once();
     session.Close();
     LastCall.On(session).Repeat.Once();
     connection.Close();
     LastCall.On(connection).Repeat.Once();
 }
开发者ID:chadsowald,项目名称:spring-net,代码行数:11,代码来源:MessageTransactionManagerTests.cs

示例8: MagicItemCommand

    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            #region 保存
            //txtPurchaseQty txtPlanDate txtPrice
            bool updated = false;
            using (_session = new Session())
            {
                POHead head = POHead.Retrieve(_session, this.OrderNumber);
                if (head == null || head.Status != POStatus.New) return;

                _session.BeginTransaction();
                try
                {
                    foreach (RepeaterItem item in this.rptPL.Items)
                    {
                        HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                        if (!string.IsNullOrEmpty(chk.Value))
                        {
                            HtmlInputText txtPurchaseQty = item.FindControl("txtPurchaseQty") as HtmlInputText;
                            HtmlInputText txtPlanDate = item.FindControl("txtPlanDate") as HtmlInputText;
                            HtmlInputText txtPrice = item.FindControl("txtPrice") as HtmlInputText;
                            POLine poLine = POLine.Retrieve(_session, this.OrderNumber, chk.Value);
                            if (poLine == null || poLine.LineStatus != POLineStatus.Open) continue;

                            poLine.PurchaseQty = Cast.Decimal(txtPurchaseQty.Value, poLine.PurchaseQty);
                            poLine.PlanDate = Cast.DateTime(txtPlanDate.Value, poLine.PlanDate);
                            poLine.Price = Cast.Decimal(txtPrice.Value, poLine.Price);
                            poLine.TaxID = 0;
                            poLine.TaxValue = 0M;
                            //含税额(含税采购成本)  TaxInclusiveAmt 含税额 = 数量*单价
                            poLine.TaxInclusiveAmt = poLine.PurchaseQty * poLine.Price;
                            //不含税额(采购成本) TaxExlusiveAmt 含税额-税额
                            poLine.TaxExlusiveAmt = 0M; // poLine.TaxInclusiveAmt / (1 + poLine.TaxValue);
                            //税额    TaxAmt  税额 = 不含税额*税率
                            poLine.TaxAmt = 0M; //poLine.TaxExlusiveAmt * poLine.TaxValue;
                            poLine.Update(_session, "PurchaseQty", "TaxID", "TaxValue", "PlanDate", "Price", "TaxInclusiveAmt");
                            updated = true;
                        }
                    }
                    //更新统计信息
                    if (updated)
                        UpdatePOLineAndPoHead(_session, head);
                    _session.Commit();
                    if (updated)
                    {
                        BindPOLine(_session, head);
                        WebUtil.ShowMsg(this, "采购订单明细保存成功", "操作成功");
                    }
                }
                catch (Exception ex)
                {
                    _session.Rollback();
                    WebUtil.ShowError(this, ex);
                }
            }
            #endregion
        }
        else if (e.CommandName == "Cancel")
        {
            #region 取消明细
            bool updated = false;
            using (_session = new Session())
            {
                POHead head = POHead.Retrieve(_session, this.OrderNumber);
                if (head.Status != POStatus.Release)
                    return;

                _session.BeginTransaction();
                try
                {
                    foreach (RepeaterItem item in this.rptPL.Items)
                    {
                        HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                        if (chk != null && chk.Checked && !string.IsNullOrEmpty(chk.Value))
                        {
                            POLine poLine = POLine.Retrieve(_session, this.OrderNumber, chk.Value);
                            if (poLine == null || poLine.LineStatus != POLineStatus.Open) continue;
                            poLine.LineStatus = POLineStatus.Cancel;
                            poLine.ModifyUser = Magic.Security.SecuritySession.CurrentUser.UserId;
                            poLine.ModifyTime = DateTime.Now;
                            poLine.Update(_session, "LineStatus", "ModifyUser", "ModifyTime");
                            updated = true;
                        }
                    }
                    //再次统计 POLine
                    if (updated)
                        UpdatePOLineAndPoHead(_session, head);
                    _session.Commit();

                    if (updated)
                    {
                        BindPOLine(_session, head);
                        WebUtil.ShowMsg(this, "选择的明细已经取消", "操作成功");
                    }
                }
                catch (Exception ex)
                {
                    _session.Rollback();
//.........这里部分代码省略.........
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:101,代码来源:POLineManage.aspx.cs

示例9: SaveSaleDeliver

    private void SaveSaleDeliver()
    {
        try
        {
            using (_session = new Session())
            {
                if (Magic.ERP.Orders.EDHead.Retrieve(_session, this.txtSaleDeliver.Text).Status != Magic.ERP.DeliverStatus.New)
                {
                    WebUtil.ShowMsg(this, "只有状态为新建的换货发货单才可以修改保存!");
                    return;
                }
            }

            List<Magic.ERP.Orders.SDLine> List = new List<Magic.ERP.Orders.SDLine>();
            for (int i = 0; i < this.rptSDLine.Items.Count; i++)
            {
                Magic.ERP.Orders.SDLine objLine = new Magic.ERP.Orders.SDLine();
                objLine.AreaCode = (this.rptSDLine.Items[i].FindControl("ddlArea") as DropDownList).SelectedValue;
                objLine.SectionCode = (this.rptSDLine.Items[i].FindControl("ddlSection") as DropDownList).SelectedValue;
                objLine.OrderNumber = this.txtSaleDeliver.Text;
                objLine.LineNumber = (this.rptSDLine.Items[i].FindControl("tdLineNumber") as System.Web.UI.HtmlControls.HtmlTableCell).InnerText.Replace("\r\n","").Trim();
                if (objLine.AreaCode.Trim().Length == 0)
                {
                    WebUtil.ShowMsg(this, "发货单明细"+objLine.LineNumber+"的仓库区域不能为空,请重新输入!", "保存失败");
                    return;
                }
                List.Add(objLine);
            }

            using (_session = new Session())
            {
                _session.BeginTransaction() ;
                try
                {
                    for (int i = 0; i < List.Count; i++)
                    {
                        EntityManager.Update(_session, List[i], "AreaCode", "SectionCode");
                    }
                    _session.Commit();
                }
                catch (Exception ex)
                {
                    _session.Rollback();
                    throw ex;
                }
            }

            WebUtil.ShowMsg(this, "发货单保存成功", "操作成功");
        }
        catch (Exception ex)
        {
            logger.Info("保存发货单", ex);
            WebUtil.ShowMsg(this, "发生未处理的异常,请刷新页面重新操作,或者联系系统管理员");
        }
    }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:55,代码来源:ExchangeDeliverEdit.aspx.cs

示例10: PostApprove

 /// <summary>
 /// ǩ�����
 /// </summary>
 /// <param name="session"></param>
 public virtual void PostApprove(ISession session)
 {
     try
     {
         session.BeginTransaction();
         this.Close(session);
         session.Commit();
     }
     catch (Exception er)
     {
         log.Error((this._orderTypeCode == ORDER_TYPE_CHK ? "sto chk" : "sto adj") + this.OrderNumber + " was approved, error occurs while trying to close this order automatically", er);
         session.Rollback();
     }
 }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:18,代码来源:INVCheckHeadImpl.cs

示例11: QueryAndBindData

    private void QueryAndBindData(ISession session, int pageIndex, int pageSize, bool fetch)
    {
        int count = 0;
        DataSet ds = null;

        DateTime start = Cast.DateTime(this.txtDateFrom.Text, DateTime.Now.AddMonths(-1));
        DateTime end = Cast.DateTime(this.txtDateTo.Text, DateTime.Now);
        this.txtDateFrom.Text = start.ToString("yyyy-MM-dd");
        this.txtDateTo.Text = end.ToString("yyyy-MM-dd");
        string itemCode = "%" + this.txtItemCode.Text.Trim() + "%";
        string itemName = "%" + this.txtItemName.Text.Trim() + "%";
        //string color = "%" + this.txtColor.Text.Trim() + "%";
        //string size = "%" + this.txtSize.Text.Trim() + "%";
        string color = "%%";
        string size = "%%";
        int all = this.chkAll.Checked ? 1 : 0;

        try
        {
            session.BeginTransaction();
            DbSession db = session.DbSession as DbSession;
            IDbCommand cmd = db.CreateStoredProcCommand("p_rpt_pur_sale_analysis", new object[] { start, end, all, itemCode, itemName, color, size });
            db.ExecuteNonQuery(cmd);

            if (fetch)
                count = Cast.Int(db.ExecuteScalar(@"
        Select Count(1) From(
           Select Distinct sku.itm_code
           From cus_temp_4_pur_sale_analysis a
           Inner Join prd_item_sku sku On a.sku_id=sku.sku_id
        ) t"));

            int startIndex = (pageIndex - 1) * pageSize + 1, endIndex = pageIndex * pageSize;
            string sql = string.Format(@"
        Select * From(
        Select t.*,Rownum As rn From(
        Select it.itm_code ItemCode,it.itm_name ItemName
           ,Sum(a.begin_qty) begin_qty,Sum(a.begin_amt) begin_amt
           ,Sum(a.pur_qty) pur_qty,Sum(a.pur_amt) pur_amt
           ,Sum(a.pur_rtn_qty) pur_rtn_qty,Sum(a.pur_rtn_amt) pur_rtn_amt
           ,Sum(a.sale_qty) sale_qty,Sum(a.sale_amt) sale_amt
           ,Sum(a.sale_rtn_qty) sale_rtn_qty,Sum(a.sale_rtn_amt) sale_rtn_amt
           ,Sum(a.chk_qty+a.adj_qty+a.lend_qty+a.lend_rtn_qty+a.used_qty+a.oth_in_qty+a.scrap_qty) other_qty
           ,Sum(nvl(a.end_qty,0)) end_qty,Sum(nvl(a.end_amt,0)) end_amt
           ,Sum(nvl(sto.use_qty,0)) sto_qty
        From cus_temp_4_pur_sale_analysis a
        Left Join inv_stock_sum sto On sto.sku_id=a.sku_id
        Inner Join prd_item_sku sku On a.sku_id=sku.sku_id
        Inner Join prd_item it On it.itm_id=sku.itm_id
        Group By it.itm_code,it.itm_name
        Order By it.itm_code
        )t
        )t2 Where t2.rn>={0} And t2.rn<={1}", startIndex, endIndex);
            cmd = db.CreateSqlStringCommand(sql);
            ds = db.ExecuteDataSet(cmd);

            session.Commit();
        }
        catch(Exception er)
        {
            session.Rollback();
            WebUtil.ShowError(this, er);
        }

        this.repeater.DataSource = ds;
        this.repeater.DataBind();
        if (fetch) this.magicPagerMain.RecordCount = this.magicPagerSub.RecordCount = count;
        WebUtil.SetMagicPager(magicPagerMain, pageSize, pageIndex);
        WebUtil.SetMagicPager(magicPagerSub, pageSize, pageIndex);
    }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:70,代码来源:PurchseSaleAnalysis.aspx.cs

示例12: PostApprove

 public virtual void PostApprove(ISession session)
 {
     try
     {
         session.BeginTransaction();
         try
         {
             this.Close(session);
             session.Commit();
         }
         catch (Exception er2)
         {
             session.Rollback();
             log.Error("���ӵ�" + this._orderNumber + "ǩ����ϣ������Զ��ر�ʱ�����쳣", er2);
             return;
         }
     }
     catch (Exception er)
     {
         log.Error("���ӵ�" + this._orderNumber + "ǩ����ϣ������Զ��ر�ʱ�����쳣", er);
         return;
     }
 }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:23,代码来源:ICHeadImpl.cs

示例13: SetupRollbackExpectations

 private static void SetupRollbackExpectations(IConnection connection, IConnectionFactory connectionFactory, ISession session)
 {
     Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once();
     Expect.Call(connection.CreateSession(true, Session.SESSION_TRANSACTED)).Return(session).Repeat.Once();
     session.Rollback();
     LastCall.On(session).Repeat.Once();
     session.Close();
     LastCall.On(session).Repeat.Once();
     connection.Close();
     LastCall.On(connection).Repeat.Once();
 }
开发者ID:fgq841103,项目名称:spring-net,代码行数:11,代码来源:MessageTransactionManagerTests.cs


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