示例#1
0
        /// <summary>
        /// 高级管理员修改管理员信息
        /// </summary>
        protected void btnAlter_Click(object sender, EventArgs e)
        {
            SA           mSa           = new SA();
            SAController mSaController = new SAController();

            //传进UserName的值
            if (Session["UserName"] != null)
            {
                mSa.UserName = Session["UserName"].ToString();
                mSa.PassWord = this.txtPassword.Text;
                switch (this.txtAdministratorClass.Text)
                {
                case "订单管理员":
                    mSa.StaffType = '2';
                    break;

                case "评价管理员":
                    mSa.StaffType = '3';
                    break;

                case "用户管理员":
                    mSa.StaffType = '4';
                    break;

                case "商品管理员":
                    mSa.StaffType = '5';
                    break;

                default:
                    //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "您输入的管理员类型无效!请重新输入!" + "');</script> ");
                    break;
                }
                if (mSaController.AlterAdmin(mSa) == true)
                {
                    this.lblCheck.Text = "修改成功!";
                    //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "修改成功!" + "');</script> ");
                    //在日志表中记录此次操作
                    mDayBook.StaffID        = mAdminController.GetStaffID(mSa, mSa.UserName);
                    mDayBook.UserName       = mSa.UserName;
                    mDayBook.HandleTime     = DateTime.Now.ToString();
                    mDayBook.HandleObjects  = "普通管理员:" + this.txtStaffName.Text;
                    mDayBook.DayBookVersion = "2";
                    mDayBookController.AddDayBook(mDayBook);
                }
                else
                {
                    this.lblCheck.Text = "修改失败!请重新操作!";
                    //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "修改失败!请重新操作!" + "');</script> ");
                }
            }
        }
示例#2
0
 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);
             }
         }
     }
 }