private void ComfirmClick(object sender, EventArgs e) { if (textBoxNewPassword.Text == textBoxRepass.Text) { string errors = ""; errors += textBoxNewPassword.Text.Length == 0 ? "\nPlease Provide New Password" : ""; errors += textBoxRepass.Text.Length == 0 ? "\nPlease provide Retype Password" : ""; errors += textBoxOldPassword.Text.Length == 0 ? "\nPlease Provide Old Password" : ""; if (errors.Length == 0) { int result = ResisterController.UpdatePassword(u.Username, textBoxOldPassword.Text, textBoxNewPassword.Text); if (result != 0) { MessageBox.Show("Password Changed Succesfully", "Message"); this.Hide(); RegisteredMember a = new RegisteredMember(u); a.Show(); } else { MessageBox.Show("Your password is incorrect", "Alert"); } } else { MessageBox.Show(errors, "Filled the flowing!"); return; } } else { MessageBox.Show("New password and re-Enter pasword doesn't match", "Alert"); } }
private void ConfirmButtonClick(object sender, EventArgs e) { if (textBoxPassword.Text == textBoxRepass.Text) { string errors = ""; errors += textBoxPassword.Text.Length == 0 ? "\nPlease Provide Password" : ""; errors += textBoxRepass.Text.Length == 0 ? "\nPlease provide Retype password" : ""; errors += textBoxUsername.Text.Length == 0 ? "\nPlease Provide User Name" : ""; errors += (textBoxMobileNumber.Text.Length == 0 || textBoxMobileNumber.Text.Length != 11) ? "\nPlease Provide a Valid Mobile Number" : ""; if (errors.Length == 0) { var result = ResisterController.Verify(textBoxUsername.Text); if (result == textBoxMobileNumber.Text) { ResisterController.UpdatePassword(textBoxUsername.Text, textBoxPassword.Text); MessageBox.Show("Password recover successfully", "Message"); } else { MessageBox.Show("Your mobile number is incorrect", "Alert"); } } else { MessageBox.Show(errors, "Filled the flowing!"); return; } } else { MessageBox.Show("Password and Re-Enter pasword doesn't match", "Alert"); } }