protected void sureBtn_Click(object sender, EventArgs e) { string adminN = this.adminName.Text; string adminOldP = this.adminOldPwd.Text; string adminNewP = this.adminPwd.Text; string adminNewPA = this.adminPwdAgain.Text; BLL.adminTb adminBll = new BLL.adminTb(); List<Model.adminTb> adminM = adminBll.GetModelList("adminName='"+adminN+"'"); foreach (var adminOne in adminM) { if (adminNewP=="" || adminNewPA=="") { //Response.Write("<script language=javascript>alert('新密码不能为空!');</" + "script>"); ScriptManager.RegisterStartupScript(addBtn, this.GetType(), "showErrorAlert", "showErrorAlert('新密码不能为空!');", true); return; } if (adminOldP!=adminOne.adminPwd) { ScriptManager.RegisterStartupScript(addBtn, this.GetType(), "showErrorAlert", "showErrorAlert('您输入的原密码有误,请重新输入!');", true); // Response.Write("<script language=javascript>alert('您输入的原密码有误,请重新输入!');</" + "script>"); this.adminOldPwd.Text = ""; return; } if (adminNewP!=adminNewPA) { ScriptManager.RegisterStartupScript(addBtn, this.GetType(), "showErrorAlert", "showErrorAlert('两次输入密码不一致!请重新输入!');", true); //Response.Write("<script language=javascript>alert('两次输入密码不一致!请重新输入!');</" + "script>"); return; } adminOne.adminPwd = adminNewP; adminBll.Update(adminOne); ScriptManager.RegisterStartupScript(addBtn, this.GetType(), "showSuccessAlert", "showSuccessAlert('密码更新成功!');", true); //Response.Write("<script language=javascript>alert('密码更新成功!');</" + "script>"); } }
protected void Page_Load(object sender, EventArgs e) { BLL.adminTb adminAllN = new BLL.adminTb(); List<Model.adminTb> adminM = adminAllN.GetModelList("adminLevel=1"); this.gvAdminAll.DataSource = adminM; this.gvAdminAll.DataBind(); }
public List<Model.adminTb> selectAdminName() { BLL.adminTb bllAdmin = new BLL.adminTb(); List<Model.adminTb> admins = bllAdmin.GetModelList("adminLevel=1"); return admins; }
public void deletAdmin(int adminid) { try { BLL.adminTb bllAdmin = new BLL.adminTb(); bllAdmin.Delete(adminid); } catch (Exception) { throw; } }
protected void addBtn_Click(object sender, EventArgs e) { string adminN = this.adminName.Text; string adminPwd = this.adminPwd.Text; string adminPwdA = this.adminPwdAgain.Text; if (adminN == "") { ScriptManager.RegisterStartupScript(addBtn, this.GetType(), "showErrorAlert", "showErrorAlert('请输入新管理员账号!');", true); return; } if (adminPwd == "" || adminPwdA == "") { ScriptManager.RegisterStartupScript(addBtn, this.GetType(), "showErrorAlert", "showErrorAlert('密码不能为空!');", true); return; } if (adminPwd != adminPwdA) { ScriptManager.RegisterStartupScript(addBtn, this.GetType(), "showErrorAlert", "showErrorAlert('两次输入密码不一致,请重新输入!');", true); return; } BLL.adminTb admin = new BLL.adminTb(); List<Model.adminTb> adminLi = admin.GetModelList("adminLevel=1"); foreach (var adminOne in adminLi) { if (adminOne.adminName == adminN) { ScriptManager.RegisterStartupScript(addBtn, this.GetType(), "showErrorAlert", "showErrorAlert('系统中已经存在该用户!');", true); return; } } Model.adminTb adminMd = new Model.adminTb(); adminMd.adminName = adminN; adminMd.adminPwd = adminPwd; adminMd.adminEmail = "无"; adminMd.adminLevel = 1; admin.Add(adminMd); System.Web.UI.ScriptManager.RegisterStartupScript(addBtn, this.GetType(), "showSuccessAlert", "showSuccessAlert('成功添加该管理员!');", true); this.adminName.Text = ""; this.adminPwd.Text = ""; this.adminPwdAgain.Text = ""; }
protected void modityBtn_Click(object sender,EventArgs e) { string adminN = this.adminName.Text; //Response.Write("<script language=javascript>alert(" + adminN + ");</" + "script>"); string adminPwd = this.adminPwd.Text; string adminPwdA = this.adminPwdAgain.Text; if (adminN == "") { ScriptManager.RegisterStartupScript(addBtn, this.GetType(), "showErrorAlert", "showErrorAlert('请输入新管理员账号!');", true); return; } if (adminPwd == "" || adminPwdA == "") { ScriptManager.RegisterStartupScript(addBtn, this.GetType(), "showErrorAlert", "showErrorAlert('密码不能为空!');", true); return; } if (adminPwd != adminPwdA) { ScriptManager.RegisterStartupScript(addBtn, this.GetType(), "showErrorAlert", "showErrorAlert('两次输入密码不一致,请重新输入!');", true); return; } BLL.adminTb admin = new BLL.adminTb(); List<Model.adminTb> adminLi = admin.GetModelList("adminLevel=1"); foreach (var adminOne in adminLi) { if (adminOne.adminName == adminN) { ScriptManager.RegisterStartupScript(addBtn, this.GetType(), "showErrorAlert", "showErrorAlert('系统中已经存在该用户!');", true); return; } } adminM.adminName = adminN; adminM.adminPwd = adminPwd; admin.Update(adminM); System.Web.UI.ScriptManager.RegisterStartupScript(addBtn, this.GetType(), "showSuccessAlert", "showSuccessAlert('成功修改该管理员信息,3秒钟后将跳转到查看管理员信息页面!');", true); //System.Threading.Thread.Sleep(3000); //Response.Redirect("superSeeAdminInfo.aspx"); }
protected void addBtn_Click(object sender, EventArgs e) { string adminName = this.adminName.Text; string adminPwd = this.adminPwd.Text; string adminPwdA = this.adminPwdAgain.Text; if (adminName=="") { Response.Write("<script language=javascript>alert('请输入新管理员账号!');</" + "script>"); return; } if (adminPwd=="" || adminPwdA=="") { Response.Write("<script language=javascript>alert('密码不能为空!');</" + "script>"); return; } if (adminPwd != adminPwdA) { Response.Write("<script language=javascript>alert('两次输入密码不一致!请重新输入!');</" + "script>"); return; } BLL.adminTb admin = new BLL.adminTb(); List<Model.adminTb> adminLi = admin.GetModelList("adminLevel=1"); foreach (var adminOne in adminLi) { if (adminOne.adminName==adminName) { Response.Write("<script language=javascript>alert('系统中已经存在该用户');</" + "script>"); return; } } Model.adminTb adminMd = new Model.adminTb(); adminMd.adminName = adminName; adminMd.adminPwd = adminPwd; adminMd.adminEmail = "无"; adminMd.adminLevel = 1; admin.Add(adminMd); this.adminName.Text = ""; this.adminPwd.Text = ""; this.adminPwdAgain.Text = ""; }
protected void btnOK_Click(object sender, EventArgs e) { string no = this.txtQ.Text.ToString(); string pwd = this.pwdQ.Text.ToString(); BLL.adminTb blladmin = new BLL.adminTb(); if (no == "" || pwd == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language=javascript>alert('用户名与密码不能为空,请重新输入!');</script>", false); return; } List<Model.adminTb> modadmin = blladmin.GetModelList("adminName='" + no + "'"); //modadmin = blladmin.GetModel(Convert.ToInt32(no)); foreach(Model.adminTb modadmin1 in modadmin ) { if (modadmin1.adminPwd != pwd) { //this.txtQ.Text = ""; this.pwdQ.Text = ""; Page.ClientScript.RegisterStartupScript(this.GetType (),"","<script type='text/javascript'>alert('用户名与密码不匹配,请重新输入!');</script>",false); return; } Session["no"] = no; Session["pwd"] = pwd; if (modadmin1.adminLevel == 0) { Response.Redirect("superSeeAdminInfo.aspx"); } else { Response.Redirect("adminModifyInfo.aspx"); } } Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('账号不存在,请重新输入!');</script>", false); this.txtQ.Text = ""; this.pwdQ.Text = ""; }
public void bindData(int pageIn,string selectWhere) { BLL.adminTb bllAdmin = new BLL.adminTb(); List<Model.adminTb> admins = bllAdmin.GetModelList(selectWhere); PagedDataSource pds = new PagedDataSource(); pds.DataSource = admins; pds.PageSize =6; pds.AllowPaging = true; pds.CurrentPageIndex = pageIn; this.gvSuperAdminSeeInfo.DataSource = pds; this.gvSuperAdminSeeInfo.DataBind(); int pageCount = pds.PageCount; StringBuilder html = new StringBuilder(""); html.Append("<a class='pageA pageStart' href='superSeeAdminInfo.aspx?pageInd=0'>首页</a>"); for (int i = 0; i < pageCount; i++) { html.Append("<a class='pageA pageNum pageA"+(i+1).ToString()+"' href='superSeeAdminInfo.aspx?pageInd=" + i.ToString() + "'>" + (i + 1).ToString() + "</a>"); } html.Append("<a class='pageA pageStart' href='superSeeAdminInfo.aspx?pageInd=" + (pageCount - 1).ToString() + "'>尾页</a>"); this.dgvpage.InnerHtml = html.ToString(); ScriptManager.RegisterStartupScript(searchBtn, this.GetType(), "clickPage", "clickPage("+(pageIn+1).ToString()+");", true); }
protected void search_Click(object sender, EventArgs e) { string searchT = this.searchText.Text; if (searchT=="") { ScriptManager.RegisterStartupScript(searchBtn, this.GetType(), "showErrorAlert", "showErrorAlert('请输入关键字!');", true); return; } try { BLL.adminTb bllAdmin = new BLL.adminTb(); List<Model.adminTb> admins = bllAdmin.GetModelList("adminLevel=1 and adminName like '%" + searchT + "%'"); if (admins.Count == 0) { ScriptManager.RegisterStartupScript(searchBtn, this.GetType(), "showNoticeAlert", "showNoticeAlert('没有您要找的管理员!');", true); return; } //ScriptManager.RegisterStartupScript(searchBtn, this.GetType(), "showErrorAlert", "showErrorAlert('输入关键字"+searchT+"!');", true); bindData(0, "adminLevel=1 and adminName like '%"+searchT+"%'"); } catch (Exception) { ScriptManager.RegisterStartupScript(searchBtn, this.GetType(), "showErrorAlert", "showErrorAlert('发生错误,请重新输入关键字!');", true); } }