private void AddPatientCommandExecute(object obj) { try { if (EntryValidation.ValidateName(Patient.FirstName) == false) { MessageBox.Show("First Name can only contain letters. Please try again", "Invalid input"); return; } if (EntryValidation.ValidateName(Patient.LastName) == false) { MessageBox.Show("Last Name can only contain letters. Please try again", "Invalid input"); return; } if (EntryValidation.ValidateJmbg(Patient.JMBG) == false) { MessageBox.Show("JMBG you entered is not valid. Please try again", "Invalid input"); return; } if (EntryValidation.ValidateMedicalInsuranceNumber(Patient.MedicalInsuranceNumber) == false) { MessageBox.Show("Medical insurance number entered is not valid, must contain exactly 11 numbers. Please try again", "Invalid input"); return; } string password = (obj as PasswordBox).Password; string encryptPassword = EncryptionHelper.Encrypt(password); patient.Password = encryptPassword; dataBaseService.AddPatient(patient); MessageBox.Show("New patient registered successfully!", "Info"); addPatient.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }