1 Star 3 Fork 0

Admin/MyWebSms

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
chongzhi.aspx.cs 3.91 KB
一键复制 编辑 原始数据 按行查看 历史
Ai鹿子 提交于 2022-04-24 10:09 . 01
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);
}
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/huanghe_1_0/my-web-sms.git
git@gitee.com:huanghe_1_0/my-web-sms.git
huanghe_1_0
my-web-sms
MyWebSms
master

搜索帮助