private void btnOK_Click(object sender, EventArgs e) { if (this.textBoxNewName.Text.Trim() == "") { this.lblTip.Text = "用户名不能为空!"; this.ReInputName(); } else if ((this.mUserRealName != this.textBoxNewName.Text.Trim()) && this.userDAL.ExistUserName(this.textBoxNewName.Text.Trim())) { this.lblTip.Text = "此用户名已存在,请重新输入!"; this.ReInputName(); } else if (this.textBoxNewPwd.Text != this.textBoxReNewPwd.Text) { this.lblTip.Text = "新输入密码不匹配,请重新输入!"; this.ReInputPwd(); } else if (GetLength(this.textBoxNewPwd.Text.Trim()) < 4) { this.lblTip.Text = "密码长度至少4位"; this.ReInputPwd(); } else if (this.userDAL.UpdateUserNamePwd(this.mUserCode, this.textBoxNewName.Text.Trim(), MD5_Crypt.GetHashStr(this.textBoxNewPwd.Text.Trim())) != -1) { if ((this.textBoxOldName.Text.Trim() != this.textBoxNewName.Text.Trim()) || (this.mOldPwd != MD5_Crypt.GetHashStr(this.textBoxNewPwd.Text.Trim()))) { MD5_Crypt.GetHashStr(this.textBoxNewPwd.Text.Trim()); UserLoginUtil.ChangeRemaindNameAndPassword(this.textBoxOldName.Text.Trim(), this.textBoxNewName.Text.Trim(), this.textBoxNewPwd.Text.Trim()); PropertyUtil.Save(); } MessageManager.ShowMsgBox("INP-131203"); base.DialogResult = DialogResult.OK; } }
private void btnOK_Click(object sender, EventArgs e) { if (MD5_Crypt.GetHashStr(this.textBoxOldPwd.Text.Trim()) != this.mOldPwd) { this.lblTip.Text = "当前密码输入错误,请重新输入!"; this.lblTip.ForeColor = Color.Red; this.textBoxOldPwd.Focus(); this.textBoxOldPwd.SelectAll(); } else if (this.textBoxNewPwd.Text != this.textBoxReNewPwd.Text) { this.lblTip.Text = "新输入密码不匹配,请重新输入!"; this.ReInputPwd(); } else if (GetLength(this.textBoxNewPwd.Text.Trim()) < 4) { this.lblTip.Text = "密码长度至少4位"; this.ReInputPwd(); } else { RoleUserDAL rdal = new RoleUserDAL(); if (rdal.UpdateUserPwd(this.mUserCode, MD5_Crypt.GetHashStr(this.textBoxNewPwd.Text.Trim())) != -1) { if (this.mOldPwd != MD5_Crypt.GetHashStr(this.textBoxNewPwd.Text.Trim())) { UserLoginUtil.UpdateRemaindPasswrodByName(rdal.SelectUserByDM(this.mUserCode).RealName); PropertyUtil.Save(); } MessageManager.ShowMsgBox("INP-132201"); base.DialogResult = DialogResult.OK; } } }