示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {

        //卖家商户号
        customerid = so["OnlinePay_ZhiFuKa_UserNumber"].Value.ToString();

        //卖家商户key
        key = so["OnlinePay_ZhiFuKa_MD5Key"].Value.ToString();

        sdcustomno = Shove._Web.Utility.GetRequest("sdcustomno");

        if (string.IsNullOrEmpty(sdcustomno) || string.IsNullOrEmpty(customerid) || string.IsNullOrEmpty(key))
        {

            Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sdcustomno + " 的支付记录没有充值成功,描述:参数不齐全,无法提交查询!\"); window.location.href='';</script>");

            return;
        }

        string url = "";
        if (!GetQueryUrl(out url))
        {
            Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sdcustomno + " 的支付记录没有充值成功,描述:" + url + "!\");window.location.href='';</script>");

            return;
        }
        else
        {
            string msg = "";

            if (GetResponseContents(GetHtml(url, "GB2312", 200), out msg))
            {

                Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sdcustomno + " 的支付记录没有充值成功,描述:" + msg + "!\"); window.location.href='';</script>");

                return;
            }

            //如果,充值成功,那么我们完成充值

            try
            {
                string Memo = "系统交易号:" + sdcustomno + ",51支付交易号:" + sd51no;
                int ReturnValue = -1;
                string ReturnDescription = "";
                int Results = -1;

                DAL.Tables.T_UserPayDetails t_paydetails = new DAL.Tables.T_UserPayDetails();

                DataTable tmptTB = t_paydetails.Open("", "ID=" + sdcustomno, "");

                if (tmptTB == null || tmptTB.Rows.Count <= 0)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "支付号为 " + sdcustomno + " 的支付记录没有充值成功,描述:充值处理失败,本条数据丢失。");

                    return;
                }

                double Money = (ordermoney == -1 ? ordermoney : Shove._Convert.StrToDouble(tmptTB.Rows[0]["Money"].ToString(), 0));
                long ID = Shove._Convert.StrToLong(tmptTB.Rows[0]["UserID"].ToString(), 0);
                double FormalitiesFees = Shove._Convert.StrToDouble(tmptTB.Rows[0]["FormalitiesFees"].ToString(), 0);

                string[] banks = tmptTB.Rows[0]["PayType"].ToString().Split('_');

                string PayBank = banks.Length < 2 ? "" : banks[1];

                Results = DAL.Procedures.P_UserAddMoney(_Site.ID, ID, Money, FormalitiesFees, sdcustomno,getBankName(PayBank), Memo, ref ReturnValue, ref ReturnDescription);

                if (Results < 0)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "支付号为 " + sdcustomno + " 的支付记录没有充值成功,描述:数据库读写错误");

                    return;
                }
                else
                {
                    if (ReturnValue < 0)
                    {
                        Shove._Web.JavaScript.Alert(this.Page, ReturnDescription);

                        return;
                    }

                    Shove._Web.JavaScript.Alert(this.Page, "此笔充值记录已到帐并已处理成功!");
                }
            }
            catch
            {
                Shove._Web.JavaScript.Alert(this.Page, "支付号为 " + sdcustomno + " 的支付记录没有充值成功,描述:查询失败,可能是网络通讯故障。请重试一次。");

                return;
            }

        }

    }
示例#2
0
    private void Page_Load(object sender, System.EventArgs e)
    {


        string errmsg = "";

        //卖家商户key
        key = so["OnlinePay_Tenpay_MD5Key"].Value.ToString();

        //卖家商户号
        bargainor_id = so["OnlinePay_Tenpay_UserNumber"].Value.ToString();


        if (GetQueryValueFromUrl(Request.QueryString, out errmsg))
        {

            if (pay_result == PAYOK)
            {
                //如果充值查询成功,那么去对记录进行处理
                try
                {
                    string Memo = "系统交易号:" + sp_billno + ",财付通交易号:" + transaction_id;
                    int ReturnValue = -1;
                    string ReturnDescription = "";
                    int Results = -1;

                    DAL.Tables.T_UserPayDetails t_paydetails = new DAL.Tables.T_UserPayDetails();

                    DataTable tmptTB = t_paydetails.Open("", "ID=" + sp_billno, "");

                    if (tmptTB == null || tmptTB.Rows.Count <= 0)
                    {
                        Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sp_billno + " 的支付记录没有充值成功,描述:充值处理失败,本条数据丢失。\");</script>");

                        return;
                    }

                    double Money = Shove._Convert.StrToDouble(tmptTB.Rows[0]["Money"].ToString(), 0);
                    long ID = Shove._Convert.StrToLong(tmptTB.Rows[0]["UserID"].ToString(), 0);
                    double FormalitiesFees = Shove._Convert.StrToDouble(tmptTB.Rows[0]["FormalitiesFees"].ToString(), 0);

                    string[] banks = tmptTB.Rows[0]["PayType"].ToString().Split('_');

                    string PayBank = banks.Length < 2 ? "" : banks[1];

                    Results = DAL.Procedures.P_UserAddMoney(_Site.ID, ID, Money, FormalitiesFees, sp_billno,getBankName(PayBank), Memo, ref ReturnValue, ref ReturnDescription);

                    if (Results < 0)
                    {
                        Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sp_billno + " 的支付记录没有充值成功,描述:数据库读写错误\");</script>");

                        return;
                    }
                    else
                    {
                        if (ReturnValue < 0)
                        {
                            Response.Write("<script type=\"text/javascript\">alert(\"" + ReturnDescription + "\");</script>");

                            return;
                        }

                        Response.Write("<script type=\"text/javascript\">alert(\"此笔充值记录已到帐并已处理成功!\");</script>");

                    }
                }
                catch
                {
                    Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sp_billno + " 的支付记录没有充值成功,描述:查询失败,可能是网络通讯故障。请重试一次。\");</script>");


                    return;
                }


            }
            else
            {
                Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sp_billno + " 的支付记录没有充值成功,描述:" + payerrmsg+"\");</script>");
            }
        }
        else
        {
            //认证签名失败
            errmsg = "认证签名失败";
            Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sp_billno + " 的支付记录没有充值成功,描述:" + errmsg + "\");</script>");
        }

    }