protected void ButtonOK_Click(object sender, EventArgs e) { bool done = false; StringBuilder stringBuilder = new StringBuilder(); EnvironmentalMonitor.Support.Module.Manage.User sessionUser = this.Session[Constant.SESSION_KEY_USER] as EnvironmentalMonitor.Support.Module.Manage.User; UserBusiness business = new UserBusiness(); User user = business.QueryByAccount(sessionUser.Account); if ((user != null) && (string.Equals(user.Password, this.TextBoxOldPassword.Text, StringComparison.CurrentCulture))) { done = business.ChangePassword(sessionUser.Guid, this.TextBoxPassword.Text); } if (done) { sessionUser.Password = this.TextBoxPassword.Text; this.Session[Constant.SESSION_KEY_USER] = sessionUser; stringBuilder.Append("修改密码成功!"); } else { stringBuilder.Append("修改密码失败!"); } this.LabelMessage.Text = stringBuilder.ToString(); this.InitializeBind(); }