Beispiel #1
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            BLL.xiehui   bll   = new BLL.xiehui();
            Model.xiehui model = GetAdminInfo();

            if (DESEncrypt.Encrypt(txtOldPassword.Text.Trim(), model.salt) != model.password)
            {
                JscriptMsg("旧密码不正确!", "");
                return;
            }
            if (txtPassword.Text.Trim() != txtPassword1.Text.Trim())
            {
                JscriptMsg("两次密码不一致!", "");
                return;
            }
            model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            model.no       = txtRealName.Text.Trim();
            model.tel      = txtTelephone.Text.Trim();

            if (!bll.Update(model))
            {
                JscriptMsg("保存过程中发生错误!", "");
                return;
            }
            Session[DTKeys.SESSION_ADMIN_INFO] = null;
            JscriptMsg("密码修改成功!", "manager_pwd.aspx");
        }
Beispiel #2
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.xiehui   bll      = new BLL.xiehui();
            Model.xiehui model    = bll.GetModel(_id);
            int          parentId = int.Parse(ddlParentId.SelectedValue);

            //如果选择的父ID不是自己,则更改
            if (parentId != model.id)
            {
                model.parent_id = parentId;
            }
            model.role_id   = int.Parse(ddlRoleId.SelectedValue);
            model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type;
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            //判断密码是否更改
            if (txtPassword.Text.Trim() != defaultpassword)
            {
                //获取用户已生成的salt作为密钥加密
                model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            }
            model.name    = txtRealName.Text.Trim();
            model.town    = ddlTown.SelectedValue.ToString();
            model.village = ddlVillage.SelectedValue.ToString();
            model.person  = txtPerson.Text.Trim();
            model.tel     = txtTel.Text.Trim();
            model.address = txtAddress.Text.Trim();

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改账号:" + model.no); //记录日志
                result = true;
            }

            return(result);
        }