Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int orderid = 0;

        if (!IsPostBack)
        {
            try
            {
                // 1.取得参数
                if (Request.Form["hidOid"] == "")
                {
                    orderid = 0;
                }
                else
                {
                    orderid = Common.DesDecrypt(Request.Form["hidOid"], Common.EncryptKey).ToInt(0);
                    KeyID   = orderid;
                }
                if (!Common.PageDisOperable("Order", orderid, this.DisID))
                {
                    Response.Redirect("../../NoOperable.aspx", true);
                    return;
                }

                decimal txtPayOrder = Convert.ToDecimal(Request.Form["hidPayOrder"]); //本次支付总金额
                decimal price       = Convert.ToDecimal(Request.Form["hidPrice"]);    //使用企业钱包金额
                int     yfk         = Convert.ToInt32(Request.Form["hidIsPre"]);      //是否使用企业钱包  1:是  0:否
                int     isDBPay     = Convert.ToInt32(Request.Form["hidIsDBPay"]);    //是否是担保支付  1:是  0:否
                string  bankid      = Convert.ToString(Request.Form["hidBankNo"]);    //银行编号
                string  AccountType = Request.Form["hidAccountType"];                 //账户类型
                string  payPas      = Convert.ToString(Request.Form["hidPayPas"]);    //预付款密码

                Hi.Model.BD_Distributor disModel = new Hi.BLL.BD_Distributor().GetModel(this.DisID);

                Hi.Model.DIS_Order disOrderMOdel = new Hi.BLL.DIS_Order().GetModel(orderid);

                if (disModel == null)
                {
                    err = true;
                    ErrMessage("数据异常");
                    return;
                }

                decimal sumPrice = new Hi.BLL.PAY_PrePayment().sums(disModel.ID, disOrderMOdel.CompID); //剩余企业钱包
                int     disid    = this.DisID;                                                          //代理商ID
                string  password = disModel.Paypwd;

                if (yfk == 1)
                {
                    if (payPas == null || payPas.Trim().ToString() == "")
                    {
                        err = true;
                        ErrMessage("企业钱包密码不能为空");
                        return;
                    }
                    payPas = payPas.Trim().ToString();
                    if (password == Util.md5("123456"))
                    {
                        err = true;
                        ErrMessage("请先修改企业钱包支付密码");
                        return;
                    }
                    else
                    {
                        if (payPas == "")
                        {
                            //string Josn = "{\"error\":\"1\",\"msg\":\"密码不能为空!\"}";
                            err = true;
                            ErrMessage("密码不能为空");

                            return;
                        }
                    }
                }

                decimal payPrice = 0;
                if (txtPayOrder == 0)
                {
                    err = true;
                    ErrMessage("支付金额不能为0");

                    return;
                }
                if (yfk == 1 && txtPayOrder < price)
                {
                    err = true;
                    ErrMessage("使用企业钱包大于支付金额!");
                    return;
                }
                if (yfk == 1)
                {
                    payPrice = txtPayOrder - price;
                }
                else
                {
                    payPrice = txtPayOrder;
                }
                if (orderid <= 0)
                {
                    //string Josn = "{\"error\":\"1\",\"msg\":\"操作有误!\"}";
                    err = true;
                    ErrMessage("数据有误");

                    return;
                }
                Hi.Model.DIS_Order orderModel = new Hi.BLL.DIS_Order().GetModel(orderid);
                if (orderModel == null)
                {
                    err = true;
                    ErrMessage("数据有误");

                    return;
                }
                if (txtPayOrder > orderModel.AuditAmount + orderModel.OtherAmount - orderModel.PayedAmount)
                {
                    err = true;
                    ErrMessage("支付金额大于未支付金额,不能支付!");
                    return;
                }
                if (!((
                          (orderModel.Otype == (int)Enums.OType.赊销订单 && (orderModel.OState != (int)Enums.OrderState.退回 && orderModel.OState != (int)Enums.OrderState.未提交 && orderModel.OState != (int)Enums.OrderState.待审核) && (orderModel.PayState == (int)Enums.PayState.未支付 || orderModel.PayState == (int)Enums.PayState.部分支付)) ||
                          (orderModel.Otype != (int)Enums.OType.赊销订单 && orderModel.Otype != (int)Enums.OType.推送账单 && (orderModel.OState == (int)Enums.OrderState.已审 || orderModel.OState == (int)Enums.OrderState.已发货 || orderModel.OState == (int)Enums.OrderState.已到货) && (orderModel.PayState == (int)Enums.PayState.未支付 || orderModel.PayState == (int)Enums.PayState.部分支付)) ||
                          (orderModel.Otype == (int)Enums.OType.推送账单 && orderModel.OState == (int)Enums.OrderState.已审 && (orderModel.PayState == (int)Enums.PayState.部分支付 || orderModel.PayState == (int)Enums.PayState.未支付))
                          ) &&
                      orderModel.OState != (int)Enums.OrderState.已作废))
                {
                    if (orderModel.Otype == (int)Enums.OType.推送账单)
                    {
                        err = true;
                        ErrMessage("账单异常,不能支付");
                    }
                    else
                    {
                        err = true;
                        ErrMessage("订单异常,不能支付");
                    }
                    return;
                }

                int prepayid = 0;

                if (yfk == 1 && price > 0)
                {
                    //企业钱包处理
                    if (sumPrice < price)
                    {
                        err = true;
                        ErrMessage("企业钱包余额不足");

                        return;
                    }
                    if (disModel.Paypwd != Util.md5(payPas))
                    {
                        err = true;
                        ErrMessage("支付密码不正确");

                        return;
                    }
                    Hi.Model.PAY_PrePayment prepayModel = new Hi.Model.PAY_PrePayment();
                    prepayModel.CompID     = disOrderMOdel.CompID;
                    prepayModel.DisID      = disModel.ID;
                    prepayModel.OrderID    = orderid;
                    prepayModel.Start      = 2;
                    prepayModel.PreType    = 5;
                    prepayModel.price      = price * -1;
                    prepayModel.Paytime    = DateTime.Now;
                    prepayModel.CreatDate  = DateTime.Now;
                    prepayModel.CrateUser  = this.UserID;
                    prepayModel.AuditState = 2;
                    prepayModel.IsEnabled  = 1;
                    prepayModel.ts         = DateTime.Now;
                    prepayModel.modifyuser = this.UserID;
                    prepayModel.guid       = Common.Number_repeat(Guid.NewGuid().ToString().Replace("-", ""));
                    // prepayModel.vdef1 = "订单支付";
                    prepayid = new Hi.BLL.PAY_PrePayment().Add(prepayModel);
                    int prepay = 0;
                    int order  = 0;
                    if (prepayid > 0 && payPrice == 0)//payPrice(网银支付金额)= 0 ,只用企业钱包支付,修改状态
                    {
                        SqlConnection con = new SqlConnection(LocalSqlServer);
                        con.Open();
                        SqlTransaction sqlTrans = con.BeginTransaction();
                        try
                        {
                            prepay = new Hi.BLL.PAY_PrePayment().updatePrepayState(con, prepayid, sqlTrans);  //修改企业钱包状态
                            order  = new Hi.BLL.DIS_Order().UpdateOrderPstate(con, orderid, price, sqlTrans); //修改订单状态
                            if (prepay > 0 && order > 0)
                            {
                                sqlTrans.Commit();
                            }
                            else
                            {
                                sqlTrans.Rollback();
                            }
                        }
                        catch
                        {
                            prepay = 0;
                            order  = 0;
                            sqlTrans.Rollback();
                        }
                        finally
                        {
                            con.Close();
                        }
                        if (prepay > 0 && order > 0)
                        {
                            try
                            {
                                if (orderModel.Otype == (int)Enums.OType.推送账单)
                                {
                                    Utils.AddSysBusinessLog(disOrderMOdel.CompID, "Order", orderid.ToString(), "账单支付", "支付:" + price.ToString("0.00") + "元(企业钱包支付)", this.UserID.ToString());
                                }
                                else
                                {
                                    Utils.AddSysBusinessLog(disOrderMOdel.CompID, "Order", orderid.ToString(), "订单支付", "支付:" + price + "元(企业钱包支付)", this.UserID.ToString());
                                }
                                if (orderModel.Otype != 9)
                                {
                                    OrderInfoType.AddIntegral(disOrderMOdel.CompID, disOrderMOdel.DisID, "1", 1, orderid, price, "订单支付", "", this.UserID);
                                }
                                new Common().GetWxService("2", orderid.ToString(), "1", price);
                            }
                            catch (Exception ex) { throw ex; }

                            if (orderModel.Otype == (int)Enums.OType.推送账单)
                            {
                                err = true;//阻止进入网银支付
                                Response.Redirect("PaySuccess.aspx?type=" + Common.DesEncrypt("2", Common.EncryptKey) + "&KeyID=" + Common.DesEncrypt(orderid.ToString(), Common.EncryptKey) + "&Pid=" + Common.DesEncrypt("0".ToString(), Common.EncryptKey) + "&PPid=" + Common.DesEncrypt(prepayid.ToString(), Common.EncryptKey) + "&IsRef=Y", false);
                            }
                            else
                            {
                                err = true;//阻止进入网银支付
                                Response.Redirect("PaySuccess.aspx?type=" + Common.DesEncrypt("1", Common.EncryptKey) + "&KeyID=" + Common.DesEncrypt(orderid.ToString(), Common.EncryptKey) + "&Pid=" + Common.DesEncrypt("0".ToString(), Common.EncryptKey) + "&PPid=" + Common.DesEncrypt(prepayid.ToString(), Common.EncryptKey) + "&IsRef=Y", false);
                            }
                            return;
                        }
                        else
                        {
                            err = true;
                            ErrMessage("支付失败");
                            return;
                        }
                    }
                }

                if (payPrice <= 0)
                {
                    err = true;
                    ErrMessage("数据有误");
                    return;
                }


                #region     计算支付手续费 start
                string  sxfsq    = "-1";
                decimal sxf      = 0;
                decimal comp_sxf = 0;//收费方是厂商是,为了不改变支付金额,故声明此变量来记录,厂商手续费。
                // 获取手续费 begin
                string[] Json = Common.GetSxf(disOrderMOdel.CompID, AccountType, bankid, payPrice);

                string strMsg = Json[2].ToString();
                if (!string.IsNullOrEmpty(strMsg))
                {
                    ErrMessage(strMsg);
                    return;
                }
                else
                {
                    sxfsq    = Json[1].ToString();
                    sxf      = Convert.ToDecimal(Json[0]);
                    comp_sxf = Convert.ToDecimal(Json[3]);
                }
                // 获取手续费 end


                //支付总金额(含手续费)
                decimal UNIT = 0.01M;
                payPrice = payPrice + Common.Round(sxf, UNIT);

                #endregion  计算支付手续费 end


                int payid = 0;
                int regid = 0;
                Hi.Model.PAY_Payment payModel = new Hi.Model.PAY_Payment();
                string orderNo = WebConfigurationManager.AppSettings["OrgCode"] + DateTime.Now.ToString("yyyyMMdd");//支付订单号前半部分

                string guid = Guid.NewGuid().ToString().Replace("-", "");
                payModel.OrderID      = orderid;
                payModel.DisID        = this.DisID;
                payModel.Type         = isDBPay;
                payModel.PayUser      = disModel.DisName;
                payModel.PayPrice     = payPrice;
                payModel.IsAudit      = 2;
                payModel.guid         = Common.Number_repeat(guid);
                payModel.vdef3        = "1";
                payModel.vdef4        = orderNo;
                payModel.CreateDate   = DateTime.Now;
                payModel.CreateUserID = this.UserID;
                payModel.ts           = DateTime.Now;
                payModel.modifyuser   = this.UserID;
                //判断账户类型,判断支付渠道,然后赋值
                if (AccountType == "11")
                {
                    if (bankid == "888")
                    {
                        payModel.Channel = "2";
                    }
                    else
                    {
                        payModel.Channel = "3";
                    }
                }//信用卡支付
                else if (AccountType == "13")
                {
                    payModel.Channel = "8";
                }
                else//网银支付
                {
                    payModel.Channel = "4";
                }

                payModel.State = Convert.ToInt32(sxfsq);//手续费收取方

                if (sxfsq.Equals("2"))
                {
                    payModel.vdef5 = comp_sxf.ToString("0.00");
                }
                else
                {
                    payModel.vdef5 = sxf.ToString("0.00");//支付手续费
                }
                payid = new Hi.BLL.PAY_Payment().Add(payModel);
                if (prepayid > 0)
                {
                    Hi.Model.PAY_PrePayment prepayMent = new Hi.BLL.PAY_PrePayment().GetModel(prepayid);
                    prepayMent.vdef4 = payid.ToString();//与企业钱包关联
                    new Hi.BLL.PAY_PrePayment().Update(prepayMent);
                }

                Hi.Model.PAY_RegisterLog regModel = new Hi.Model.PAY_RegisterLog();
                regModel.OrderId    = orderid;
                regModel.Ordercode  = orderNo;// orderNo + payid.ToString();
                regModel.number     = payModel.guid;
                regModel.Price      = payPrice;
                regModel.Payuse     = "订单支付";
                regModel.PayName    = disModel.DisName;
                regModel.DisID      = disid;
                regModel.PayTime    = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                regModel.Remark     = orderModel.Remark;
                regModel.DisName    = new Hi.BLL.BD_Company().GetModel(disOrderMOdel.CompID).CompName;
                regModel.BankID     = bankid;
                regModel.CreateUser = this.UserID;
                regModel.CreateDate = DateTime.Now;
                regModel.LogType    = 1311;
                regid = new Hi.BLL.PAY_RegisterLog().Add(regModel);
                if (payid <= 0 || regid <= 0)
                {
                    err = true;
                    ErrMessage("数据有误");
                    return;
                }
                string configPath = WebConfigurationManager.AppSettings["payment.config.path"];
                try
                {
                    PaymentEnvironment.Initialize(configPath);
                }
                catch (Exception ex)
                {
                    //string Josn = "{\"error\":\"1\",\"msg\":\"支付配置有误,请联系系统管理员!\"}";
                    err = true;
                    ErrMessage("支付配置有误,请联系系统管理员");

                    return;
                }

                String institutionID = WebConfigurationManager.AppSettings["PayOrgCode"]; //机构代码

                long   amount          = Convert.ToInt64(payPrice * 100);                 //支付金额(单位:分)
                long   fee             = 0;
                String usage           = "支付订单";
                String remark          = "订单支付";
                String notificationURL = "";
                //"http://www.my1818.com/Handler/ReceiveNoticePage.ashx";//Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port +

                if (WebConfigurationManager.AppSettings["PayType"] == "0")
                {
                    notificationURL = Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port + "/Handler/ReceiveNoticePage.ashx";
                }
                // notificationURL = "https://www.yibanmed.com/Handler/ReceiveNoticePage.ashx";
                else
                {
                    notificationURL = "https://www.yibanmed.com/Handler/ReceiveNoticePage.ashx";//回调页面地址
                }
                String payees = new Hi.BLL.BD_Company().GetModel(disOrderMOdel.CompID).CompName;

                //判断支付接口
                string Pay_type = WebConfigurationManager.AppSettings["PayType"];
                String bankID   = string.Empty;
                if (Pay_type == "0") //测试接口
                {
                    bankID = "700";  //bankid;//
                }
                else
                {
                    bankID = bankid;//正式接口
                }
                int accountType = Convert.ToInt32(AccountType);

                // 2.创建交易请求对象
                Tx1311Request tx1311Request = new Tx1311Request();
                tx1311Request.setInstitutionID(institutionID);     //机构号码
                tx1311Request.setOrderNo(orderNo);                 //订单号orderNo + payid.ToString()
                tx1311Request.setPaymentNo(payModel.guid);         //支付交易流水号
                tx1311Request.setAmount(amount);                   //支付金额 单位分
                tx1311Request.setFee(fee);                         //支付服务手续费 单位分
                tx1311Request.setPayerID("");                      //付款人注册ID
                tx1311Request.setPayerName("");                    //付款方名称
                tx1311Request.setUsage(usage);                     //资金用途
                tx1311Request.setRemark(remark);                   //备注
                tx1311Request.setNotificationURL(notificationURL); //机构接收支付通知的URL
                tx1311Request.addPayee("");                        //收款方名称

                if (accountType == 13)
                {
                    tx1311Request.setAccountType(11); //付款方帐号类型
                    tx1311Request.setCardType("02");  //银行卡类型(01=借记卡、02=贷记卡)
                }
                else if (accountType == 11)
                {
                    tx1311Request.setAccountType(accountType); //付款方帐号类型
                    tx1311Request.setCardType("01");           //银行卡类型(01=借记卡、02=贷记卡)
                }
                else if (accountType == 12)
                {
                    tx1311Request.setAccountType(accountType); //付款方帐号类型
                }
                tx1311Request.setBankID(bankID);               //付款银行标识


                // 3.执行报文处理
                tx1311Request.process();
                try
                {
                    Hi.Model.PAY_RegisterLog regM = new Hi.BLL.PAY_RegisterLog().GetModel(regid);
                    regM.PlanMessage = tx1311Request.getRequestPlainText();
                    new Hi.BLL.PAY_RegisterLog().Update(regM);
                }
                catch (Exception ex) { throw ex; }

                //跳转的url地址
                HttpContext.Current.Items["action"] = PaymentEnvironment.PaymentURL;
                //中金返回信息
                HttpContext.Current.Items["message"] = tx1311Request.getRequestMessage();
                //中金签名信息
                HttpContext.Current.Items["signature"] = tx1311Request.getRequestSignature();
            }
            catch (Exception ex)
            {
                err = true;
                ErrMessage(ex.Message);
                return;
            }
            finally
            {
                if (!err)
                {
                    Context.Server.Transfer("DoSubmit.aspx", false);
                }
            }
        }
    }
