//保存 protected void btnSubmit_Click(object sender, EventArgs e) { BLL.sys_manager bll = new BLL.sys_manager(); Model.sys_manager 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.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); if (!bll.Update(model)) { JscriptMsg("保存过程中发生错误!", ""); return; } Session[AppoaKeys.SESSION_ADMIN_INFO] = null; JscriptMsg("密码修改成功!", "manager_pwd.aspx"); }
private bool DoEdit(int _id) { bool result = false; BLL.sys_manager bll = new BLL.sys_manager(); Model.sys_manager model = bll.GetModel(_id); if (model.role_id != 1 && int.Parse(ddlRoleId.SelectedValue) == 1) { DBUtility.DbHelperSQL.ExecuteSql("delete ybd_ct_ctinfos where login_name='" + model.user_name + "'"); } 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.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); if (bll.Update(model)) { AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改管理员:" + model.user_name); //记录日志 result = true; } return(result); }