using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using BLL; namespace FineUIPro.Web.common.SysManage { public partial class UpdatePasswordEdit : PageBase { #region 定义项 /// /// 用户主键 /// public string UserId { get { return (string)ViewState["UserId"]; } set { ViewState["UserId"] = value; } } #endregion /// /// 修改密码页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LoadData(); this.UserId = Request.Params["userId"]; if (this.CurrUser.Account == BLL.Const.Gly) { this.txtOldPassword.Hidden = true; this.txtNewPassword.Focus(); } if (!string.IsNullOrEmpty(this.UserId)) { var user = BLL.Sys_UserService.GetUsersByUserId(this.UserId); if (user != null) { this.txtUserName.Text = user.UserName; this.txtAccount.Text = user.Account; } } } } /// /// 加载页面 /// private void LoadData() { btnClose.OnClientClick = ActiveWindow.GetHideReference(); } /// /// 保存按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.UpdatePasswordMenuId, Const.BtnSave)) { var user = BLL.Sys_UserService.GetUsersByUserId(this.UserId); if (user != null) { if (this.CurrUser.Account != BLL.Const.Gly) { if (string.IsNullOrEmpty(this.txtOldPassword.Text)) { Alert.ShowInParent("请输入原密码!"); return; } if (user.Password != BLL.Sys_UserService.EncryptionPassword(this.txtOldPassword.Text)) { Alert.ShowInParent("原密码输入不正确!"); return; } } if (this.txtNewPassword.Text != this.txtConfirmPassword.Text) { Alert.ShowInParent("密码与确认密码输入不一致!"); return; } BLL.Sys_UserService.UpdatePassword(user.UserId, this.txtNewPassword.Text); BLL.Sys_LogService.AddLog(Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.UpdatePasswordMenuId, Const.BtnSave, this.UserId); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } } else { Alert.ShowInTop(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning); return; } } /// /// 确认密码 /// /// /// protected void txtConfirmPassword_Blur(object sender, EventArgs e) { if (this.txtNewPassword.Text != this.txtConfirmPassword.Text) { Alert.ShowInParent("密码与确认密码输入不一致!"); return; } } } }