Ejemplo n.º 2
0
    public void Bind()
    {
        orderModel = new Hi.BLL.DIS_Order().GetModel(KeyID);
        // 订单检查
        if (orderModel == null)
        {
            //if (orderModel.Otype == (int)Enums.OType.推送账单)
            //    JScript.AlertMethod(this, "无效的账单!", JScript.IconOption.错误, "function (){ location.replace('" + ("orderDzfzdList.aspx") + "'); }");
            //else
            JScript.AlertMethod(this, "无效的订单!", JScript.IconOption.错误, "function (){ location.replace('" + ("orderPayList.aspx") + "'); }");
            //this.lblPayError.InnerText = "无效的订单!";
            return;
        }

        // 状态检查
        if (!(
                (
                    (orderModel.Otype == (int)Enums.OType.销售订单 && (orderModel.OState == (int)Enums.OrderState.已审 || orderModel.OState == (int)Enums.OrderState.已发货 || orderModel.OState == (int)Enums.OrderState.已到货) && (orderModel.PayState == (int)Enums.PayState.未支付 || orderModel.PayState == (int)Enums.PayState.部分支付))
                    ||
                    (orderModel.Otype == (int)Enums.OType.推送账单 && orderModel.OState == (int)Enums.OrderState.已审 && (orderModel.PayState == (int)Enums.PayState.部分支付 || orderModel.PayState == (int)Enums.PayState.未支付))
                ) &&
                orderModel.OState != (int)Enums.OrderState.已作废))
        {
            if (orderModel.Otype == (int)Enums.OType.推送账单)
            {
                JScript.AlertMethod(this, "账单异常,不能支付!", JScript.IconOption.错误, "function (){ location.replace('" + ("orderDzfzdList.aspx") + "'); }");
            }
            else
            {
                JScript.AlertMethod(this, "订单异常,不能支付!", JScript.IconOption.错误, "function (){ location.replace('" + ("orderPayList.aspx") + "'); }");
            }
            return;
        }

        // 审核状态
        if (orderModel.OState < 2)
        {
            JScript.AlertMethod(this, "该订单未审核,不能支付!", JScript.IconOption.错误, "function (){ location.replace('" + ("../neworder/orderdetail.aspx?KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey)) + "'); }");
            return;
        }

        // 支付状态检查
        if (orderModel.PayState != (int)Enums.PayState.未支付 && orderModel.PayState != (int)Enums.PayState.部分支付)
        {
            Response.Redirect("Error.aspx?type=" + Common.DesEncrypt("1", Common.EncryptKey) + "&KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey));
            return;
        }

        // 开销户
        List <Hi.Model.PAY_OpenAccount> LOpen = new Hi.BLL.PAY_OpenAccount().GetList("", "DisID=" + this.DisID + " and State=1 and isnull(dr,0)=0", "");
        // 提现户
        List <Hi.Model.PAY_Withdrawals> Lwith = new Hi.BLL.PAY_Withdrawals().GetList("", "DisID=" + this.DisID + " and state=1 and isnull(dr,0)=0", "");

        if (LOpen.Count > 0 && Lwith.Count > 0)
        {
            String msghd_rspcode    = "";
            String msghd_rspmsg     = "";
            String amt_balamt       = "";
            String msghd_rspcode1   = "";
            String msghd_rspmsg1    = "";
            String credit_nousedamt = "";
            String Json             = "";
            String Json1            = "";
            try
            {
                IPubnetwk ipu = new IPubnetwk();
                Json  = ipu.trd13010("{\"msghd_trdt\":\"" + DateTime.Now.ToString("yyyyMMdd") + "\",\"srl_ptnsrl\":\"" + Common.Number_repeat("") + "\",\"cltacc_cltno\":\"" + LOpen[0].AccNumver + "\",\"cltacc_cltnm\":\"" + LOpen[0].AccName + "\",\"bkacc_accno\":\"" + Lwith[0].AccNm + "\",\"bkacc_accnm\":\"" + LOpen[0].AccName + "\"}");
                Json1 = ipu.trd70000("{\"msghd_trdt\":\"" + DateTime.Now.ToString("yyyyMMdd") + "\",\"srl_ptnsrl\":\"" + Common.Number_repeat("") + "\",\"cltacc_cltno\":\"" + LOpen[0].AccNumver + "\",\"cltacc_cltnm\":\"" + LOpen[0].AccName + "\"}");
            }
            catch { }
            try
            {
                JsonData Params = JsonMapper.ToObject(Json);
                msghd_rspcode = Params["msghd_rspcode"].ToString();
                msghd_rspmsg  = Params["msghd_rspmsg"].ToString();
                amt_balamt    = Params["amt_balamt"].ToString();
                this.lblBalance1.InnerHtml = (Convert.ToDecimal(amt_balamt) / 100).ToString("N2");
                JsonData Params1 = JsonMapper.ToObject(Json1);
                msghd_rspcode1             = Params1["msghd_rspcode"].ToString();
                msghd_rspmsg1              = Params1["msghd_rspmsg"].ToString();
                credit_nousedamt           = Params1["credit_nousedamt"].ToString();
                this.lblBalance3.InnerHtml = (Convert.ToDecimal(credit_nousedamt) / 100).ToString("N2");
            }
            catch { }
        }

        // 在线融资记录
        PList = new Hi.BLL.PAY_Financing().GetList("", "DisID=" + this.DisID + " and OrderID=" + KeyID + " and State=3 and isnull(dr,0)=0", "");
        if (PList.Count > 0)
        {
            this.lblBalance5.InnerHtml = PList[0].AclAmt.ToString("0.00");
        }

        decimal payPrice = orderModel.AuditAmount + orderModel.OtherAmount - orderModel.PayedAmount;

        this.lblOrderNO.InnerText = orderModel.ReceiptNo.Trim().ToString();
        //账单支付链接
        if (orderModel.Otype == 9)  // 推送账单
        {
            this.lblOrderNO.HRef = "../OrderZDInfo.aspx?KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey);
        }
        else
        {
            this.lblOrderNO.HRef = "../neworder/orderdetail.aspx?KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey);
        }

        this.hidOrderid.Value      = KeyID.ToString();
        this.lblPricePay.InnerText = payPrice.ToString("0.00");
        this.hidPricePay.Value     = payPrice.ToString("0.00");
        this.lblPriceO.InnerText   = (orderModel.AuditAmount + orderModel.OtherAmount).ToString("0.00");
        if (this.txtPayOrder.Value == "")
        {
            this.txtPayOrder.Value = payPrice.ToString("0.00");
        }
        else
        {
            this.txtPayOrder.Value = Convert.ToDecimal(this.txtPayOrder.Value).ToString("0.00");
        }

        this.hidUserName.Value = this.UserName;

        decimal sumPrice = new Hi.BLL.PAY_PrePayment().sums(orderModel.DisID, orderModel.CompID);

        this.lblSumPrice.InnerText = sumPrice.ToString("0.00");
        this.hidSumPrice.Value     = sumPrice.ToString("0.00");

        string strWhere = " 1=1 ";

        if (this.DisID != 0)
        {
            strWhere += " and DisID = " + this.DisID;
        }
        strWhere += " and Start = 1 and vdef6 = 0 and isnull(dr,0)=0";
        List <Hi.Model.PAY_FastPayMent> fastList = new Hi.BLL.PAY_FastPayMent().GetList("", strWhere, "");

        this.rptQpay.DataSource = fastList;
        this.rptQpay.DataBind();
        List <Hi.Model.PAY_BankInfo> BankL = new Hi.BLL.PAY_BankInfo().GetList("", " vdef1=0", "");

        this.rptOtherBank.DataSource = BankL;
        this.rptOtherBank.DataBind();
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        //定义冲正的变量
        string txtPayCorrectDis   = string.Empty;
        string txtPayCorrectPrice = string.Empty;
        //string txtPayCorrectDate = string.Empty;
        string txtPayCorrectType   = string.Empty;
        string txtPayCorrectRemark = string.Empty;

        //获取冲正输入的数据
        txtPayCorrectPrice = Common.NoHTML(this.txtPayCorrectPrice.Value.Trim());
        if (Convert.ToDecimal(txtPayCorrectPrice) <= 0)
        {
            JScript.AlertMethod(this, "操作失败,冲正金额不能小于或等于零!", JScript.IconOption.错误, "function (){ location.replace(); }");//'" + ("PayCreateAdd.aspx?UID="+Uid) + "'
            return;
        }
        txtPayCorrectDis    = Common.NoHTML(this.hidDisUserID.Value);     // this.DisListID.Disid;//获取代理商ID
        txtPayCorrectRemark = Common.NoHTML(this.txtRemark.Value.Trim()); //获取备注
        int compid = CompID;
        int disID  = 0;

        if (this.CompUser.DisID != 0)
        {
            disID = this.CompUser.DisID;
        }
        //判断冲正金额是否大于企业钱包金额
        decimal nowprePrice = new Hi.BLL.PAY_PrePayment().sums(Convert.ToInt32(txtPayCorrectDis), compid);
        decimal czprice     = Convert.ToDecimal(txtPayCorrectPrice);

        if (czprice > nowprePrice)
        {
            JScript.AlertMethod(this, "操作失败,冲正金额" + czprice + " 大于企业钱包余额" + nowprePrice.ToString("0.00"), JScript.IconOption.错误, "function (){ location.replace('" + ("PayCorrectAdd.aspx?UID=" + Common.DesEncrypt(txtPayCorrectDis.ToString(), Common.EncryptKey)) + "'); }");
            return;
        }


        //调用model,对属性进行赋值
        Hi.Model.PAY_PrePayment prepaymentmodel = new Hi.Model.PAY_PrePayment();
        prepaymentmodel.CompID     = compid;
        prepaymentmodel.PreType    = 3;
        prepaymentmodel.DisID      = Convert.ToInt32(txtPayCorrectDis);
        prepaymentmodel.Start      = 1;
        prepaymentmodel.price      = -Convert.ToDecimal(txtPayCorrectPrice);
        prepaymentmodel.Paytime    = DateTime.Now;
        prepaymentmodel.CreatDate  = DateTime.Now;
        prepaymentmodel.CrateUser  = this.UserID;
        prepaymentmodel.AuditState = 2;//2已审,0 未审
        prepaymentmodel.IsEnabled  = 1;
        prepaymentmodel.ts         = DateTime.Now;
        prepaymentmodel.dr         = 0;
        prepaymentmodel.modifyuser = this.UserID;
        prepaymentmodel.vdef1      = txtPayCorrectRemark;
        //调用保存方法
        Hi.BLL.PAY_PrePayment prepaymentsave = new Hi.BLL.PAY_PrePayment();
        int reslut = prepaymentsave.Add(prepaymentmodel);

        //判断返回值int
        if (reslut > 0)
        {
            Utils.AddSysBusinessLog(this.CompID, "PrePayment", reslut.ToString(), "企业钱包冲正新增", "");
            // JScript.AlertMsg(this, "操作成功", "PayCorrectInfo.aspx?KeyID=" + reslut);
            Response.Redirect("PayCorrectInfo.aspx?KeyID=" + Common.DesEncrypt(reslut.ToString(), Common.EncryptKey));
        }
        else
        {
            JScript.AlertMethod(this, "操作失败!", JScript.IconOption.哭脸, "function (){ location.replace('" + ("PayCorrectList.aspx") + "'); }");
        }
    }