Пример #1
0
        public void BindGrid(bool IsCashBack, int CashBackIndex = -1, int PremiumsDetailsIndex = -1)
        {
            XMCashBackApplication    CashBack            = new XMCashBackApplication();
            XMPremiumsDetails        PremiumsDetails     = new XMPremiumsDetails();
            List <XMPremiumsDetails> PremiumsDetailsList = new List <XMPremiumsDetails>();
            var XMOrderInfo = GetOrderInfo();

            if (IsCashBack)
            {
                //返现
                List <XMCashBackApplication> CashBackList = base.XMCashBackApplicationService.GetXMCashBackApplicationListByQuestionDetailID(Id.ToString());
                if (XMOrderInfo != null)
                {
                    CashBack.OrderCode = XMOrderInfo.OrderCode;
                    CashBack.WantNo    = XMOrderInfo.WantID;
                    CashBack.BuyerName = XMOrderInfo.FullName;
                }
                if (CashBackIndex == -1)
                {
                    CashBackList.Add(CashBack);
                    this.gvCashback.EditIndex = CashBackList.Count - 1;
                }
                else
                {
                    this.gvCashback.EditIndex = CashBackIndex;
                }
                this.gvCashback.DataSource = CashBackList;
                this.gvCashback.DataBind();//绑定数据源
            }
            else
            {
                //赠品
                var Premiums = base.XMPremiumsService.GetXMPremiumsListByQuestionDetailID(Id.ToString());
                if (Premiums != null)
                {
                    var premiumsDetailsList = base.XMPremiumsDetailsService.GetXMPremiumsDetailsListByPremiumsId(Premiums.Id);
                    PremiumsDetailsList.AddRange(premiumsDetailsList);
                    if (PremiumsDetailsIndex == -1)
                    {
                        PremiumsDetailsList.Add(PremiumsDetails);
                        this.gvPremiums.EditIndex = PremiumsDetailsList.Count - 1;
                    }
                    else
                    {
                        this.gvPremiums.EditIndex = PremiumsDetailsIndex;
                    }
                }
                else
                {
                    this.gvPremiums.EditIndex = 0;
                }

                this.gvPremiums.DataSource = PremiumsDetailsList;
                this.gvPremiums.DataBind();//绑定数据源
            }
        }
Пример #2
0
        protected void gvCashback_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                #region  取控件值
                decimal      d                  = 0;
                GridView     a                  = (GridView)sender;
                TextBox      txtBuyerName       = a.Rows[e.RowIndex].FindControl("txtBuyerName") as TextBox;
                DropDownList ddlApplicationType = a.Rows[e.RowIndex].FindControl("ddlApplicationType") as DropDownList;
                TextBox      txtBuyerAlipayNo   = a.Rows[e.RowIndex].FindControl("txtBuyerAlipayNo") as TextBox;
                TextBox      txtCashBackMoney   = a.Rows[e.RowIndex].FindControl("txtCashBackMoney") as TextBox;
                //CheckBox ChkCashBackStatus = a.Rows[e.RowIndex].FindControl("ChkCashBackStatus") as CheckBox;
                //CheckBox ChkManagerStatus = a.Rows[e.RowIndex].FindControl("ChkManagerStatus") as CheckBox;
                DropDownList ddlPaymentPerson = a.Rows[e.RowIndex].FindControl("ddlPaymentPerson") as DropDownList;
                #endregion

                if (txtBuyerName.Text == "" || txtBuyerAlipayNo.Text == "")
                {
                    base.ShowMessage("数据不能为空!");
                    return;
                }
                if (ddlPaymentPerson.SelectedValue == "-1")
                {
                    base.ShowMessage("请选择赔付方!");
                    return;
                }
                if (!decimal.TryParse(txtCashBackMoney.Text, out d))
                {
                    base.ShowMessage("金额数据类型不正确!");
                    return;
                }

                var XMOrderInfo = GetOrderInfo();
                int ID          = int.Parse(a.DataKeys[e.RowIndex].Value.ToString());
                if (ID == 0)
                {
                    XMCashBackApplication XMCashBack = new XMCashBackApplication();
                    XMCashBack.OrderCode         = XMOrderInfo.OrderCode;                                                                  //订单号
                    XMCashBack.WantNo            = XMOrderInfo.WantID;                                                                     //旺旺号
                    XMCashBack.BuyerName         = txtBuyerName.Text.Trim();                                                               //姓名
                    XMCashBack.ApplicationTypeId = int.Parse(ddlApplicationType.SelectedValue);                                            //申请类型
                    XMCashBack.BuyerAlipayNo     = txtBuyerAlipayNo.Text.Trim();                                                           //收款账号
                    XMCashBack.CashBackMoney     = decimal.Parse(txtCashBackMoney.Text.Trim() == "" ? "0" : txtCashBackMoney.Text.Trim()); //金额
                    XMCashBack.PaymentPerson     = int.Parse(ddlPaymentPerson.SelectedValue);
                    XMCashBack.ManagerStatus     = Convert.ToInt32(StatusEnum.NotCheck);
                    XMCashBack.CashBackStatus    = Convert.ToInt32(StatusEnum.NotCashBack);
                    XMCashBack.QuestionDetailID  = Id.ToString();
                    XMCashBack.IsEnable          = false;
                    XMCashBack.CreatorID         = HozestERPContext.Current.User.CustomerID;
                    XMCashBack.CreateTime        = DateTime.Now;
                    XMCashBack.UpdatorID         = HozestERPContext.Current.User.CustomerID;
                    XMCashBack.UpdateTime        = DateTime.Now;
                    base.XMCashBackApplicationService.InsertXMCashBackApplication(XMCashBack);
                }
                else
                {
                    XMCashBackApplication XMCashBack = base.XMCashBackApplicationService.GetXMCashBackApplicationById(ID);
                    XMCashBack.BuyerName         = txtBuyerName.Text.Trim();                                                               //姓名
                    XMCashBack.ApplicationTypeId = int.Parse(ddlApplicationType.SelectedValue);                                            //申请类型
                    XMCashBack.BuyerAlipayNo     = txtBuyerAlipayNo.Text.Trim();                                                           //收款账号
                    XMCashBack.CashBackMoney     = decimal.Parse(txtCashBackMoney.Text.Trim() == "" ? "0" : txtCashBackMoney.Text.Trim()); //金额
                    XMCashBack.PaymentPerson     = int.Parse(ddlPaymentPerson.SelectedValue);
                    XMCashBack.UpdatorID         = HozestERPContext.Current.User.CustomerID;
                    XMCashBack.UpdateTime        = DateTime.Now;
                    base.XMCashBackApplicationService.UpdateXMCashBackApplication(XMCashBack);
                }
                base.ShowMessage("保存成功!");
                scope.Complete();
            }
            BindGrid(true);
        }
        /// <summary>
        /// 保存返现申请
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string  hfScalpingId        = this.txtScalpingCode.Value.Trim();                           //订单号
            string  wangwang            = this.wangwangdd.Value.Trim();                                //旺旺号
            string  name                = this.name.Value.Trim();                                      //姓名
            string  ddApplicationTypeId = this.ddApplicationTypeId.SelectedValue;                      //申请类型
            int     nickID              = int.Parse(ddlNick.Value);                                    //店铺
            int     projectID           = int.Parse(ddlProject.SelectedValue);                         //项目
            string  txtApplicationPayee = this.txtApplicationPayee.Value;                              //收款账号
            decimal txtTheAdvanceMoney  = decimal.Parse(this.txtTheAdvanceMoney.Text.Trim());          //金额
            string  PaymentPerson       = this.ddlPaymentPerson.SelectedValue;                         //赔付方
            var     xmorderinfo         = base.XMOrderInfoService.GetXMOrderByOrderCode(hfScalpingId); //订单号查询订单

            if (xmorderinfo != null)
            {
                if ((xmorderinfo.PlatformTypeId == 250 || xmorderinfo.PlatformTypeId == 381) && (name == "" || txtApplicationPayee == ""))
                {
                    if (name == "")
                    {
                        if (xmorderinfo != null)
                        {
                            name = xmorderinfo.FullName;
                        }
                    }
                    if (txtApplicationPayee == "")
                    {
                        var XMOrderInfoAppList = IoC.Resolve <IXMOrderInfoAppService>().GetXMOrderInfoAppList();

                        XMOrderInfoApp xMorderInfoAppTMNew = XMOrderInfoAppList.Where(q => q.PlatformTypeId == 250).FirstOrDefault();
                        if (xMorderInfoAppTMNew != null)
                        {
                            Trade trade = IoC.Resolve <IXMOrderInfoAPIService>().GetTrade(Convert.ToInt64(hfScalpingId), xMorderInfoAppTMNew);

                            if (trade != null)
                            {
                                txtApplicationPayee = trade.BuyerAlipayNo;
                            }
                        }
                    }
                }
            }
            //财务未审核
            bool FinanceIsAudit = false;
            //项目未审核
            int ManagerStatus = 3;

            if (!string.IsNullOrEmpty(hfScalpingId))
            {
                if (xmorderinfo != null)
                {
                    var XMDeductionSetUp = XMDeductionSetUpService.GetXMDeductionSetUpByProjectAndPlatformTypeId(xmorderinfo.ProjectId, 476, (int)xmorderinfo.PlatformTypeId);
                    if (XMDeductionSetUp != null)
                    {
                        //根据项目限额,平台限额,自动设置审核进度
                        if (txtTheAdvanceMoney <= XMDeductionSetUp.Deduction)
                        {
                            FinanceIsAudit = true;
                            //项目审核
                            ManagerStatus = 4;
                        }
                        else if (txtTheAdvanceMoney > XMDeductionSetUp.Deduction && txtTheAdvanceMoney <= XMDeductionSetUp.Finance)
                        {
                            FinanceIsAudit = true;
                        }
                    }
                    else
                    {
                        //通用
                        var XMDeductionSetUpUsually = XMDeductionSetUpService.GetXMDeductionSetUpByProjectAndPlatformTypeId(projectID, 476, 508);
                        if (XMDeductionSetUpUsually != null)
                        {
                            //根据项目限额,平台限额,自动设置审核进度
                            if (txtTheAdvanceMoney <= XMDeductionSetUpUsually.Deduction)
                            {
                                FinanceIsAudit = true;
                                //项目审核
                                ManagerStatus = 4;
                            }
                            else if (txtTheAdvanceMoney > XMDeductionSetUpUsually.Deduction && txtTheAdvanceMoney <= XMDeductionSetUpUsually.Finance)
                            {
                                FinanceIsAudit = true;
                            }
                        }
                    }
                }
            }

            if (name != "" && txtApplicationPayee != "")
            {
                //var a = XMOrderInfoService.GetXMOrderInfoByOrderCodeList(hfScalpingId);

                if (type == 1)
                {
                    var XMCashBackApplication        = XMCashBackApplicationService.GetXMCashBackApplicationByOrderCode(hfScalpingId, int.Parse(ddApplicationTypeId));
                    XMCashBackApplication XMCashBack = new XMCashBackApplication();
                    XMCashBack.OrderCode         = string.IsNullOrEmpty(hfScalpingId) ? "NoOrder" + DateTime.Now.ToString("yyMMddHHmmssfff") : hfScalpingId; //订单号
                    XMCashBack.WantNo            = wangwang;                                                                                                 //旺旺号
                    XMCashBack.BuyerName         = name;                                                                                                     //姓名
                    XMCashBack.ApplicationTypeId = int.Parse(ddApplicationTypeId);                                                                           //申请类型
                    XMCashBack.NickID            = nickID;
                    XMCashBack.ProjectID         = projectID;
                    XMCashBack.BuyerAlipayNo     = txtApplicationPayee; //收款账号
                    XMCashBack.CashBackMoney     = txtTheAdvanceMoney;  //金额
                    XMCashBack.CreatorID         = HozestERPContext.Current.User.CustomerID;
                    XMCashBack.CreateTime        = DateTime.Now;
                    XMCashBack.UpdatorID         = HozestERPContext.Current.User.CustomerID;
                    XMCashBack.UpdateTime        = DateTime.Now;
                    //判断是否是第二次返现
                    if (XMCashBackApplication.Count == 0)
                    {
                        XMCashBack.ManagerStatus  = ManagerStatus;
                        XMCashBack.FinanceIsAudit = FinanceIsAudit;
                    }
                    //第二次返现都视为未审核
                    else if (XMCashBackApplication.Count > 0)
                    {
                        XMCashBack.ManagerStatus  = 3;
                        XMCashBack.FinanceIsAudit = false;
                    }
                    XMCashBack.CashBackStatus = Convert.ToInt32(StatusEnum.NotCashBack);
                    XMCashBack.IsEnable       = false;

                    base.XMCashBackApplicationService.InsertXMCashBackApplication(XMCashBack);
                    base.ShowMessage("保存成功");
                    this.wangwang.Value = wangwang;
                }
                else if (type == 2)
                {
                    var XMCashBack = XMCashBackApplicationService.GetXMCashBackApplicationById(scid);
                    XMCashBack.OrderCode         = hfScalpingId;                   //订单号
                    XMCashBack.WantNo            = wangwang;                       //旺旺号
                    XMCashBack.BuyerName         = name;                           //姓名
                    XMCashBack.ApplicationTypeId = int.Parse(ddApplicationTypeId); //申请类型
                    XMCashBack.NickID            = nickID;
                    XMCashBack.ProjectID         = projectID;
                    XMCashBack.BuyerAlipayNo     = txtApplicationPayee;                           //收款账号
                    XMCashBack.CashBackMoney     = txtTheAdvanceMoney;                            //金额
                    if (XMCashBack.ApplicationTypeId == Convert.ToInt32(StatusEnum.ChildPayment)) //赔付
                    {
                        XMCashBack.PaymentPerson = int.Parse(PaymentPerson);                      //赔付方
                    }

                    XMCashBack.UpdatorID      = HozestERPContext.Current.User.CustomerID;
                    XMCashBack.UpdateTime     = DateTime.Now;
                    XMCashBack.ManagerStatus  = ManagerStatus;
                    XMCashBack.FinanceIsAudit = FinanceIsAudit;
                    //XMCashBack.CashBackStatus = Convert.ToInt32(StatusEnum.NotCashBack);
                    base.XMCashBackApplicationService.UpdateXMCashBackApplication(XMCashBack);
                    base.ShowMessage("修改成功");
                    this.wangwang.Value = wangwang;
                }
            }
            else
            {
                base.ShowMessage("请填写姓名和收款帐号");
            }
        }