//批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("sys_manager", ActionEnum.Delete.ToString()); //检查权限
     BLL.ManagerBll bll = new BLL.ManagerBll();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked && GetAdminInfo().id != id)
         {
             bll.Delete(id);
         }
     }
     JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("manager_list.aspx", "keywords={0}", this.keywords), "Success");
 }
 private void RptBind(string _strWhere, string _orderby)
 {
     this.page = SysRequest.GetQueryInt("page", 1);
     this.txtKeywords.Text = this.keywords;
     BLL.ManagerBll bll = new BLL.ManagerBll();
     this.rptList.DataSource = bll.GetPageList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
     this.rptList.DataBind();
     //绑定页码
     txtPageNum.Text = this.pageSize.ToString();
     string pageUrl = Utils.CombUrlTxt("list.aspx", "keywords={0}&page={1}", this.keywords, "__id__");
     PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
 }
 /// <summary>
 /// 判断管理员是否已经登录(解决Session超时问题)
 /// </summary>
 public bool IsAdminLogin()
 {
     //如果Session为Null
     if (Session[SysKeys.SESSION_ADMIN_INFO] != null)
     {
         return true;
     }
     else
     {
         //检查Cookies
         string adminname = Utils.GetCookie("AdminName", "HZRFID"); //解密用户名
         string adminpwd = Utils.GetCookie("AdminPwd", "HZRFID");
         if (adminname != "" && adminpwd != "")
         {
             BLL.ManagerBll bll = new BLL.ManagerBll();
             Entity.Manager model = bll.GetEntityByNameAndPwd(adminname, adminpwd);
             if (model != null)
             {
                 Session[SysKeys.SESSION_ADMIN_INFO] = model;
                 return true;
             }
         }
     }
     return false;
 }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string userName = txtUserName.Text.Trim();
            string userPwd = txtUserPwd.Text.Trim();
            string code = txtCode.Text.Trim();

            if (userName.Equals("") || userPwd.Equals(""))
            {
                lblTip.Visible = true;
                lblTip.Text = "请输入用户名或密码";
                return;
            }
            if (code.Equals(""))
            {
                lblTip.Visible = true;
                lblTip.Text = "请输入验证码";
                return;
            }
            if (Session[SysKeys.SESSION_CODE] == null)
            {
                lblTip.Visible = true;
                lblTip.Text = "系统找不到验证码";
                return;
            }
            if (code.ToLower() != Session[SysKeys.SESSION_CODE].ToString().ToLower())
            {
                lblTip.Visible = true;
                lblTip.Text = "验证码输入不正确";
                return;
            }
            BLL.ManagerBll bll = new BLL.ManagerBll();
            Entity.Manager model = bll.GetEntityByNameAndPwd(userName, DESEncrypt.Encrypt(userPwd));
            if (model == null)
            {
                lblTip.Visible = true;
                lblTip.Text = "用户名或密码有误";
                return;
            }
            Session[SysKeys.SESSION_ADMIN_INFO] = model;
            Session.Timeout = 45;
            //写入登录日志
            Entity.siteconfig siteConfig = new BLL.siteconfigBll().loadConfig(Utils.GetXmlMapPath(SysKeys.FILE_SITE_XML_CONFING));
            if (siteConfig.logstatus > 0)
            {
                Entity.manager_log modelLog = new Entity.manager_log();
                modelLog.user_id = model.ID;
                modelLog.user_name = model.UserName;
                modelLog.action_type = "login";
                modelLog.note = "用户登录";
                modelLog.login_ip = SysRequest.GetIP();
                modelLog.login_time = DateTime.Now;
                new BLL.manager_log().Add(modelLog);
            }
            //写入Cookies
            if (cbRememberId.Checked)
            {
                Utils.WriteCookie("DTRememberName", model.UserName, 14400);
            }
            else
            {
                Utils.WriteCookie("DTRememberName", model.UserName, -14400);
            }
            Utils.WriteCookie("AdminName", "DTcms", model.UserName);
            Utils.WriteCookie("AdminPwd", "DTcms", model.UserPassword);
            Response.Redirect("index.aspx");
            return;
        }