Example #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        this.Label1.Text = "";
        this.Label2.Text = "";
        string    alipayPaymentNumber = "";
        string    returnDescription   = "";
        OnlinePay pay   = new OnlinePay();
        DataTable table = new Views.V_UserPayDetails().Open("ID, Name, DateTime, Money, PayType, FormalitiesFees, UserID", "Result = 1", "");
        double    num2  = 0.0;

        foreach (DataRow row in table.Rows)
        {
            alipayPaymentNumber = "";
            if ((pay.Query(row["PayType"].ToString().Trim(), row["ID"].ToString(), ref alipayPaymentNumber, ref returnDescription) != 0) && (returnDescription == "等待买家付款"))
            {
                num2 += _Convert.StrToDouble(row["Money"].ToString(), 0.0);
                string text = this.Label1.Text;
                this.Label1.Text = text + "用户名:" + row["Name"].ToString() + ", 用户ID:" + row["UserID"].ToString() + ", 系统交易号:" + row["ID"].ToString() + ", 金额:" + row["Money"].ToString() + "<br />";
            }
        }
        this.Label2.Text = "合计总金额:" + num2.ToString();
    }
 protected void g_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     if (((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) || (e.Item.ItemType == ListItemType.EditItem))
     {
         string str6;
         int    num             = -9999;
         long   userID          = _Convert.StrToLong(e.Item.Cells[9].Text, 0L);
         string text            = e.Item.Cells[10].Text;
         double money           = _Convert.StrToDouble(e.Item.Cells[3].Text, 0.0);
         double formalitiesFees = _Convert.StrToDouble(e.Item.Cells[5].Text, 0.0);
         string paymentNumber   = e.Item.Cells[8].Text;
         string payBank         = this.getBankName(text);
         _Convert.StrToDateTime(e.Item.Cells[2].Text, DateTime.Now.ToString("yyyyMMdd"));
         string str4              = _Convert.StrToDateTime(e.Item.Cells[2].Text, DateTime.Now.ToString("yyyyMMdd")).ToString("yyyyMMdd");
         int    returnValue       = -1;
         string returnDescription = "";
         if ((e.CommandName == "Query") && ((str6 = text.Split(new char[] { '_' })[0].ToUpper()) != null))
         {
             if (str6 == "ALIPAY")
             {
                 string    alipayPaymentNumber = "";
                 OnlinePay pay = new OnlinePay();
                 try
                 {
                     num = pay.Query(e.Item.Cells[10].Text.Trim(), paymentNumber, ref alipayPaymentNumber, ref returnDescription);
                 }
                 catch
                 {
                     JavaScript.Alert(this.Page, "查询失败,可能是网络通讯故障。请重试一次。");
                     return;
                 }
                 if (num < 0)
                 {
                     JavaScript.Alert(this.Page, "支付号为 " + paymentNumber + " 的支付记录没有充值成功,描述:" + returnDescription);
                     return;
                 }
                 string memo = "系统交易号:" + paymentNumber + ",支付宝交易号:" + alipayPaymentNumber;
                 returnDescription = "";
                 if (Procedures.P_UserAddMoney(base._Site.ID, userID, money, formalitiesFees, paymentNumber, payBank, memo, ref returnValue, ref returnDescription) < 0)
                 {
                     JavaScript.Alert(this.Page, "数据库读写错误");
                     return;
                 }
                 if (returnValue < 0)
                 {
                     JavaScript.Alert(this.Page, returnDescription);
                     return;
                 }
                 JavaScript.Alert(this.Page, "此笔充值记录已到帐并已处理成功!");
             }
             else if (str6 == "51ZFK")
             {
                 this.frmmain.Attributes.Add("src", "../Home/Room/OnlinePay/ZhiFuKa/PayQuery.aspx?sdcustomno=" + paymentNumber);
             }
             else if (str6 == "TENPAY")
             {
                 this.frmmain.Attributes.Add("src", "../Home/Room/OnlinePay/Tenpay/PayQuery.aspx?sp_billno=" + paymentNumber + "&date=" + str4);
             }
             else if (str6 == "007KA")
             {
                 this.frmmain.Attributes.Add("src", "../Home/Room/OnlinePay/007ka/PayQuery.aspx?OrderID=" + paymentNumber);
             }
             else if (str6 == "99BILL")
             {
                 string dealID       = "";
                 string errorMessage = "";
                 if (this.Check99BillPay(long.Parse(paymentNumber), ref dealID, ref errorMessage) && (errorMessage == ""))
                 {
                     string str11 = "系统交易号:" + paymentNumber + ",快钱交易号:" + dealID;
                     returnDescription = "";
                     returnValue       = -1;
                     if (Procedures.P_UserAddMoney(base._Site.ID, userID, money, formalitiesFees, paymentNumber, payBank, str11, ref returnValue, ref returnDescription) < 0)
                     {
                         JavaScript.Alert(this.Page, string.Concat(new object[] { "数据库读写错误:", base._Site.ID, " , ", userID, " , ", money, " , ", formalitiesFees, " , ", paymentNumber, " , ", payBank, " , ", str11 }));
                         return;
                     }
                     if (returnValue < 0)
                     {
                         JavaScript.Alert(this.Page, returnDescription);
                         return;
                     }
                     JavaScript.Alert(this.Page, "此笔充值记录已到帐并已处理成功!");
                     this.BindData();
                 }
                 else
                 {
                     JavaScript.Alert(this.Page, errorMessage);
                 }
             }
         }
         if (e.CommandName == "Accept")
         {
             string str12 = "手动处理充值" + ((TextBox)e.Item.Cells[4].FindControl("tbDescription")).Text.Trim();
             num = -1;
             if (Procedures.P_UserAddMoney(base._Site.ID, userID, money, formalitiesFees, paymentNumber, payBank, str12, ref returnValue, ref returnDescription) < 0)
             {
                 returnDescription = "数据库读写错误";
                 return;
             }
             if (returnValue < 0)
             {
                 JavaScript.Alert(this.Page, returnDescription);
             }
             JavaScript.Alert(this.Page, "此笔充值处理成功!");
         }
         if (e.CommandName == "Del")
         {
             try
             {
                 new Tables.T_UserPayDetails().Delete("ID=" + paymentNumber + " and Result = 0");
             }
             catch
             {
                 JavaScript.Alert(this.Page, "此笔充值删除失败!");
             }
             JavaScript.Alert(this.Page, "此笔充值删除成功!");
         }
         this.BindData();
     }
 }