温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:达达ASP.NET企业信息管理系统
当前文件路径:DaDaEnterprise/Admin/Admin_User.aspx.cs

1using System; 2
using System.Collections; 3
using System.Configuration; 4
using System.Data; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.HtmlControls; 9
using System.Web.UI.WebControls; 10
using System.Web.UI.WebControls.WebParts; 11
12
public partial class Admin_Admin_User : System.Web.UI.Page 13
{ 14
protected void Page_Load(object sender, EventArgs e) 15
{ 16
if (!IsPostBack) 17
{ 18
DataAccess.IsAdmin(); 19
string sql = "select top 5 * from [Admin]"; 20
Repeater1.DataSource = DataAccess.GetDataSet(sql); 21
Repeater1.DataBind(); 22
} 23
} 24
25
protected void Sub_Click(object sender, EventArgs e) 26
{ 27
string PassWord = FormsAuthentication.HashPasswordForStoringInConfigFile(Pwd.Text.ToString(), "MD5"); 28
string ChkPass = FormsAuthentication.HashPasswordForStoringInConfigFile(ChkPwd.Text.ToString(), "MD5"); 29
string sql = "insert into [Admin](AdminName,AdminPwd) values('" 30
+ Admin.Text + "','" + PassWord + "')"; 31
if (!String.IsNullOrEmpty(Admin.Text)) 32
{ 33
if (Pwd.Text == ChkPwd.Text) 34
{ 35
if (DataAccess.ExecuteCmd(sql) > 0) 36
{ 37
Response.Redirect("./Admin_User.aspx"); 38
} 39
else Response.Write("<script>alert('添加失败!');</script>"); 40
} 41
else Response.Write("<script>alert('两次密码不一致!');</script>"); 42
} 43
else Response.Write("<script>alert('名称不能为空!');</script>"); 44
} 45
46
protected void Del_Click(object sender, CommandEventArgs e) 47
{ 48
string id = e.CommandName; 49
string sql = "delete from [Admin] where id=" + id; 50
if (DataAccess.ExecuteCmd(sql) > 0) 51
{ 52
Response.Redirect("./Admin_User.aspx"); 53
} 54
else Response.Write("<script>alert('删除失败!');</script>"); 55
} 56
} 57





}
}