1 Star 3 Fork 0

Admin/MyWebSms

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
forbidadd.aspx.cs 2.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;
public partial class forbidadd : WebPage
{
public string CurUrl = "";
public string action = "";
public string getid = "";
protected void Page_Load(object sender, EventArgs e)
{
this.VerifyPage();
try
{
action = Request.QueryString.Get("act");
CurUrl = Request.QueryString.Get("url");
getid = Request.QueryString.Get("id");
}
catch
{ }
if (!Page.IsPostBack)
{
if (action == "edit")
{
BindData();
}
}
}
public void BindData()
{
Forbid fb = new Forbid();
fb.ID = int.Parse(getid);
this.dxcontent.Text = fb.Select_(fb).Name;
this.dxtype.SelectedValue = fb.Select_(fb).State.ToString();
}
public void InsertData()
{
string _DxContent = dxcontent.Text;
int _DxType = int.Parse(dxtype.SelectedValue);
Forbid fb = new Forbid();
fb.Name = _DxContent;
fb.State = _DxType;
fb.SendTime = DateTime.Now.ToString();
if (CurUrl != "")
{
bool tmd = fb.VerForbid(fb);
if (tmd)
{
ShowMsg("此短语已经存在,不必重复添加!", Page);
}
else
{
if (fb.Insert(fb))
{
ShowMsgAndCloseAndLocation("短语添加成功。", CurUrl, Page);
}
else
{
ShowMsg("短语添加失败,请重新来过!", Page);
}
}
}
}
public void UpdateData()
{
int _dxtype = int.Parse(dxtype.SelectedValue);
string _DxContent = dxcontent.Text;
Forbid fb = new Forbid();
fb.ID = int.Parse(getid);
fb.Name = _DxContent;
fb.State = _dxtype;
if (CurUrl != "")
{
bool tmd = fb.VerForbid(fb);
if (tmd)
{
ShowMsg("此短语已经存在,不必重复添加!", Page);
}
else
{
if (fb.Update(fb))
{
ShowMsgAndCloseAndLocation("短语修改成功。", CurUrl, Page);
}
else
{
ShowMsg("短语修改失败,请重新来过!", Page);
}
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (action == "add")
{
InsertData();
}
else if(action == "edit")
{
UpdateData();
}
}
}
马建仓 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

搜索帮助

D67c1975 1850385 1daf7b77 1850385