代码拉取完成,页面将自动刷新
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using dal.tooldal;
public partial class chongzhi : WebPage
{
public int FromUserID;
public int ToUserID;
public int ToUserPID;
Users us = new Users();
protected void Page_Load(object sender, EventArgs e)
{
this.VerifyPage();
string t = "";
try
{
t = Request.QueryString.Get("c");
security m = new security();
t = m.decryptquerystring(t);
}
catch
{
Response.Redirect("Error.aspx?msg=参数错误");
}
us = us.Select(int.Parse(t));
this.txtToUser.Value = us.UserName;
this.txtToCount.Value = us.CurrentCount.ToString();
ToUserID = us.UserID;
ToUserPID = us.UserPID;
this.txtFromUser.Value = CurrentUser.UserName;
this.txtFromCount.Value = CurrentUser.CurrentCount.ToString();
FromUserID = CurrentUser.UserID;
hidprice.Value = us.PerPrice;
}
protected void btnok_Click(object sender, EventArgs e)
{
string getValue = txtTotal.Value.Trim();
int getFromUserID = FromUserID;
string getFromUserName = this.txtFromUser.Value;
string getFromCount = this.txtFromCount.Value;
int getToUserID = ToUserID;
string getToUserName = this.txtToUser.Value;
string getToCount = this.txtToCount.Value;
string getPrices = this.txtPrice.Value;
if (getValue == "")
{
this.ErrMsg.InnerHtml = "充值数为空";
}
else
{
WebPage wp = new WebPage();
bool tmd = wp.isnumeric(getValue);
if (!tmd || int.Parse(getValue) == 0)
{
this.ErrMsg.InnerHtml = "填写正整数";
this.txtTotal.Value = "";
}
else if (int.Parse(getValue) > int.Parse(getFromCount))
{
this.ErrMsg.InnerHtml = "剩余量不足";
this.txtTotal.Value = getFromCount;
}
else
{
if (ToUserPID == CurrentUser.UserID)
{
Users us = new Users();
us.UpdateTatal(getFromUserID, int.Parse(getFromCount) - int.Parse(getValue));
us.UpdateTatal(getToUserID, int.Parse(getToCount) + int.Parse(getValue));
AddRecord ar = new AddRecord();
ar.FromUserID = getFromUserID;
ar.FromUserName = getFromUserName;
ar.ToUserID = getToUserID;
ar.ToUserName = getToUserName;
ar.CDate = DateTime.Now;
ar.CNum = int.Parse(getValue);
ar.Prices = getPrices;
ar.YuanCount = int.Parse(getToCount);
ar.CurrCount = int.Parse(getToCount) + int.Parse(getValue);
ar.Ration = "充值";
int NewCurrentCount = int.Parse(getFromCount) - int.Parse(getValue);
if (ar.Insert(ar))
{
WebPage.ShowMsgAndFreshParentTotal("您给用户 " + getToUserName + " <充值>成功!", "lblCurrentCount", NewCurrentCount.ToString(), this.Page);
}
else
{
WebPage.ShowMsg("给用户 " + getToUserName + " 充值失败!", this.Page);
}
}
else
{
WebPage.ShowMsg("您不是用户 " + getToUserName + " 的上级用户,无法完成<充值>操作!", this.Page);
}
}
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。