protected void gUserPay_ItemCommand(object source, DataGridCommandEventArgs e) { HiddenField tdUserPayID = (HiddenField)e.Item.FindControl("tdUserPayDetail"); try { int PayID = Shove._Convert.StrToInt(tdUserPayID.Value.ToString(), 0); string payType = ""; string Money = ""; string time = ""; if (e.CommandName == "ShowUserPayDetail") { DataTable dt = new DAL.Tables.T_UserPayDetails().Open("PayType , [Money] , [DateTime]", "id = " + PayID, ""); payType = dt.Rows[0]["PayType"].ToString(); Money = dt.Rows[0]["Money"].ToString(); time = dt.Rows[0]["DateTime"].ToString(); this.lblUserPayBank.Text = getBankName(payType); //== "alipay" ? "支付宝充值" :"网银充值"; this.lblUserPayMoneys.Text = Money.Substring(0, Money.IndexOf('.')) + Money.Substring(Money.IndexOf('.'), 3); this.lblUserPayTime.Text = time; } BindUserPayData(); BindDistills(); } catch { } }
//获取远程服务器ATN结果 //public String Get_Http(String a_strUrl, int timeout) //{ // string strResult; // try // { // HttpWebRequest myReq = (HttpWebRequest)HttpWebRequest.Create(a_strUrl); // myReq.Timeout = timeout; // HttpWebResponse HttpWResp = (HttpWebResponse)myReq.GetResponse(); // Stream myStream = HttpWResp.GetResponseStream(); // StreamReader sr = new StreamReader(myStream, Encoding.Default); // StringBuilder strBuilder = new StringBuilder(); // while (-1 != sr.Peek()) // { // strBuilder.Append(sr.ReadLine()); // } // strResult = strBuilder.ToString(); // } // catch (Exception exp) // { // strResult = "错误:" + exp.Message; // } // return strResult; //} private bool WriteUserAccount(Users _User, string orderid, string amount, string Memo) { double Money = Shove._Convert.StrToDouble(amount, 0); if (Money == 0) { return(false); } double FormalitiesFeesScale = so["OnlinePay_Alipay_PayFormalitiesFeesScale"].ToDouble(0) / 100; double FormalitiesFees = Money - Math.Round(Money / (FormalitiesFeesScale + 1), 2); Money -= FormalitiesFees; string ReturnDescription = ""; bool ok = (_User.AddUserBalance(Money, FormalitiesFees, orderid, "支付宝支付," + so["OnlinePay_Alipay_UserName"].ToString(""), Memo, ref ReturnDescription) == 0); if (!ok) { DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result", "[id] = " + Shove._Convert.StrToLong(orderid, 0).ToString(), ""); if (dt == null || dt.Rows.Count == 0) { new Log("System").Write("在线支付:返回的交易号找不到对应的数据"); return(false); } int IsOK = Shove._Convert.StrToInt(dt.Rows[0][0].ToString(), 0); if (IsOK == 1) { return(true); } else { new Log("System").Write("在线支付:对应的数据未处理"); return(false); } } return(ok); }
private bool WriteUserAccount(Users user) { double Money = Shove._Convert.StrToDouble(c_orderamount, 0); if (Money == 0) { return(false); } double FormalitiesFeesScale = so["OnlinePay_CnCard_CommissionScale"].ToDouble(0) / 100; double FormalitiesFees = Money - Math.Round(Money / (FormalitiesFeesScale + 1), 2); Money -= FormalitiesFees; string ReturnDescription = ""; bool ok = (user.AddUserBalance(Money, FormalitiesFees, c_order, "云网支付," + c_transnum, "", ref ReturnDescription) == 0); if (!ok) { DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result", "[id] = " + Shove._Convert.StrToLong(c_order, 0).ToString(), ""); if (dt == null || dt.Rows.Count == 0) { new Log(this.GetType().FullName).Write("返回的交易号找不到对应的数据"); return(false); } int IsOK = Shove._Convert.StrToInt(dt.Rows[0][0].ToString(), 0); if (IsOK == 1) { return(true); } else { new Log(this.GetType().FullName).Write("对应的数据未处理"); return(false); } } return(ok); }
private bool WriteUserAccount(string Memo) { if (Money == 0) { return(false); } double FormalitiesFeesScale = so["OnlinePay_ChinaUnion_CommissionScale"].ToDouble(0) / 100; double FormalitiesFees = Money - Math.Round(Money / (FormalitiesFeesScale + 1), 2); Money -= FormalitiesFees; string ReturnDescription = ""; bool ok = (_User.AddUserBalance(Money, FormalitiesFees, sp_billno, getBankName(bankPay), Memo, ref ReturnDescription) == 0); if (!ok) { DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result", "[id] = " + Shove._Convert.StrToLong(sp_billno, 0).ToString(), ""); if (dt == null || dt.Rows.Count == 0) { //new Log("System").Write("在线支付:返回的交易号找不到对应的数据"); return(false); } int IsOK = Shove._Convert.StrToInt(dt.Rows[0][0].ToString(), 0); if (IsOK == 1) { return(true); } else { //new Log("System").Write("在线支付:对应的数据未处理"); return(false); } } return(ok); }
//充值写入账户 private bool WriteUserAccount(Users _User, string Id, string amount, string Memo) { //充值金额 double Money = Shove._Convert.StrToDouble(amount, 0); if (Money == 0) { return(false); } string ReturnDescription = ""; bool ok = (_User.AddUserBalance(Money, 0, Id, "", Memo, ref ReturnDescription) == 0); if (!ok) { DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result", "[PayNumber] = '" + Id + "'", ""); if (dt == null || dt.Rows.Count == 0) { new Log("System").Write("在线支付:返回的交易号找不到对应的数据"); return(false); } int IsOK = Shove._Convert.StrToInt(dt.Rows[0][0].ToString(), 0); if (IsOK == 1) { return(true); } else { new Log("System").Write("在线支付:对应的数据未处理"); return(false); } } return(ok); }
private bool WriteUserAccount(string Memo) { //这里手续费的计算与网银的不一样,网银充值10元,那么实充就是10,但是手机卡充值10元,实充就要小于10元 double FormalitiesFeesScale = so["OnlinePay_ZhiFuKa_PayFormalitiesFeesScale"].ToDouble(0) / 100; double FormalitiesFees = Math.Round(ordermoney * FormalitiesFeesScale, 2); ordermoney -= FormalitiesFees; string ReturnDescription = ""; bool ok = (_User.AddUserBalance(ordermoney, FormalitiesFees, sdcustomno, getBankName(cardno), Memo, ref ReturnDescription) == 0); if (!ok) { DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result", "[id] = " + Shove._Convert.StrToLong(sdcustomno, 0).ToString(), ""); if (dt == null || dt.Rows.Count == 0) { //new Log("OnlinePay").Write("在线支付:充值未完成。错误描述:返回的交易号找不到对应的数据"); return(false); } int IsOK = Shove._Convert.StrToInt(dt.Rows[0][0].ToString(), 0); if (IsOK == 1) { return(true); } else { //new Log("OnlinePay").Write("在线支付:充值未完成。错误描述:对应的数据未处理"); return(false); } } return(ok); }
protected void Page_Load(object sender, EventArgs e) { key = so["OnlinePay_007Ka_Key"].ToString(""); try { SettingParams(); } catch { errorMessage = "007订单查询结果:回调参数有误!"; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } try { if (Request.QueryString.AllKeys.Length < 1) { errorMessage = OrderID + "订单查询结果:该数据传输丢失!"; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } if (SignCounterpart != GetMD5(Orderinfo + "|" + key)) { errorMessage = OrderID + "订单查询结果:认证签名失败!"; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } if (TranStat.ToString().Trim() != "1" && TranStat.ToString().Trim() != "29") { errorMessage = OrderID + "订单查询结果:007手机卡充值失败!错误号:" + TranStat.ToString() + " 错误描述:" + TranInfo + "(" + GetTranStatToStringCH(Shove._Convert.StrToInt(TranStat.ToString(), 0)) + ")"; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result,UserID", "ID=" + OrderID, ""); if (dt == null || dt.Rows.Count < 1) { errorMessage = OrderID + "订单查询结果:支付号不存在,数据可能已近丢失!"; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } else { if (Shove._Convert.StrToInt(dt.Rows[0][1].ToString(), 0) != 0) { if (Shove._Convert.StrToInt(dt.Rows[0][0].ToString(), 0) == 1) { errorMessage = OrderID + "订单充值已经成功!"; Response.Write("OK"); new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } int returnValue = -20000; string returnDescription = ""; double FormalitiesFeesScale = so["OnlinePay_007Ka_FormalitiesFees"].ToDouble(0) / 100; double FormalitiesFees = Math.Round((Shove._Convert.StrToDouble(Value, 0) / 100) * FormalitiesFeesScale, 2); long userid = Shove._Convert.StrToLong(dt.Rows[0][1].ToString(), 0); DAL.Procedures.P_UserAddMoney(1, userid, Shove._Convert.StrToDouble(Value, 0) / 100.00 - FormalitiesFees, FormalitiesFees, OrderID, "007KA", "007KA系统交易号" + OrderID, ref returnValue, ref returnDescription); if (returnValue < 0) { errorMessage = OrderID + "订单查询结果:增加电子货币错误。错误原因:" + returnDescription; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } else { errorMessage = OrderID + "订单充值成功!"; Response.Write("OK"); new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } } else { errorMessage = OrderID + "订单查询结果:充值未完成!错误原因:用户不存在"; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } } } catch { errorMessage = OrderID + "订单查询结果:错误描述:出现未知异常!"; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } }
protected void Page_Load(object sender, EventArgs e) { try { SettingParams(); } catch (Exception ee) { errorMessage = "通知错误:错误错误描述:007Ka回调页面参数列表!"; new Log("OnlinePay").Write(errorMessage + " 错误信息:" + ee.Message); Response.End(); return; } Response.Write("OK"); key = so["OnlinePay_007Ka_Key"].ToString("").Trim(); if (Sign != GetMD5(Orderinfo)) { errorMessage = "通知错误:充值未完成。错误描述:认证签名失败!"; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } if (MerID != so["OnlinePay_007Ka_MerchantId"].ToString("").Trim()) { errorMessage = "通知错误:充值未完成。错误描述:商户号错误,数据非法!"; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } if (MerAccount != so["OnlinePay_007Ka_MerAccount"].ToString("").Trim()) { errorMessage = "通知错误:充值未完成。错误描述:银行账号错误,数据非法!"; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } if (TranStat.ToString().Trim() != "1" && TranStat.ToString().Trim() != "29") { errorMessage = "通知错误:充值未完成。错误号:" + TranStat + "错误描述:" + TranInfo; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result,UserID", "ID=" + OrderID, ""); if (dt == null || dt.Rows.Count < 1) { errorMessage = "通知错误:充值未完成。错误描述:数据库错误。关联错误:获取支付流水号未成功。"; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } else { if (Shove._Convert.StrToLong(dt.Rows[0][0].ToString(), 0) == 0) { string returnDescription = ""; int returnValue = 1; double FormalitiesFeesScale = so["OnlinePay_007Ka_FormalitiesFees"].ToDouble(0) / 100; double FormalitiesFees = Math.Round((Shove._Convert.StrToDouble(Value, 0) / 100) * FormalitiesFeesScale, 2); DAL.Procedures.P_UserAddMoney(1, Shove._Convert.StrToLong(dt.Rows[0][1].ToString(), 0), Shove._Convert.StrToDouble(Value, 0) / 100.00 - FormalitiesFees, FormalitiesFees, OrderID, "007Ka", "系统交易号:" + OrderID + "007Ka支付", ref returnValue, ref returnDescription); if (returnValue < 0) { errorMessage = "通知错误:充值未完成。错误描述:增加电子货币错误。错误原因:" + returnDescription; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } else { errorMessage = "007在线充值:充值完成"; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } } else { errorMessage = "007在线充值:充值完成"; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } } }
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; } } }
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>"); } }
protected void Page_Load(object sender, EventArgs e) { string returnUrl = Shove._Web.Utility.GetUrl() + "/Home/Room/OnlinePay/"; try { SettingParams(); } catch (Exception ee) { errorMessage = "007在线充值:充值未完成。错误描述:参数有误 详细:" + ee.Message; new Log("OnlinePay").Write(errorMessage); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } key = so["OnlinePay_007Ka_Key"].ToString(""); if (Request.QueryString.AllKeys.Length < 1) { errorMessage = "007在线充值:充值未完成。错误描述:数据传输错误!"; new Log("OnlinePay").Write(errorMessage); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } if (SignCounterpart != GetMD5(Orderinfo)) { errorMessage = "007在线充值:充值未完成。错误描述:认证签名失败!"; new Log("OnlinePay").Write(errorMessage); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } if (MerID != so["OnlinePay_007Ka_MerchantId"].ToString("").Trim()) { errorMessage = "007在线充值:充值未完成。错误描述:商户号错误,数据非法!"; new Log("OnlinePay").Write(errorMessage); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } if (MerAccount != so["OnlinePay_007Ka_MerAccount"].ToString("").Trim()) { errorMessage = "007在线充值:充值未完成。错误描述:商户银行账号错误,数据非法!"; new Log("OnlinePay").Write(errorMessage); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } if (TranStat.ToString().Trim() != "1" && TranStat.ToString().Trim() != "29") { errorMessage = "007充值失败。"; new Log("OnlinePay").Write(errorMessage + " 错误号:" + TranStat.ToString() + " 错误描述:" + TranInfo); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result,UserID", "ID=" + OrderID, ""); if (dt == null || dt.Rows.Count < 1) { errorMessage = "007在线充值:充值未完成。错误描述:生成支付流水号未成功。"; new Log("OnlinePay").Write(errorMessage); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } else { if (Shove._Convert.StrToLong(dt.Rows[0][1].ToString(), 0) != 0) { if (Shove._Convert.StrToInt(dt.Rows[0][0].ToString(), 0) == 1) { errorMessage = OrderID + "订单充值已经成功!"; Response.Write("OK"); new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } string returnDescription = ""; double FormalitiesFeesScale = so["OnlinePay_007Ka_FormalitiesFees"].ToDouble(0) / 100; double FormalitiesFees = Math.Round((Shove._Convert.StrToDouble(Value, 0) / 100) * FormalitiesFeesScale, 2); Users user = new Users(_Site.ID)[_Site.ID, Shove._Convert.StrToLong(dt.Rows[0][1].ToString(), 0)]; int temp = user.AddUserBalance(Shove._Convert.StrToDouble(Value, 0) / 100.0 - FormalitiesFees, FormalitiesFees, OrderID, "007Ka", "系统交易号:" + OrderID + "007Ka支付", ref returnDescription); if (temp < 0) { errorMessage = "增加电子货币错误。错误原因:" + returnDescription; new Log("OnlinePay").Write(errorMessage); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } else { Response.Write("OK"); errorMessage = "007在线充值:充值完成!"; new Log("OnlinePay").Write(errorMessage); Response.Redirect(Shove._Web.Utility.GetUrl() + "/Home/Room/OnlinePay/OK.aspx?BuyID=" + Attach); return; } } else { errorMessage = "007在线充值:充值未完成。错误描述:用户不存在!"; new Log("OnlinePay").Write(errorMessage); Response.Redirect(Shove._Web.Utility.GetUrl() + "/Home/Room/OnlinePay/OK.aspx?BuyID=" + Attach); return; } } }