private void SaveButton_Click(object sender, EventArgs e) { int i = 0; if (PasswordtextBox.ReadOnly) { try { String Email = EmailtextBox.Text; String CreditCardNumber = CCNtextBox.Text; String Password = PasswordtextBox.Text; String PhoneNumber = PNumbertextBox.Text; if (!Validation.IsValidEmail(Email)) { MessageBox.Show("Please enter a valid Email Adress"); return; } if (!Validation.IsPasswordValid(Password)) { MessageBox.Show("Please enter a valid Password \n" + "It should contain at least one number,one uppercase letter and 8 letters"); return; } if (!String.IsNullOrEmpty(PhoneNumber)) { if (!Validation.IsPhoneNumberVlidate(PhoneNumber)) { MessageBox.Show("Please enter a valid Phone Number \n"); return; } } i = controllerObj.UpdateCustomer( FNametextBox.Text.ToString(), LNametextBox.Text.ToString(), EmailtextBox.Text.ToString(), PNumbertextBox.Text.ToString(), CCNtextBox.Text.ToString(), Convert.ToInt32(IDTextBox.Text)); if (i > 0) { MessageBox.Show("Saved Successfully!"); } else { MessageBox.Show("Error!"); } } catch { MessageBox.Show("Error!"); } } else { if (!Validation.IsPasswordValid(PasswordtextBox.Text)) { MessageBox.Show("Please enter a valid Password \n" + "It should contain at least one number,one uppercase letter and 8 letters"); return; } else { i = 0; i = controllerObj.UpdateCustomerPassword(PasswordtextBox.Text, username); if (i > 0) { MessageBox.Show("Password Updated!"); } else { MessageBox.Show("Error!"); } } } }