예제 #1
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            this.ChkAdminLevel(nameof(manager_list), DTEnums.ActionEnum.Delete.ToString());
            int num1 = 0;
            int num2 = 0;

            Rain.BLL.manager manager = new Rain.BLL.manager();
            for (int index = 0; index < this.rptList.Items.Count; ++index)
            {
                int int32 = Convert.ToInt32(((HiddenField)this.rptList.Items[index].FindControl("hidId")).Value);
                if (((CheckBox)this.rptList.Items[index].FindControl("chkId")).Checked)
                {
                    if (manager.Delete(int32))
                    {
                        ++num1;
                    }
                    else
                    {
                        ++num2;
                    }
                }
            }
            this.AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除管理员" + (object)num1 + "条,失败" + (object)num2 + "条");
            this.JscriptMsg("删除成功" + (object)num1 + "条,失败" + (object)num2 + "条!", Utils.CombUrlTxt("manager_list.aspx", "keywords={0}", this.keywords));
        }
예제 #2
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     Rain.BLL.manager   manager   = new Rain.BLL.manager();
     Rain.Model.manager adminInfo = this.GetAdminInfo();
     if (DESEncrypt.Encrypt(this.txtOldPassword.Text.Trim(), adminInfo.salt) != adminInfo.password)
     {
         this.JscriptMsg("旧密码不正确!", "");
     }
     else if (this.txtPassword.Text.Trim() != this.txtPassword1.Text.Trim())
     {
         this.JscriptMsg("两次密码不一致!", "");
     }
     else
     {
         adminInfo.password  = DESEncrypt.Encrypt(this.txtPassword.Text.Trim(), adminInfo.salt);
         adminInfo.real_name = this.txtRealName.Text.Trim();
         adminInfo.telephone = this.txtTelephone.Text.Trim();
         adminInfo.email     = this.txtEmail.Text.Trim();
         if (!manager.Update(adminInfo))
         {
             this.JscriptMsg("保存过程中发生错误!", "");
         }
         else
         {
             this.Session["dt_session_admin_info"] = (object)null;
             this.JscriptMsg("密码修改成功!", "manager_pwd.aspx");
         }
     }
 }
예제 #3
0
 private bool DoAdd()
 {
     Rain.Model.manager model   = new Rain.Model.manager();
     Rain.BLL.manager   manager = new Rain.BLL.manager();
     model.role_id   = int.Parse(this.ddlRoleId.SelectedValue);
     model.role_type = new Rain.BLL.manager_role().GetModel(model.role_id).role_type;
     model.is_lock   = !this.cbIsLock.Checked ? 1 : 0;
     if (manager.Exists(this.txtUserName.Text.Trim()))
     {
         return(false);
     }
     model.user_name = this.txtUserName.Text.Trim();
     model.salt      = Utils.GetCheckCode(6);
     model.password  = DESEncrypt.Encrypt(this.txtPassword.Text.Trim(), model.salt);
     model.real_name = this.txtRealName.Text.Trim();
     model.telephone = this.txtTelephone.Text.Trim();
     model.email     = this.txtEmail.Text.Trim();
     model.add_time  = DateTime.Now;
     if (manager.Add(model) <= 0)
     {
         return(false);
     }
     this.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加管理员:" + model.user_name);
     return(true);
 }
예제 #4
0
 private void ShowInfo(int _id)
 {
     Rain.Model.manager model = new Rain.BLL.manager().GetModel(_id);
     this.txtUserName.Text  = model.user_name;
     this.txtRealName.Text  = model.real_name;
     this.txtTelephone.Text = model.telephone;
     this.txtEmail.Text     = model.email;
 }
