protected void btncreateuser_Click(object sender, EventArgs e)
 {
     //创建用户的操作
     if (CheckInputForCreate())
     {
         AdminUser user = new AdminUser();
         user.ID              = AdminUserBLL.GetMaxId() + 1;//注意获取最大ID后使用时要在ID基础上+1
         user.UserID          = textboxUserId.Text;
         user.UserPwd         = MD5PWD.EnCode(textboxPwd.Text);
         user.UserCreatedDate = DateTime.Now;
         if (AdminUserBLL.CheckUserId(textboxUserId.Text))
         {
             if (AdminUserBLL.Add(user) != null)
             {
                 JqHelper.ResponseScript("alert(\"创建用户成功!\")");
                 GetAdmins();
             }
             else
             {
                 JqHelper.ResponseScript("alert(\"创建失败,请重新尝试!\")");
             }
         }
         else
         {
             JqHelper.ResponseScript("alert(\"该用户名已经被使用请更换一个!\")");
             textboxUserId.Text = "";
             textboxPwd.Text    = "";
             textboxUserId.Focus();
         }
     }
 }
        protected void btnChangePwd_Click(object sender, EventArgs e)
        {
            btnChangePwd.Enabled = false;
            //更改密码首先验证原始密码,
            //然后在保存用户的新密码
            AdminUser user = Session["Users"] as AdminUser;

            if (user != null && AdminUserBLL.CheckAdminUser(user.UserID, MD5PWD.EnCode(oldpwd.Text)))
            {
                //验证旧的密码成功

                if (new AdminUserBLL().SavaNewPwd(user.ID.ToString(), MD5PWD.EnCode(newpwd.Text)) > 0)
                {
                    JqHelper.ResponseScript("alert(\"修改密码成功!\")");
                }
                else
                {
                    JqHelper.ResponseScript("alert(\"修改密码失败!\")");
                }
            }
            btnChangePwd.Enabled = true;
        }
 protected void button_login_Click(object sender, EventArgs e)
 {
     //添加必填验证
     if (CheckInput())
     {
         button_login.Enabled = false;
         if (AdminUserBLL.CheckAdminUser(textbox_userId.Text, MD5PWD.EnCode(textbox_pwd.Text)))
         {
             AdminUser admin = new AdminUser();
             admin.UserID  = textbox_userId.Text;
             admin.UserPwd = MD5PWD.EnCode(textbox_pwd.Text);
             //登录按钮操作事件
             //Session["pwd"] = textbox_pwd.Text;
             admin            = new AdminUserBLL().GetByID(textbox_userId.Text);
             Session["Users"] = admin;//将用户存入到Session中
             Response.Redirect("../AdminManagerment/Index.aspx");
         }
         else
         {
             JqHelper.ResponseScript("alert(\"登录密码或用户名错误!\")");
             button_login.Enabled = true;
         }
     }
 }