/// <summary> /// Function to Update password /// </summary> /// <param name="userinfo"></param> public void ChangePasswordEdit(UserInfo infoUser) { UserSP spUser = new UserSP(); try { spUser.ChangePasswordEdit(infoUser); } catch (Exception ex) { MessageBox.Show("UBLL1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Save function, Checking the Invalid entries /// </summary> public void SaveFunction() { try { UserInfo infoUser = new UserInfo(); UserSP spUser = new UserSP(); string strUserName = txtUserName.Text.Trim(); string strPassword = spUser.LoginCheck(strUserName); if (txtOldPassword.Text.Trim() == string.Empty) { Messages.InformationMessage("Enter password"); txtOldPassword.Focus(); } else if (txtNewPassword.Text.Trim() == string.Empty) { Messages.InformationMessage("Enter new password"); txtNewPassword.Focus(); } else if (txtRetype.Text.Trim() == string.Empty) { Messages.InformationMessage("Enter confirmation password"); txtRetype.Focus(); } else if (txtNewPassword.Text != txtRetype.Text) { Messages.InformationMessage("Password and confirm password should match"); txtRetype.Focus(); txtRetype.SelectAll(); } else if (strPassword == txtOldPassword.Text.Trim()) { if (PublicVariables.isMessageAdd) { if (Messages.SaveMessage()) { infoUser.UserId = PublicVariables._decCurrentUserId; infoUser.UserName = txtUserName.Text.Trim(); infoUser.Password = txtNewPassword.Text.Trim(); spUser.ChangePasswordEdit(infoUser); Clear(); Messages.SavedMessage(); this.Close(); } } else { infoUser.UserId = PublicVariables._decCurrentUserId; infoUser.UserName = txtUserName.Text.Trim(); infoUser.Password = txtNewPassword.Text.Trim(); spUser.ChangePasswordEdit(infoUser); } } else { Messages.InformationMessage("Invalid password"); txtOldPassword.Focus(); txtOldPassword.SelectAll(); } } catch (Exception ex) { MessageBox.Show("CHGPWD:2" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }