コード例 #1
0
 private void AddDoctorCommandExecute(object obj)
 {
     try
     {
         if (EntryValidation.ValidateName(Doctor.FirstName) == false)
         {
             MessageBox.Show("First Name can only contain letters. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateName(Doctor.LastName) == false)
         {
             MessageBox.Show("Last Name can only contain letters. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateJmbg(Doctor.JMBG) == false)
         {
             MessageBox.Show("JMBG you entered is not valid. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateBankAccountNumber(Doctor.BankAccountNumber) == false)
         {
             MessageBox.Show("Bank account nubmer you entered is not valid, must contain exactly 18 numbers. Please try again", "Invalid input");
             return;
         }
         string password        = (obj as PasswordBox).Password;
         string encryptPassword = EncryptionHelper.Encrypt(password);
         doctor.Password = encryptPassword;
         dataBaseService.AddDoctor(doctor);
         MessageBox.Show("New doctor registered successfully!", "Info");
         addDoctor.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }