protected void btnSave_Click(object sender, EventArgs e)
        {
            int    ddlNick         = Convert.ToInt32(ddlNickId.SelectedValue);
            int    ddlPlatformType = Convert.ToInt32(ddlPlatformTypeId.SelectedValue);
            string AppKeyname      = AppKey.Text;
            string AppSecretname   = AppSecret.Text;
            string CallbackUrlname = CallbackUrl.Text;
            string AccessTokenname = AccessToken.Text;
            string ServerUrlname   = ServerUrl.Text;

            if (AppKeyname.ToString() == "" || AppSecretname.ToString() == "" || AccessTokenname.ToString() == "" || ServerUrlname.ToString() == "")
            {
                base.ShowMessage("AppKey、AppSecret、AccessToken,ServerUrl不能为空!");
                return;
            }
            else
            {
                if (XMOrderInfoAppId == -1)//添加
                {
                    XMOrderInfoApp orderinfoapp = new XMOrderInfoApp();
                    orderinfoapp.NickId         = ddlNick;
                    orderinfoapp.PlatformTypeId = ddlPlatformType;
                    orderinfoapp.AppKey         = AppKeyname;
                    orderinfoapp.AppSecret      = AppSecretname;
                    orderinfoapp.CallbackUrl    = CallbackUrlname;
                    orderinfoapp.AccessToken    = AccessTokenname;
                    orderinfoapp.ServerUrl      = ServerUrlname;
                    orderinfoapp.IsEnabled      = false;
                    orderinfoapp.CreateId       = HozestERPContext.Current.User.CustomerID;
                    orderinfoapp.CreateDate     = DateTime.Now;
                    orderinfoapp.ModifyId       = HozestERPContext.Current.User.CustomerID;
                    orderinfoapp.ModifyDate     = DateTime.Now;
                    base.XMOrderInfoAppService.InsertXMOrderInfoApp(orderinfoapp);
                    //this.Master.JsWrite("alert('保存成功!')", "");
                    base.ShowMessage("保存成功!");
                }
                else  //编辑
                {
                    XMOrderInfoApp orderinfoapp = base.XMOrderInfoAppService.GetXMOrderInfoAppByID(XMOrderInfoAppId);
                    if (orderinfoapp != null)//判断有没有这条数据
                    {
                        orderinfoapp.NickId         = ddlNick;
                        orderinfoapp.PlatformTypeId = ddlPlatformType;
                        orderinfoapp.AppKey         = AppKeyname;
                        orderinfoapp.AppSecret      = AppSecretname;
                        orderinfoapp.CallbackUrl    = CallbackUrlname;
                        orderinfoapp.AccessToken    = AccessTokenname;
                        orderinfoapp.ServerUrl      = ServerUrlname;
                        orderinfoapp.IsEnabled      = false;
                        orderinfoapp.ModifyId       = HozestERPContext.Current.User.CustomerID;
                        orderinfoapp.ModifyDate     = DateTime.Now;
                        base.XMOrderInfoAppService.UpdateXMOrderInfoApp(orderinfoapp);
                        base.ShowMessage("保存成功!");
                    }
                }
            }
        }
        /// <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("请填写姓名和收款帐号");
            }
        }
Example #3
0
 public void WebPageJDOrderData(List <OrderInfo> orderlst, XMOrderInfoApp xMorderInfoApp)
 {
     //IoC.Resolve<IXMOrderInfoAPIService>().PageJDOrderData(orderlst, xMorderInfoApp);
 }