Files
g.hnyhua.cn/Mtxfw.shop/Member_CurrencyTransfer.aspx.cs
2026-02-07 15:48:27 +08:00

269 lines
11 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace Mtxfw.VipSite
{
public partial class Member_CurrencyTransfer : Mtxfw.Utility.MemberBase
{
public Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
public Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
Mtxfw.DAL.user_bank daoBank = new Mtxfw.DAL.user_bank();
public string strtit = "消费币";
#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);
if (!IsPostBack)
{
try
{
if (Session["IFPassword"] == null)
{
Response.Redirect("/Member_IFPassword.aspx?Url=/Member_CurrencyTransfer.aspx");
}
int t = 0;
if (!String.IsNullOrEmpty(Request.QueryString["t"]))
{
t = Convert.ToInt32(Request.QueryString["t"].ToString());
}
Page.Title = strtit + "转账 - " + GetWebName;
Mtxfw.Model.user_info model = daoUser.GetModel(Card);
if (model != null)
{
if (model.uLevel10 == 1)
{
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('您的账户不能转账!');location.replace('/Member_Index.aspx')</script>");
}
Double ktCurrency = (model.umoney28 - model.umoney29);
text_Integral.Text = ktCurrency.ToString("f2");
}
}
catch
{
}
}
Btn_Insert.Click += Insert_Info;
}
protected void Insert_Info(object s, EventArgs ex)
{
Btn_Insert.Enabled = false;
Btn_Insert.Text = "提交中...";
bool b = true;
if (text_UserName.Text.Trim() == "")
{
b = false;
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('对方账户不能为空!')</script>");
Btn_Insert.Enabled = true;
Btn_Insert.Text = "确定转账";
}
int UserId = 0;
string SuperiorsIDS = "";
SqlDataReader Dr = daoUser.GetUserId(text_UserName.Text);
if (Dr.HasRows)
{
if (Dr.Read())
{
UserId = int.Parse(Dr["Id"].ToString());
SuperiorsIDS = Dr["SuperiorsIDS"].ToString();
}
}
Dr.Close();
Mtxfw.Model.user_info umodel = daoUser.GetModel(Card);
if (umodel != null)
{
if (UserId == 0)
{
if (b)
{
b = false;
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('转入金额的账户不存在,请换一个再试!')</script>");
Btn_Insert.Enabled = true;
Btn_Insert.Text = "确定转账";
}
}
else
{
if (b)
{
if (UserId == Card)
{
b = false;
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('转入金额的账户不能是自己的账户!')</script>");
Btn_Insert.Enabled = true;
Btn_Insert.Text = "确定转账";
}
}
if (b)
{
if (Text_Integralto.Text.Trim() == "")
{
b = false;
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('转入金额不能为空!')</script>");
Btn_Insert.Enabled = true;
Btn_Insert.Text = "确定转账";
}
}
try
{
if (b)
{
if (umodel.uLevel10 == 1)
{
b = false;
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('您的账户不能转账!');location.replace('/Member_Index.aspx')</script>");
Btn_Insert.Enabled = true;
Btn_Insert.Text = "确定转账";
}
}
if (b)
{
if (Convert.ToDouble(Convert.ToDouble(Text_Integralto.Text).ToString("f2")) <= 0.00)
{
b = false;
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('转入金额不能小于0')</script>");
Btn_Insert.Enabled = true;
Btn_Insert.Text = "确定转账";
}
}
Double ktCurrency = 0.00;
ktCurrency = (umodel.umoney28 - umodel.umoney29);
text_Integral.Text = ktCurrency.ToString("f2");
if (b)
{
if (Convert.ToDouble(Convert.ToDouble(Text_Integralto.Text).ToString("f2")) > Convert.ToDouble(Convert.ToDouble(text_Integral.Text).ToString("f2")))
{
b = false;
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('您的余额不足!')</script>");
Btn_Insert.Enabled = true;
Btn_Insert.Text = "确定转账";
}
}
}
catch
{
if (b)
{
b = false;
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('金额输入错误!')</script>");
Btn_Insert.Enabled = true;
Btn_Insert.Text = "确定转账";
}
}
/*if (SuperiorsIDS.IndexOf("," + Card + ",") == -1)
{
if (b)
{
b = false;
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('只能上下转账!')</script>");
Btn_Insert.Enabled = true;
Btn_Insert.Text = "确定转账";
}
}*/
if (Mtxfw.Utility.Security.EncryptString(Text_mm.Text) != umodel.Password2)
{
if (b)
{
b = false;
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('二级密码输入错误哦!')</script>");
Btn_Insert.Enabled = true;
Btn_Insert.Text = "确定转账";
}
}
}
if (b && IsRefresh == false)
{
Double money = Convert.ToDouble(Text_Integralto.Text);
Double umoney28 = (umodel.umoney28 - umodel.umoney29);
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = Card;
mjl2.MemberId2 = UserId;
mjl2.Addmoney = 0;
mjl2.Cutmoney = -money;
mjl2.Totalmoney = umoney28 - money;
mjl2.addtime = DateTime.Now;
mjl2.BZContent = "消费币转账";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 0;
mjl2.utype2 = 3;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
new DAL.user_Results_jl2().Add(mjl2);
daoUser.UpdateMoney("umoney29", money, Card);
string strumoney28 = new DAL.user_info().Getzd("(umoney28-umoney29) as umoney28", "UserState='正常' And ID=" + UserId).ToString();
if (strumoney28 != "")
{
umoney28 = Convert.ToDouble(strumoney28);
}
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = UserId;
mjl2.MemberId2 = Card;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = umoney28 + money;
mjl2.addtime = DateTime.Now;
mjl2.BZContent = umodel.UserName + "转账";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 0;
mjl2.utype2 = 3;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
new DAL.user_Results_jl2().Add(mjl2);
daoUser.UpdateMoney("umoney28", money, UserId);
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('转账成功!');location.replace('" + Request.Url.ToString() + "')</script>");
}
}
}
}
}