Пример #1
0
        protected void lbtnSave_Click(object sender, EventArgs e)
        {
            ShowShop.Model.Admin.AdminInfo adminInfo = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get();
            if (Convert.ToDecimal(this.txtRefundmentMoney.Text.Trim()) + Convert.ToDecimal(this.txtPoundAge.Text.Trim()) > Convert.ToDecimal(GetPayed(this.lblOrderId.Text)))
            {
                this.ltlMsg.Text = "退款的金额不能大于已付的金额!";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionErr";
                return;
            }
            //银行支付
            ShowShop.BLL.Order.RemittanceInfo remBll = new ShowShop.BLL.Order.RemittanceInfo();
            ShowShop.Model.Order.RemittanceInfo remModel = remBll.GetModelByOrderId(this.lblOrderId.Text);
            //现金支付
            ShowShop.BLL.Order.PaymentMoney payBll = new ShowShop.BLL.Order.PaymentMoney();
            ShowShop.Model.Order.PaymentMoney payModel = payBll.GetModelByOrderId(this.lblOrderId.Text);
            //预付款
            ShowShop.BLL.Order.PrepayMoney preBll = new ShowShop.BLL.Order.PrepayMoney();
            ShowShop.Model.Order.PrepayMoney preModel = preBll.GetModelByOrderId(this.lblOrderId.Text);
            //订单信息
            ShowShop.BLL.Order.Orders orderBll = new ShowShop.BLL.Order.Orders();
            ShowShop.Model.Order.Orders orderModel = orderBll.GetModel(this.lblOrderId.Text);

            #region 退款信息
            ShowShop.BLL.Order.RefundMent refBll = new ShowShop.BLL.Order.RefundMent();
            ShowShop.Model.Order.RefundMent refModel = new ShowShop.Model.Order.RefundMent();
            refModel.OrderId = this.lblOrderId.Text;
            refModel.UserName = this.lblUserId.Text;
            refModel.PaymentDate = Convert.ToDateTime(this.txtPaymentDate.Text);
            refModel.PoundAge = Convert.ToDecimal(this.txtPoundAge.Text.Trim());
            refModel.RefundMentMoney = Convert.ToDecimal(this.txtRefundmentMoney.Text.Trim());
            refModel.RefundMentMode = this.rabRefundmentMode.SelectedItem.Text;
            refModel.Remark = this.txtRemark.Text;
            refModel.InformMode = GetInforMode(cbxInformMode)["txt"]; //通知方式
            refModel.NoteDate = DateTime.Now;
            refModel.NoteName = adminInfo.AdminName;
            #endregion

            #region 用户交易明细
            ShowShop.Model.Member.UserinAndExp userModel = new ShowShop.Model.Member.UserinAndExp();
            ShowShop.BLL.Member.UserinAndExp userBll = new ShowShop.BLL.Member.UserinAndExp();

            //银行资金的明细
            userModel.UID = this.GetUidByUserId(this.lblUserId.Text);
            userModel.AdsumMoneyDate = Convert.ToDateTime(this.txtPaymentDate.Text);
            userModel.AdsumMoney = Convert.ToDecimal(this.txtRefundmentMoney.Text);
            userModel.PresentCoupons = 0;
            userModel.RemitMode = 1;
            userModel.RemitBank = string.Empty;
            userModel.Remark = this.txtRemark.Text;
            userModel.FormMode = GetInforMode(cbxInformMode)["txt"]; //通知方式
            userModel.BosomNote = this.txtBosomNote.Text;
            userModel.NoteDate = DateTime.Now;
            userModel.NoteName = adminInfo.AdminName;
            userModel.InComeandExpState = 0;
            userModel.State = 0;
            userModel.UserId = this.lblUserId.Text;
            #endregion

            try
            {
                if (refModel.RefundMentMoney == orderModel.FactPrice)//如果退款和订单价 匹配
                {
                    remBll.Delete(remModel.ID.ToString());
                    payBll.Delete(payModel.ID.ToString());
                    preBll.Delete(preModel.ID.ToString());
                }
                else
                {
                    if (remModel.RemittanceMoney > 0) //银行汇款
                    {
                        if (remModel.RemittanceMoney <= refModel.RefundMentMoney)
                        {
                            remBll.Delete(remModel.ID.ToString());
                        }
                        else
                        {
                            remModel.RemittanceMoney = remModel.RemittanceMoney - refModel.RefundMentMoney;
                            remBll.Amend(remModel);
                        }
                    }
                    if (preModel.PayoutMoney > 0) //预付款
                    {
                        if (preModel.PayoutMoney <= refModel.RefundMentMoney)
                        {
                            preBll.Delete(preModel.ID.ToString());
                        }
                        else
                        {
                            preModel.PayoutMoney = (preModel.PayoutMoney + remModel.RemittanceMoney) - refModel.RefundMentMoney;
                            preBll.Amend(preModel);
                        }
                    }
                    if (payModel.GatheringMoney > 0) //现金支付
                    {
                        if (payModel.GatheringMoney == (refModel.RefundMentMoney - remModel.RemittanceMoney - preModel.PayoutMoney))
                        {
                            payBll.Delete(payModel.ID.ToString());
                        }
                        else
                        {
                            payModel.GatheringMoney = (remModel.RemittanceMoney + preModel.PayoutMoney + payModel.GatheringMoney) - refModel.RefundMentMoney;
                            payBll.Amend(payModel);
                        }
                    }
                }

                refBll.Add(refModel); //退款信息
                userBll.Add(userModel); //明细记录

                //已付款
                decimal payTotail = Convert.ToDecimal(this.GetPayed(this.lblOrderId.Text));
                if ((payTotail - (Convert.ToDecimal(this.txtRefundmentMoney.Text.Trim()))) < 0)
                {
                    orderModel.PaymentStatus = ShowShop.Common.OrdersStatusEnum.PaymentStatu.等待汇款.GetHashCode();
                }
                else
                {
                    orderModel.PaymentStatus = ShowShop.Common.OrdersStatusEnum.PaymentStatu.已收定金.GetHashCode();

                }
                orderModel.OrderStatus = ShowShop.Common.OrdersStatusEnum.OrderStatu.已经确认.GetHashCode();
                orderBll.Update(orderModel);
                ChangeHope.WebPage.BasePage.PageRight("已保存该信息.", "order_bank_pay.aspx?OrderId=" + orderModel.Id, "<li><a href='order_order_info.aspx?OrderId=" + orderModel.Id.ToString() + "'>返回信息页</a></li>");

            }
            catch
            {
                this.ltlMsg.Text = "操作失败!";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionErr";
            }
            finally
            {
                adminInfo = null;
                remModel = null;
                remBll = null;
                userModel = null;
                userBll = null;
                payBll = null;
                payModel = null;
                preBll = null;
                preModel = null;
                orderBll = null;
                orderModel = null;
                GC.Collect();
            }
        }
Пример #2
0
 protected void lbtnSave_Click(object sender, EventArgs e)
 {
     ShowShop.BLL.Order.Orders bll = new ShowShop.BLL.Order.Orders();
     ShowShop.Model.Order.Orders model = bll.GetModel(this.blOrderNo.Text);
     model.ConsigneeName = this.txtConsigneeName.Text;
     model.ConsigneeAddress = this.txtConsigneeAddress.Text;
     model.ConsigneeEmail = this.txtConsigneeEmail.Text;
     model.ConsigneePhone = this.txtConsigneeModile.Text;
     model.ConsigneeTel = this.txtConsigneeTel.Text;
     model.ConsigneeZip = this.txtConsigneeZip.Text;
     model.ConsigneeFax = this.txtConsigneTime.Text;
     model.ConsigneeRealName = this.txtConstructionSigns.Text;
     model.Remark = this.txtRemark.Text.Trim();
     model.Courier = Convert.ToDecimal(this.txtCarriage.Text.Trim());
     try
     {
         bll.Update(model);
         this.ltlMsg.Text = "操作成功,已保存该信息";
         this.pnlMsg.Visible = true;
         this.pnlMsg.CssClass = "actionOk";
     }
     catch
     {
         this.ltlMsg.Text = "操作失败";
         this.pnlMsg.Visible = true;
         this.pnlMsg.CssClass = "actionErr";
     }
     finally
     {
         bll = null;
         model = null;
         GC.Collect();
     }
 }
Пример #3
0
        protected void lbtnSave_Click(object sender, EventArgs e)
        {
            ShowShop.BLL.Member.MemberAccount memberBll = new ShowShop.BLL.Member.MemberAccount();
            ShowShop.BLL.Order.Orders orderBll = new ShowShop.BLL.Order.Orders();
            ShowShop.Model.Order.Orders orderModel = orderBll.GetModel(this.lblOrderId.Text);
            decimal memberCapital = 0;
            ShowShop.Model.Admin.AdminInfo adminInfo = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get();
            if (!memberBll.Exists(this.txtTransferName.Text.Trim()))
            {
                this.ltlMsg.Text = "过户失败,不存在用户:" + this.txtTransferName.Text.Trim();
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionErr";
                return;
            }

            ShowShop.BLL.Order.OrderTransfer bll = new ShowShop.BLL.Order.OrderTransfer();
            ShowShop.Model.Order.OrderTransfer model = new ShowShop.Model.Order.OrderTransfer();
            model.OrderId = this.lblOrderId.Text;
            model.UserName = this.lblUserName.Text;
            model.TransferName = this.txtTransferName.Text;
            model.PoundAge = Convert.ToDecimal(this.txtPoundAge.Text);
            model.Remark = this.txtRemark.Text;
            model.NoteDate = DateTime.Now;
            model.NoteName = adminInfo.AdminName;
            model.UpTime = DateTime.Now;

            #region 计算用户余额 是否能支付过户费
            if (this.rabPoundPay.SelectedValue == "0") //订单当前所有者 支付手续费
            {
                ShowShop.Model.Member.MemberAccount memberModel = memberBll.GetModel(this.lblUserId.Text.Trim());
                if (memberModel.Capital > Convert.ToDecimal(this.txtPoundAge.Text))
                {
                    memberCapital = Convert.ToDecimal(memberModel.Capital - Convert.ToDecimal(this.txtPoundAge.Text));
                }
                else
                {
                    this.ltlMsg.Text = "过户失败," + this.lblUserId.Text.Trim() + " 资金余额不足";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionErr";
                    return;
                }
                //更改用户资金状况
                memberBll.Amend(memberModel.UID, "Capital", memberCapital);
                model.PoundAgePayMentPerson = this.lblUserId.Text;
            }
            else  //过户对象
            {
                ShowShop.Model.Member.MemberAccount memberModel = memberBll.GetModel(this.txtTransferName.Text.Trim());
                if (memberModel.Capital > Convert.ToDecimal(this.txtPoundAge.Text))
                {
                    memberCapital = Convert.ToDecimal(memberModel.Capital - Convert.ToDecimal(this.txtPoundAge.Text));
                }
                else
                {
                    this.ltlMsg.Text = "过户失败," + this.txtTransferName.Text.Trim() + " 资金余额不足";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionErr";
                    return;
                }
                //更改用户资金状况
                memberBll.Amend(memberModel.UID, "Capital", memberCapital);
                model.PoundAgePayMentPerson = this.txtTransferName.Text;
            }

            #endregion

            try
            {
                //把原订单所属用户改为现在的用户
                orderModel.UserId = this.txtTransferName.Text.Trim();
                orderBll.Update(orderModel);
                bll.Add(model);
                this.ltlMsg.Text = "操作成功,已保存该信息";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionOk";
            }
            catch
            {
                this.ltlMsg.Text = "操作失败!";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionErr";
            }
            finally
            {
                bll = null;
                model = null;
            }
        }
        protected void lbtnSave_Click(object sender, EventArgs e)
        {
            ShowShop.Model.Order.ConsignMent model = new ShowShop.Model.Order.ConsignMent();
            ShowShop.BLL.Order.ConsignMent bll = new ShowShop.BLL.Order.ConsignMent();
            ShowShop.Model.Admin.AdminInfo adminInfo = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get();
            model.OrderId = this.lblOrderId.Text;
            model.UserName = this.lblUserName.Text;
            model.ConsignMentDate = Convert.ToDateTime(this.txtConsignMentDate.Text);
            model.ExpressCompany = string.Empty;
            model.ExpressOddNumbers = this.txtExpressOddNumbers.Text;
            model.ConsignMentPeople = this.txtConsignMentPeople.Text;
            model.Remark = this.txtRemark.Text;
            model.BosomNote = this.txtBosomNote.Text;
            model.InformMode = string.Empty;//通知方式
            model.NoteDate = DateTime.Now;
            model.NoteName = adminInfo.AdminName;
            model.Received = ShowShop.Common.OrdersStatusEnum.OgisticsStatus.配送中.GetHashCode();
            model.ConsignMentType = 1;//类型  退货

            #region 订单状态
            ShowShop.BLL.Order.Orders orderBll = new ShowShop.BLL.Order.Orders();
            ShowShop.Model.Order.Orders orderModel = orderBll.GetModel(this.lblOrderId.Text);
            #endregion

            try
            {
                bll.Add(model);

                #region 操作订单状态
                orderModel.OgisticsStatus = ShowShop.Common.OrdersStatusEnum.OgisticsStatus.配送中.GetHashCode();
                orderBll.Update(orderModel);
                #endregion

                ChangeHope.WebPage.BasePage.PageRight("已保存该信息.", "", "<li><a href='order_order_info.aspx?OrderId=" + orderModel.Id.ToString() + "'>返回信息页</a></li>");
                return;
            }
            catch
            {
                this.ltlMsg.Text = "操作失败!";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionErr";
            }
            finally
            {
                bll = null;
                model = null;
            }
        }