Exemple #1
0
    /// <summary>
    /// 绑定事件
    /// </summary>
    public void Bind()
    {
        Hi.Model.DIS_Order orderModel = new Hi.BLL.DIS_Order().GetModel(KeyID);

        this.hidUserName.Value = this.UserName;
        string strWhere = string.Empty;

        if (this.DisID != 0)
        {
            strWhere += " DisID = '" + this.DisID + "' ";
        }
        else
        {
            JScript.AlertMsgOne(this, "操作员没有对应的代理商!", JScript.IconOption.错误, 2500);
        }
        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();
        SumNumber = fastList.ToArray().Length;
        List <Hi.Model.PAY_BankInfo> BankL = new Hi.BLL.PAY_BankInfo().GetList("", " vdef1=0", "");

        this.rptOtherBank.DataSource = BankL;
        this.rptOtherBank.DataBind();
    }
Exemple #2
0
    public void Bind()
    {
        Hi.Model.PAY_PrePayment prepayM = new Hi.BLL.PAY_PrePayment().GetModel(KeyID);
        if (prepayM == null)
        {
            JScript.AlertMethod(this, "该记录无效!", JScript.IconOption.错误, "function (){ location.replace('" + ("PrePayList.aspx") + "'); }");
            return;
        }
        //支付金额小于0,直接支付失败
        if (prepayM.price <= 0)
        {
            Response.Redirect("Error.aspx?type=" + Common.DesEncrypt("2", Common.EncryptKey) + "&KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey));
            return;
        }


        if (prepayM.Start == 1)
        {
            Response.Redirect("Error.aspx?type=" + Common.DesEncrypt("2", Common.EncryptKey) + "&KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey));
            return;
        }
        this.hidKeyID.Value       = Convert.ToString(KeyID);
        this.lblOrderNO.InnerText = prepayM.guid; // KeyID.ToString();
        this.lblPrice.InnerText   = prepayM.price.ToString("0.00");;

        string username = this.UserName;
        string strWhere = string.Empty;

        if (this.DisID != 0)
        {
            strWhere += " DisID = '" + this.DisID + "' ";
        }
        else
        {
            JScript.AlertMsgOne(this, "操作员没有对应的代理商!", JScript.IconOption.错误);
            return;
        }
        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();
    }
Exemple #3
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();
    }
Exemple #4
0
    public void tx1375()
    {
        try
        {
            int hidFastPay = Convert.ToInt32(this.hidFastPay.Value);
            if (hidFastPay > 0)
            {
                string phone = new Hi.BLL.PAY_FastPayMent().GetModel(hidFastPay).phone;
                this.phone.InnerHtml = "(已发送至" + phone.Substring(0, 3) + " **** " + phone.Substring(phone.Length - 4, 4) + ")";
            }
            Hi.Model.PAY_PrePayment prepayM = new Hi.BLL.PAY_PrePayment().GetModel(KeyID);
            decimal price = prepayM.price;

            #region     计算支付手续费 start
            string AccountType = hid_PayType.Value;
            string bankid      = hidBank.Value;

            string  sxfsq = "-1";
            decimal sxf   = 0;
            // 获取手续费 begin
            string[] Json = Common.GetFastPay_sxf(this.CompID, price);

            string strMsg = Json[2].ToString();
            if (!string.IsNullOrEmpty(strMsg))
            {
                Tx1376ErrResult(strMsg);
                return;
            }
            else
            {
                sxfsq = Json[1].ToString();
                sxf   = Convert.ToDecimal(Json[0]);
            }

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

            #endregion  计算支付手续费 end

            String orderNo = WebConfigurationManager.AppSettings["OrgCode"] + DateTime.Now.ToString("yyyyMMdd");//支付订单号前半部分

            int    payid = 0;
            int    regid = 0;
            string guid  = Guid.NewGuid().ToString().Replace("-", "");
            Hi.Model.PAY_Payment payModel = new Hi.Model.PAY_Payment();
            payModel.OrderID      = KeyID;
            payModel.DisID        = this.DisID;
            payModel.PayUser      = new Hi.BLL.BD_Distributor().GetModel(this.DisID).DisName;
            payModel.PayPrice     = price;
            payModel.guid         = Common.Number_repeat(guid);
            payModel.IsAudit      = 2;
            payModel.vdef3        = "2";
            payModel.vdef4        = orderNo;
            payModel.CreateDate   = DateTime.Now;
            payModel.CreateUserID = this.UserID;
            payModel.ts           = DateTime.Now;
            payModel.modifyuser   = this.UserID;

            payModel.Channel   = "1";                    //支付渠道
            payModel.State     = Convert.ToInt32(sxfsq); //手续费收取方
            payModel.vdef5     = sxf.ToString("0.00");   //支付手续费
            payModel.vdef9     = "1";                    //默认支付
            payid              = new Hi.BLL.PAY_Payment().Add(payModel);
            ViewState["payid"] = payid;

            Hi.Model.PAY_RegisterLog regModel = new Hi.Model.PAY_RegisterLog();
            regModel.OrderId    = KeyID;
            regModel.Ordercode  = WebConfigurationManager.AppSettings["OrgCode"] + Convert.ToString(KeyID);
            regModel.number     = payModel.guid;
            regModel.Price      = price;
            regModel.Payuse     = prepayM.PreType == 6 ? "转账汇款" : prepayM.PreType == 1 ? "企业钱包充值" : "";
            regModel.PayName    = new Hi.BLL.BD_Distributor().GetModel(this.DisID).DisName;
            regModel.DisID      = this.DisID;
            regModel.PayTime    = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
            regModel.Remark     = prepayM.vdef1;
            regModel.DisName    = new Hi.BLL.BD_Company().GetModel(this.CompID).CompName;
            regModel.BankID     = new Hi.BLL.PAY_FastPayMent().GetModel(hidFastPay).BankID.ToString();
            regModel.CreateUser = this.UserID;
            regModel.CreateDate = DateTime.Now;
            regModel.LogType    = 1375;
            regid = new Hi.BLL.PAY_RegisterLog().Add(regModel);

            if (payid <= 0 || regid <= 0)
            {
                //JScript.AlertMsg(this, "数据异常!");
                ClientScript.RegisterStartupScript(this.GetType(), "payTx1375", "<script>$('#lblErr').html('数据异常!');</script>");
                return;
            }

            if (WebConfigurationManager.AppSettings["Paytest_zj"] != "1")
            {
                string configPath = WebConfigurationManager.AppSettings["payment.config.path"];
                try
                {
                    PaymentEnvironment.Initialize(configPath);
                }
                catch
                {
                    throw new Exception("支付配置不正确,请联系管理员!");
                }

                String institutionID = WebConfigurationManager.AppSettings["PayOrgCode"];
                // String orderNo = WebConfigurationManager.AppSettings["OrgCode"] + Convert.ToString(KeyID);   为了统一清算,作废次方法
                long amount = Convert.ToInt64(price * 100);

                // 2.创建交易请求对象
                Tx1375Request tx1375Request = new Tx1375Request();
                tx1375Request.setInstitutionID(institutionID);
                tx1375Request.setOrderNo(orderNo);
                tx1375Request.setPaymentNo(new Hi.BLL.PAY_Payment().GetModel(payid).guid);
                tx1375Request.setTxSNBinding(WebConfigurationManager.AppSettings["OrgCode"] + Convert.ToString(hidFastPay));
                tx1375Request.setAmount(amount);
                tx1375Request.setRemark("快捷支付发送短信".ToString());

                // 3.执行报文处理
                tx1375Request.process();

                TxMessenger txMessenger = new TxMessenger();
                String[]    respMsg     = txMessenger.send(tx1375Request.getRequestMessage(), tx1375Request.getRequestSignature());

                Tx1375Response tx1375Response = new Tx1375Response(respMsg[0], respMsg[1]);
                try
                {
                    Hi.Model.PAY_RegisterLog regM = new Hi.BLL.PAY_RegisterLog().GetModel(regid);
                    regM.PlanMessage   = tx1375Request.getRequestPlainText();
                    regM.Start         = tx1375Response.getCode();
                    regM.ResultMessage = tx1375Response.getMessage();
                    new Hi.BLL.PAY_RegisterLog().Update(regM);
                }
                catch { }

                if (!"2000".Equals(tx1375Response.getCode()))
                {
                    //JScript.AlertMsg(this, tx1375Response.getMessage());
                    ClientScript.RegisterStartupScript(this.GetType(), "payTx1375", "<script>$('#lblErr').html('" + tx1375Response.getMessage() + "!');</script>");
                    return;
                }
            }
            else
            {
                try
                {
                    Hi.Model.PAY_RegisterLog regM = new Hi.BLL.PAY_RegisterLog().GetModel(regid);
                    regM.PlanMessage   = "";
                    regM.Start         = "2000";
                    regM.ResultMessage = "OK.";
                    new Hi.BLL.PAY_RegisterLog().Update(regM);
                }
                catch { }
            }
            ClientScript.RegisterStartupScript(this.GetType(), "pay", "<script>$('.opacity').fadeIn(200);$('.tip').fadeIn(200);$('#paying').hide();$('#txtPhoneNum').show();$('#txtPhoneNum').select();$('#msgtwo').hide();$('#msgone').show();msgTime(120);</script>");
            return;
        }
        catch (Exception ex)
        {
            //JScript.AlertMsg(this, ex.Message);
            ClientScript.RegisterStartupScript(this.GetType(), "payTx1375", "<script>$('#lblErr').html('" + ex.Message + "!');</script>");
            return;
        }
    }
Exemple #5
0
    /// <summary>
    /// 关闭
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnClose_Click(object sender, EventArgs e)
    {
        int restID = 0;//接口日志表生成Id
        int BankID = Convert.ToInt32(this.hidFastBankid.Value);

        bool fal = false;

        string TxSNBinding   = string.Empty; //原绑定流水号
        string TxSNUnBinding = string.Empty; // 解绑流水号

        try
        {
            //老的绑定记录
            Hi.Model.PAY_FastPayMent fastpayModel_old = new Hi.BLL.PAY_FastPayMent().GetModel(BankID);

            //调用接口前,先生成一条解绑,信息在绑定表中
            Hi.Model.PAY_FastPayMent fastpayModel_new = new Hi.Model.PAY_FastPayMent();

            TxSNUnBinding = ConfigurationManager.AppSettings["OrgCode"].ToString().Trim() + Common.Number_repeat("");       //解绑流水号
            TxSNBinding   = ConfigurationManager.AppSettings["OrgCode"].ToString().Trim() + fastpayModel_old.ID.ToString(); //原绑定流水号

            //收集信息
            fastpayModel_new.DisID        = fastpayModel_old.DisID;
            fastpayModel_new.BankID       = fastpayModel_old.BankID;
            fastpayModel_new.Number       = fastpayModel_old.Number;
            fastpayModel_new.AccountName  = fastpayModel_old.AccountName;
            fastpayModel_new.bankcode     = fastpayModel_old.bankcode;
            fastpayModel_new.bankName     = fastpayModel_old.bankName;
            fastpayModel_new.IdentityCode = fastpayModel_old.IdentityCode;
            fastpayModel_new.phone        = fastpayModel_old.phone;
            fastpayModel_new.BankLogo     = fastpayModel_old.BankLogo;
            fastpayModel_new.Start        = 2;
            fastpayModel_new.CreateUser   = fastpayModel_old.CreateUser;
            fastpayModel_new.CreateDate   = DateTime.Now;
            fastpayModel_new.ts           = DateTime.Now;
            fastpayModel_new.modifyuser   = this.UserID;   //获取当前登录ID
            fastpayModel_new.vdef5        = TxSNUnBinding; //解绑流水号
            restID = new Hi.BLL.PAY_FastPayMent().Add(fastpayModel_new);

            string strs      = string.Empty;
            string resetcode = "2000";
            int    succes    = 20;
            //是否屏蔽中金支付接口0是不屏蔽,1,屏蔽
            if (ConfigurationManager.AppSettings["Paytest_zj"] == "0")
            {
                //调用接口
                string configPath = WebConfigurationManager.AppSettings["payment.config.path"];
                PaymentEnvironment.Initialize(configPath);

                string institutionID = WebConfigurationManager.AppSettings["PayOrgCode"];//机构号码

                Tx2503Request tx2503Request = new Tx2503Request();
                tx2503Request.setInstitutionID(institutionID);
                tx2503Request.setTxSNUnBinding(TxSNUnBinding); //解绑流水号
                tx2503Request.setTxSNBinding(TxSNBinding);     //原绑定流水号
                tx2503Request.process();

                TxMessenger txMessenger = new TxMessenger();
                String[]    respMsg     = txMessenger.send(tx2503Request.getRequestMessage(), tx2503Request.getRequestSignature());

                Tx2503Response tx2503Response = new Tx2503Response(respMsg[0], respMsg[1]);

                strs      = tx2503Response.getMessage();// tx2503Response.getCode() + "," + tx2503Response.getMessage();
                resetcode = tx2503Response.getCode();
                succes    = Convert.ToInt32(tx2503Response.getStatus());
            }
            //消息提示
            //JScript.ShowAlert(this, strs);
            if ("2000".Equals(resetcode))
            {
                if (succes == 20)
                {
                    //修改原始记录的状态为解绑
                    fastpayModel_old.vdef6 = "1";
                    bool fal_old = new Hi.BLL.PAY_FastPayMent().Update(fastpayModel_old);

                    //修改,回填快捷支付表中的记录状态信息。
                    Hi.Model.PAY_FastPayMent fastpayModel = new Hi.BLL.PAY_FastPayMent().GetModel(restID);
                    fastpayModel.vdef6 = "1";
                    fastpayModel.ID    = restID;
                    fal = new Hi.BLL.PAY_FastPayMent().Update(fastpayModel);
                }
                else
                {
                    fal = false;
                }
            }
            else if ("30250311".Equals(resetcode))
            {
                //修改原始记录的状态为解绑
                fastpayModel_old.vdef6 = "1";
                bool fal_old = new Hi.BLL.PAY_FastPayMent().Update(fastpayModel_old);

                //修改,回填快捷支付表中的记录状态信息。
                Hi.Model.PAY_FastPayMent fastpayModel = new Hi.BLL.PAY_FastPayMent().GetModel(restID);
                fastpayModel.vdef6 = "1";
                fastpayModel.ID    = restID;
                fal = new Hi.BLL.PAY_FastPayMent().Update(fastpayModel);
            }
            else
            {
                JScript.AlertMsgOne(this, strs + "!", JScript.IconOption.错误);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }

        //if (fal)
        //    JScript.ShowAlert(this, "操作成功!");
        //else
        //    JScript.ShowAlert(this, "操作失败!");

        //重新绑定
        Bind();
    }