예제 #5
0
 private void ShowInfo(int _id)
 {
     Rain.Model.manager model = new Rain.BLL.manager().GetModel(_id);
     this.ddlRoleId.SelectedValue = model.role_id.ToString();
     this.cbIsLock.Checked        = model.is_lock == 0;
     this.txtUserName.Text        = model.user_name;
     this.txtUserName.ReadOnly    = true;
     this.txtUserName.Attributes.Remove("ajaxurl");
     if (!string.IsNullOrEmpty(model.password))
     {
         this.txtPassword.Attributes["value"] = this.txtPassword1.Attributes["value"] = this.defaultpassword;
     }
     this.txtRealName.Text  = model.real_name;
     this.txtTelephone.Text = model.telephone;
     this.txtEmail.Text     = model.email;
 }
예제 #6
0
파일: login.aspx.cs 프로젝트: Hcq/Rain
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string user_name = this.txtUserName.Text.Trim();
            string password  = this.txtPassword.Text.Trim();

            if (user_name.Equals("") || password.Equals(""))
            {
                this.msgtip.InnerHtml = "请输入用户名或密码";
            }
            else
            {
                if (this.Session["AdminLoginSun"] == null)
                {
                    this.Session["AdminLoginSun"] = (object)1;
                }
                else
                {
                    this.Session["AdminLoginSun"] = (object)(Convert.ToInt32(this.Session["AdminLoginSun"]) + 1);
                }
                if (this.Session["AdminLoginSun"] != null && Convert.ToInt32(this.Session["AdminLoginSun"]) > 5)
                {
                    this.msgtip.InnerHtml = "错误超过5次,关闭浏览器重新登录!";
                }
                else
                {
                    Rain.Model.manager model = new Rain.BLL.manager().GetModel(user_name, password, true);
                    if (model == null)
                    {
                        this.msgtip.InnerHtml = "用户名或密码有误,请重试!";
                    }
                    else
                    {
                        this.Session["dt_session_admin_info"] = (object)model;
                        this.Session.Timeout = 45;
                        if (new Rain.BLL.siteconfig().loadConfig().logstatus > 0)
                        {
                            new Rain.BLL.manager_log().Add(model.id, model.user_name, DTEnums.ActionEnum.Login.ToString(), "用户登录");
                        }
                        Utils.WriteCookie("DTRememberName", model.user_name, 14400);
                        Utils.WriteCookie("AdminName", "Rain", model.user_name);
                        Utils.WriteCookie("AdminPwd", "Rain", model.password);
                        this.Response.Redirect("index.aspx");
                    }
                }
            }
        }
예제 #7
0
파일: ManagePage.cs 프로젝트: Hcq/Rain
        public bool IsAdminLogin()
        {
            if (this.Session["dt_session_admin_info"] != null)
            {
                return(true);
            }
            string cookie1 = Utils.GetCookie("AdminName", "Rain");
            string cookie2 = Utils.GetCookie("AdminPwd", "Rain");

            if (cookie1 != "" && cookie2 != "")
            {
                Rain.Model.manager model = new Rain.BLL.manager().GetModel(cookie1, cookie2);
                if (model != null)
                {
                    this.Session["dt_session_admin_info"] = (object)model;
                    return(true);
                }
            }
            return(false);
        }
예제 #8
0
        private bool DoEdit(int _id)
        {
            bool flag = false;

            Rain.BLL.manager   manager = new Rain.BLL.manager();
            Rain.Model.manager model   = manager.GetModel(_id);
            model.role_id   = int.Parse(this.ddlRoleId.SelectedValue);
            model.role_type = new Rain.BLL.manager_role().GetModel(model.role_id).role_type;
            model.is_lock   = !this.cbIsLock.Checked ? 1 : 0;
            if (this.txtPassword.Text.Trim() != this.defaultpassword)
            {
                model.password = DESEncrypt.Encrypt(this.txtPassword.Text.Trim(), model.salt);
            }
            model.real_name = this.txtRealName.Text.Trim();
            model.telephone = this.txtTelephone.Text.Trim();
            model.email     = this.txtEmail.Text.Trim();
            if (manager.Update(model))
            {
                this.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改管理员:" + model.user_name);
                flag = true;
            }
            return(flag);
        }