Exemple #1
0
    /// <summary>
    /// 支付按钮事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnsure_Click(object sender, EventArgs e)
    {
        double currency = AjaxClass.GetCurrency(Convert.ToInt32(bzCurrency), Convert.ToInt32(Session["Default_Currency"].ToString()));
        int    res      = -1;
        string usemoney = lbltotalmoney.Text.Trim();
        string billid   = ViewState["billid"].ToString();
        int    roletype = Convert.ToInt32(ViewState["roletype"]);
        int    dotype   = Convert.ToInt32(ViewState["dotype"]);

        loginnumber = ViewState["loginnumber"].ToString();

        string curip = Request.UserHostAddress.ToString();

        if (!rdorempay.Checked)  //非离线支付
        {
            if (ViewState["remid"] != null)
            {
                RemittancesDAL.DelRemittancesrelationremtemp(ViewState["remid"].ToString());
            }
        }
        else //使用离线支付方式
        {
            if (ViewState["remid"] != null)
            {
                RemittancesDAL.UPRemittancesre(ViewState["remid"].ToString());
            }
        }

        if (rdoonlinepay.Checked)  //在线支付
        {
            string hkid = billid;
            ClientScript.RegisterStartupScript(GetType(), "msg", "alert('该功能正在开发中,请耐心等候!!!');", true);
            return;

            if (dotype == 1)
            {
                hkid = RemittancesDAL.AddRemittancebytypeOnline(billid, roletype, curip, loginnumber, 1);
            }
            else if (dotype == 2)
            {
                RemittancesDAL.UpdateOnlinepayway(billid, 4);
            }

            string posturl = Getposturl(hkid);

            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>window.open ('" + posturl + "');</script>");
            this.btnsure.Enabled = false;
            return;
        }
        else if (rdorempay.Checked)  //离线支付
        {
            //usemoney = (double.Parse(lblrmb.Text.Trim()) * currency).ToString();
            usemoney = double.Parse(lblrmb.Text.Trim()).ToString("0.00");
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script> window.location.href='payerror.aspx?ef=" + EncryKey.Encrypt("100" + "," + billid + "," + usemoney) + "';</script>");
            return;
        }
        else if (rdostorepay.Checked)  //去店铺支付
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script> window.location.href='payerror.aspx?ef=" + EncryKey.Encrypt("101" + "," + billid + "," + usemoney) + "';</script>");
            return;
        }
        else if (rdoectpay.Checked)                                     //会员电子货币支付
        {
            if (MemberOrderDAL.Getvalidteiscanpay(billid, loginnumber)) //限制订单必须有订货所属店铺推荐人协助人支付)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script> alert('" + GetTran("007452", "该订单不属于您的协助或推荐报单,不能完成支付!") + "'); window.location.href='../Logout.aspx'; </script>");
                return;
            }
            if (ViewState["odnumber"].ToString() != loginnumber)//如果不是自己给自己支付
            {
                if (this.rdombsuregetmoney.SelectedValue == "0")
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "", "<script> alert('" + GetTran("007455", "请确认已收到该会员支付的报单金额") + "');   </script>");
                    return;
                }
            }
            if (this.txtadvpass.Text == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("006656", "二级密码不能为空!") + "');</script>");
                return;
            }
            string oldPass = Encryption.Encryption.GetEncryptionPwd(this.txtadvpass.Text.ToString(), loginnumber);
            int    n       = PwdModifyBLL.check(loginnumber, oldPass, 1);
            if (n <= 0)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script> alert('" + GetTran("006058", "二级密码不正确!") + "'); </script>");
                return;
            }

            if (MemberInfoDAL.CheckState(Session["Member"].ToString()))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script> alert('" + GetTran("007456", "会员账户已冻结,不能完成支付!") + "'); </script>");
                return;
            }


            DataTable dt_one    = DAL.DBHelper.ExecuteDataTable("select ordertype from MemberOrder where OrderID=" + billid);
            string    ordertype = dt_one.Rows[0]["ordertype"].ToString();//订单类型
            int       act;
            if (ordertype == "22" || ordertype == "12")
            {
                act = Convert.ToInt32(rdoaccounttype2.SelectedValue);
            }
            else if (ordertype == "25")
            {
                act = Convert.ToInt32(rdoaccounttype3.SelectedValue);
            }
            else
            {
                act = Convert.ToInt32(rdoaccounttype.SelectedValue);
            }

            res = AddOrderDataDAL.OrderPayment(loginnumber, billid, curip, roletype, dotype, act, loginnumber, "", 2, -1, 1, 1, "", double.Parse(usemoney), "");
            this.btnsure.Enabled = false;
        }
        else if (rdostpaymb.Checked)                                    //店铺支付 会员订单
        {
            if (MemberOrderDAL.Getvalidteiscanpay(billid, loginnumber)) //限制订单必须有订货所属店铺推荐人协助人支付)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script> alert('" + GetTran("007452", "该订单不属于您的协助或推荐报单,不能完成支付!") + "'); window.location.href='../Logout.aspx'; </script>");
                return;
            }
            if (this.rdoisagree.SelectedValue == "0") //验证是否确认收到款
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script> alert('" + GetTran("007455", "请确认已收到该会员支付的报单金额") + "!');   </script>");
                return;
            }
            if (this.txtpayadbpass.Text == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("006656", "二级密码不能为空!") + "');</script>");
                return;
            }
            string oldPass = Encryption.Encryption.GetEncryptionPwd(this.txtpayadbpass.Text.ToString(), Session["Store"].ToString());
            int    n       = PwdModifyBLL.checkstore(loginnumber, oldPass, 1);
            if (n <= 0)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script> alert('" + GetTran("006058", "二级密码不正确!") + "'); </script>");
                return;
            }

            int act = Convert.ToInt32(rdostactypepaymb.SelectedValue);
            res = AddOrderDataDAL.OrderPayment(loginnumber, billid, curip, 2, 3, act, loginnumber, "", 5, -1, 1, 1, "", double.Parse(usemoney), "");
            this.btnsure.Enabled = false;
        }
        else if (rdostopayorder.Checked)  //店铺电子账户支付 订货单
        {
            if (this.txtstadvpass.Text == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("006656", "二级密码不能为空!") + "');</script>");
                return;
            }
            string oldPass = Encryption.Encryption.GetEncryptionPwd(this.txtstadvpass.Text.ToString(), Session["Store"].ToString());
            int    n       = PwdModifyBLL.checkstore(loginnumber, oldPass, 1);
            if (n <= 0)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script> alert('" + GetTran("006058", "二级密码不正确!") + "'); </script>");

                return;
            }
            int act = Convert.ToInt32(rdostaccount.SelectedValue);

            res = AddOrderDataDAL.OrderPayment(loginnumber, billid, curip, roletype, dotype, act, loginnumber, "", 2, -1, 1, 1, "", double.Parse(usemoney), ""); this.btnsure.Enabled = false;
        }
        else
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script> alert('" + GetTran("000000", "请至少选择一种支付方式!") + "'); </script>");
            return;
        }

        PublicClass.SendMsg(1, billid, "");

        ClientScript.RegisterStartupScript(this.GetType(), "", "<script> window.location.href='payerror.aspx?ef=" + EncryKey.Encrypt(res.ToString() + "," + billid + "," + usemoney) + "';</script>");
        return;
    }