void SaveReturnReason()
 {
     using (ISession session = new Session())
     {
         try
         {
             ReturnReason returnreason = new ReturnReason();
             returnreason.ReasonText = this.txtReturnReason.Text;
             if (this.IsAddNew())
             {
                 returnreason.Create(session);
             }
             else
             {
                 returnreason.ReasonID = Cast.Int(this.txtReturnID.Value, -1);
                 returnreason.Update(session, "ReasonText");
             }
             this.Response.Redirect("ReturnReasonManager.aspx");
         }
         catch (Exception ex)
         {
             logger.Info("保存Logistics", ex);
             WebUtil.ShowMsg(this, "发生未处理的异常,请刷新页面重新操作,或者联系系统管理员");
         }
     }
 }
Example #2
0
 /// <summary>
 /// 更新会员换货退货单,只是设置实体属性,不会update数据库
 /// </summary>
 /// <param name="session"></param>
 /// <param name="locationCode">库位</param>
 /// <param name="reasonId">退货原因</param>
 /// <param name="note">备注</param>
 /// <param name="createUser"></param>
 public void ExchangeReturn(ISession session, string locationCode, int reasonId, string note, int createUser)
 {
     this.LocationCode = locationCode;
     this.Note         = note;
     this.ReasonID     = reasonId;
     if (reasonId > 0)
     {
         Magic.Basis.ReturnReason reason = Magic.Basis.ReturnReason.Retrieve(session, reasonId);
         if (reason != null)
         {
             this.ReasonText = reason.ReasonText;
         }
     }
 }
Example #3
0
 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.rptReturnReason.Items)
                 {
                     HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                     if (chk != null && chk.Checked && Cast.Int(chk.Value) > 0)
                     {
                         Magic.Basis.ReturnReason returnreason = Magic.Basis.ReturnReason.Retrieve(session, Cast.Int(chk.Value));
                         if (returnreason != null)
                         {
                             //逻辑删除,仅将状态update成UserStatus.Deleted
                             returnreason.ReasonID = Cast.Int(chk.Value);
                             returnreason.Delete(session);
                             deleted = true;
                         }
                     }
                 }
                 session.Commit();
                 if (deleted)
                 {
                     QueryAndBindData(session);
                     WebUtil.ShowMsg(this, "选择的退货原因已经被删除", "操作成功");
                 }
             }
             catch (Exception ex)
             {
                 session.Rollback();
                 WebUtil.ShowError(this, ex);
             }
         }
     }
 }
Example #4
0
        public void LogisReturn(ISession session, string locationCode, string snNumber, int reasonId, bool isMalicious, bool hasTransported, string note, int createUser)
        {
            if (string.IsNullOrEmpty(snNumber) || snNumber.Trim().Length <= 0)
            {
                throw new Exception("必须填写发货单号码");
            }
            CRMSN sn = CRMSN.Retrieve(session, snNumber.Trim());

            if (sn == null)
            {
                throw new Exception("发货单" + snNumber + "不存在");
            }
            if (sn.Status == CRMSNStatus.Return)
            {
                throw new Exception("发货单" + sn.OrderNumber + "已经退货");
            }
            if (sn.Status == CRMSNStatus.PartExchange)
            {
                throw new Exception("发货单" + sn.OrderNumber + "已经换货");
            }
            if (sn.Status != CRMSNStatus.Interchanged)
            {
                throw new Exception("发货单" + snNumber + "未完成,无法退货");
            }
            if (!string.IsNullOrEmpty(this.OrderNumber) && this.OrderNumber.Trim().Length > 0 &&
                !string.IsNullOrEmpty(this.RefOrderNumber) && this.RefOrderNumber.Trim().Length > 0 &&
                this.RefOrderNumber != snNumber)
            {
                //发货单号码改变,检查是否已经有明细存在,如果已经有明细了则不允许删除
                if (session.CreateEntityQuery <ReturnLine>().Where(Exp.Eq("OrderNumber", this.OrderNumber)).Count() > 0)
                {
                    throw new Exception("退货单" + this.OrderNumber + "已经存在退货明细,无法再改变发货单号码");
                }
            }

            this.RefOrderNumber     = sn.OrderNumber;
            this.RefOrderID         = sn.ID;
            this.OrginalOrderNumber = sn.SaleOrderNumber;
            this.MemberID           = sn.MemberID;
            if (sn.MemberID > 0)
            {
                Magic.Basis.Member member = Magic.Basis.Member.Retrieve(session, sn.MemberID);
                if (member != null)
                {
                    this.MemberName = member.Name;
                }
            }
            this.LogisticsID = sn.LogisticsID;
            if (this.LogisticsID > 0)
            {
                Magic.Basis.Logistics logis = Magic.Basis.Logistics.Retrieve(session, this.LogisticsID);
                this.LogisticsName = logis.ShortName;
            }
            this.LocationCode   = locationCode;
            this.IsMalicious    = isMalicious;
            this.HasTransported = hasTransported;
            this.Note           = note;
            this.ReasonID       = reasonId;
            if (reasonId > 0)
            {
                Magic.Basis.ReturnReason reason = Magic.Basis.ReturnReason.Retrieve(session, reasonId);
                if (reason != null)
                {
                    this.ReasonText = reason.ReasonText;
                }
            }

            this.OrderTypeCode = ORDER_TYPE_LOGISTICS_RTN;
            this.CreateUser    = createUser;
            this.IsAutoMatch   = true;
        }