164 lines
6.9 KiB
C#
164 lines
6.9 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using System.Text;
|
||
|
||
namespace Mtxfw.shop
|
||
{
|
||
public partial class Member_Currencyto : 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();
|
||
|
||
#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)
|
||
{
|
||
Page.Title = "消费币转换成积分 - " + GetWebName;
|
||
Mtxfw.Model.user_info umodel = daouser.GetModel(Card);
|
||
if (umodel != null)
|
||
{
|
||
if (umodel.uLevel8 == 1)
|
||
{
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('账户被冻结!');location.replace('/Member_Index.aspx');</script>");
|
||
}
|
||
|
||
text_Integral.Text = (umodel.umoney28 - umodel.umoney29).ToString("f2");
|
||
|
||
Label_JF.Text = (umodel.umoney28 - umodel.umoney29).ToString("f2");
|
||
}
|
||
|
||
}
|
||
|
||
Btn_Save.Click += delegate(object s, EventArgs ex)
|
||
{
|
||
Btn_Save.Enabled = false;
|
||
Btn_Save.Text = "提交中...";
|
||
bool b=true;
|
||
|
||
if (Text_Pay.Text.Trim() == "")
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('转换金额不能为空!');</script>");
|
||
}
|
||
Mtxfw.Model.user_info umodel = daouser.GetModel(Card);
|
||
if (umodel != null)
|
||
{
|
||
if (b)
|
||
{
|
||
if (Text_Pay.Text.Trim() != "")
|
||
{
|
||
try
|
||
{
|
||
if (Convert.ToDouble(Convert.ToDouble(Text_Pay.Text).ToString("f2")) < 0.00)
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('转换金额不能少于0!');</script>");
|
||
}
|
||
Label_JF.Text = (umodel.umoney28 - umodel.umoney29).ToString("f2");
|
||
if (b)
|
||
{
|
||
if (Convert.ToDouble(Text_Pay.Text) > Convert.ToDouble(Label_JF.Text))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('消费币余额不足!');</script>");
|
||
}
|
||
}
|
||
}
|
||
catch
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('转换金额填写错误!');</script>");
|
||
}
|
||
}
|
||
}
|
||
if (b && IsRefresh == false)
|
||
{
|
||
//daouser.UpdatePhoneTime3("", Card);
|
||
Double money = Convert.ToDouble(Text_Pay.Text);
|
||
Double umoney28 = (umodel.umoney28 - umodel.umoney29);
|
||
Double umoney30 = (umodel.umoney30 - umodel.umoney31);
|
||
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
|
||
mjl2.MemberId = Card;
|
||
mjl2.MemberId2 = 0;
|
||
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 = 4;
|
||
mjl2.Seef = -1;
|
||
mjl2.seeftime = DateTime.Now;
|
||
new DAL.user_Results_jl2().Add(mjl2);
|
||
mjl2 = new Model.user_Results_jl2();
|
||
mjl2.MemberId = Card;
|
||
mjl2.MemberId2 = 0;
|
||
mjl2.Addmoney = money;
|
||
mjl2.Cutmoney = 0;
|
||
mjl2.Totalmoney = umoney30 + money;
|
||
mjl2.addtime = DateTime.Now;
|
||
mjl2.BZContent = "把消费币转换成积分";
|
||
mjl2.PayID = "";
|
||
mjl2.OrdersIDs = "";
|
||
mjl2.OrdersID = 0;
|
||
mjl2.utype = 1;
|
||
mjl2.utype2 = 0;
|
||
mjl2.Seef = -1;
|
||
mjl2.seeftime = DateTime.Now;
|
||
new DAL.user_Results_jl2().Add(mjl2);
|
||
daouser.UpdateMoney("umoney29", money, Card);
|
||
daouser.UpdateMoney("umoney30", money, Card);
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('提交成功!');location.replace('"+ Request.Url.AbsoluteUri+"');</script>");
|
||
}
|
||
else
|
||
{
|
||
Btn_Save.Enabled = true;
|
||
Btn_Save.Text = "确认提交";
|
||
}
|
||
}
|
||
};
|
||
}
|
||
|
||
|
||
}
|
||
} |