AdminController mAdminController = new AdminController(); //管理员方法对象 /// <summary> /// 激活管理员 /// </summary> protected void btnActive_Click(object sender, EventArgs e) { mSa.UserName = this.tbxUserName.Text; mSa.StaffType = (this.dplStaffType.SelectedValue).ToCharArray()[0]; //判断此用户名是否存在 if (mSaController.AdminRegistText(mSa) == true) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "此用户名不存在!" + "');</script> "); } else { //判断此用户名是否被激活过 if (mSaController.AdminStaffType(mSa) != "9") { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "此用户名已被激活!" + "');</script> "); } else { if (Session["hUserName"] != null) { mSaLogin.UserName = Session["hUserName"].ToString(); mSaController.ActiveAdmin(mSa); this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "激活成功!" + "');</script> "); divide mdv = new divide(); //数据重新绑定更新页面数据 this.AdminList.DataSource = mdv.AdminShow(Convert.ToInt32(ViewState["surrentPage"])); this.AdminList.DataBind(); //在日志表中记录此次操作 mDayBook.StaffID = mAdminController.GetStaffID(mSaLogin, mSaLogin.UserName); mDayBook.UserName = mSaLogin.UserName; mDayBook.HandleTime = DateTime.Now.ToString(); mDayBook.HandleObjects = "普通管理员:" + mSa.UserName; mDayBook.DayBookVersion = "1"; mDayBookController.AddDayBook(mDayBook); } } } }