private void btnSubmit_Click(object sender, RoutedEventArgs e) { if (txtEmail.Text.Length < 7 || txtEmail.Text.Length > 250) { MessageBox.Show("The email you submitted was invalid. Please try again."); txtEmail.Focus(); txtEmail.SelectAll(); return; } if (pwdOldPassword.Password.Length < 6) { MessageBox.Show("The old password you submitted was invalid. Please try again."); pwdOldPassword.Focus(); pwdOldPassword.SelectAll(); return; } if (pwdNewPassword.Password.Length < 6) { MessageBox.Show("The new password you submitted was invalid. Please try again."); pwdNewPassword.Focus(); pwdNewPassword.SelectAll(); return; } if (string.Compare(pwdNewPassword.Password.ToString(), pwdRetypePassword.Password.ToString()) != 0) { MessageBox.Show("New Password and Retyped Password must match. Please try again."); pwdRetypePassword.Password = "******"; pwdNewPassword.Focus(); pwdNewPassword.SelectAll(); return; } string oldPassword = pwdOldPassword.Password; string newPassword = pwdNewPassword.Password; string username = txtEmail.Text; try { if (_userManager.UpdatePasswordSLP(username, oldPassword, newPassword)) { MessageBox.Show("Password Updated."); _userManager.RefreshSLPUsers(_slpUser, username); this.DialogResult = true; } else if (_userManager.UpdatePasswordTeacher(username, oldPassword, newPassword)) { MessageBox.Show("Password Updated."); _userManager.RefreshTeacherUsers(_teacherUser, username); this.DialogResult = true; } else if (_userManager.UpdatePasswordManager(username, oldPassword, newPassword)) { MessageBox.Show("Password Updated."); _userManager.RefreshManagerUsers(_managerUser, username); this.DialogResult = true; } } catch (Exception) { throw; } }