229 lines
9.6 KiB
C#
229 lines
9.6 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using System.Text;
|
||
using System.Globalization;
|
||
using System.Security.Cryptography;
|
||
using System.Security.Cryptography.X509Certificates;
|
||
namespace Mtxfw.shop
|
||
{
|
||
public partial class Member_CurrencyRecharge : Mtxfw.Utility.MemberBase
|
||
{
|
||
|
||
Mtxfw.DAL.user_bank daoBank = new Mtxfw.DAL.user_bank();
|
||
Mtxfw.DAL.user_info daouser = new Mtxfw.DAL.user_info();
|
||
Mtxfw.DAL.user_Results_jl2 daoResults2 = new Mtxfw.DAL.user_Results_jl2();
|
||
public Mtxfw.Utility.Config Config = new Mtxfw.Utility.Config();
|
||
public string IFApp = "0";
|
||
|
||
|
||
|
||
#region 判断页面是否刷新
|
||
private bool _refreshState;
|
||
private bool _isRefresh;
|
||
|
||
/// <summary>
|
||
/// 判断页面是否刷新
|
||
/// </summary>
|
||
public bool IsRefresh
|
||
{
|
||
get
|
||
{
|
||
return _isRefresh;
|
||
}
|
||
}
|
||
protected override void LoadViewState(object savedState)
|
||
{
|
||
object[] allStates = (object[])savedState;
|
||
base.LoadViewState(allStates[0]);
|
||
_refreshState = (bool)allStates[1];
|
||
_isRefresh = _refreshState == (bool)Session["__ISREFRESH"];
|
||
}
|
||
protected override object SaveViewState()
|
||
{
|
||
Session["__ISREFRESH"] = _refreshState;
|
||
object[] allStates = new object[2];
|
||
allStates[0] = base.SaveViewState();
|
||
allStates[1] = !_refreshState;
|
||
return allStates;
|
||
}
|
||
#endregion
|
||
protected override void OnLoad(EventArgs e)
|
||
{
|
||
base.OnLoad(e);
|
||
string str_u = Request.ServerVariables["HTTP_USER_AGENT"];
|
||
//Response.Write(str_u);
|
||
/*if (str_u.IndexOf("MicroMessenger") != -1)
|
||
{
|
||
//微信访问
|
||
IFApp = "1";
|
||
}*/
|
||
if (!Page.IsPostBack)
|
||
{
|
||
if (IFApp == "1")
|
||
{
|
||
//alipay_Panel.Visible = false;
|
||
weixinpay_Panel.Visible = true;
|
||
}
|
||
else
|
||
{
|
||
//alipay_Panel.Visible = true;
|
||
weixinpay_Panel.Visible = false;
|
||
}
|
||
Page.Title = "充值申请 - " + GetWebName;
|
||
Text_PayType.Attributes.Add("onchange", "payonchange()");
|
||
|
||
|
||
|
||
}
|
||
Btn_Save.Click += delegate(object s, EventArgs ex)
|
||
{
|
||
try
|
||
{
|
||
Btn_Save.Enabled = false;
|
||
Btn_Save.Text = "提交中...";
|
||
bool b = true;
|
||
|
||
if (b)
|
||
{
|
||
if (Text_Pay.Text.Trim() == "")
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('充值金额不能为空!');</script>");
|
||
}
|
||
}
|
||
if (b)
|
||
{
|
||
if (Text_Pay.Text.Trim() != "")
|
||
{
|
||
if (Convert.ToDouble(Text_Pay.Text) < 0)
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('充值金额不能小于0!');</script>");
|
||
}
|
||
}
|
||
}
|
||
if (b)
|
||
{
|
||
if (Text_PayType.SelectedItem.Value != "2" && Text_PayType.SelectedItem.Value != "3")
|
||
{
|
||
if (Text_Bank.Text.Trim() == "")
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('银行卡号后四位不能为空!');</script>");
|
||
}
|
||
else
|
||
{
|
||
try
|
||
{
|
||
int bank = int.Parse(Text_Bank.Text);
|
||
}
|
||
catch
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('银行卡号只能填写四位数字!');</script>");
|
||
}
|
||
if (Text_Bank.Text.Length != 4)
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('银行卡号只能填写四位数字!');</script>");
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
if (b && IsRefresh == false)
|
||
{
|
||
Mtxfw.Model.user_info umodel = daouser.GetModel(Card);
|
||
if (umodel != null)
|
||
{
|
||
int PayType = int.Parse(Text_PayType.SelectedItem.Value);
|
||
string strPayType = Mtxfw.Utility.Common.GetPayType(PayType);
|
||
|
||
DateTime dt = DateTime.Now;
|
||
string PayID = dt.ToString("yyyyMMddhhmmssffff", DateTimeFormatInfo.InvariantInfo);
|
||
Double money = Convert.ToDouble(Text_Pay.Text);
|
||
Double umoney12 = (umodel.umoney12 - umodel.umoney22);
|
||
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
|
||
mjl2.MemberId = Card;
|
||
mjl2.MemberId2 = 0;
|
||
mjl2.Addmoney = money;
|
||
mjl2.Cutmoney = 0;
|
||
mjl2.Totalmoney = umoney12 + money;
|
||
mjl2.addtime = DateTime.Now;
|
||
mjl2.BZContent = "[" + strPayType + "" + (PayType == 0 || PayType == 1 ? " 银行卡号后四位:" + Text_Bank.Text : "") + "]" + Text_conent.Text;
|
||
mjl2.PayID = PayID;
|
||
mjl2.OrdersIDs = "";
|
||
mjl2.OrdersID = 0;
|
||
mjl2.utype = 2;
|
||
mjl2.utype2 = 1;
|
||
mjl2.Seef = 0;
|
||
mjl2.seeftime = DateTime.Now;
|
||
new DAL.user_Results_jl2().Add(mjl2);
|
||
|
||
if (Text_PayType.SelectedItem.Value == "3")
|
||
{
|
||
string orderAmount = "", pay_bank = "00";
|
||
|
||
orderAmount = (Convert.ToDouble(Text_Pay.Text)*100).ToString("f0");
|
||
if (!String.IsNullOrEmpty(Request.Form["pay_bank"]))
|
||
{
|
||
pay_bank = Request.Form["pay_bank"].ToString();
|
||
}
|
||
Response.Redirect("/pay/kqpay.aspx?oids=" + PayID + "&t=0&amount=" + orderAmount + (pay_bank != "" ? "&pay_bank=" + pay_bank : ""));
|
||
/*if (IFApp == "1")
|
||
{
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>top.location='/pay/wxpay.aspx?je=" + Convert.ToDecimal(orderAmount).ToString("f0") + "&t=0&billbo=" + PayID + "';</script>");
|
||
}
|
||
else
|
||
{
|
||
Response.Redirect("/pay/alipay.aspx?oids=" + PayID + "&t=0&amount=" + orderAmount + (pay_bank != "" ? "&pay_bank=" + pay_bank : ""));
|
||
}*/
|
||
}
|
||
else
|
||
{
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('提交成功!');location.replace('/Member_CurrencyRecharge.aspx');</script>");
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Btn_Save.Enabled = true;
|
||
Btn_Save.Text = "确认提交";
|
||
}
|
||
}
|
||
catch
|
||
{
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('操作错误!');</script>");
|
||
}
|
||
};
|
||
}
|
||
|
||
|
||
//功能函数。将变量值不为空的参数组成字符串
|
||
#region 字符串串联函数
|
||
public string appendParam(string returnStr, string paramId, string paramValue)
|
||
{
|
||
if (returnStr != "")
|
||
{
|
||
if (paramValue != "")
|
||
{
|
||
returnStr += "&" + paramId + "=" + paramValue;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (paramValue != "")
|
||
{
|
||
returnStr = paramId + "=" + paramValue;
|
||
}
|
||
}
|
||
return returnStr;
|
||
}
|
||
#endregion
|
||
|
||
|
||
}
|
||
} |