Exemplo n.º 1
0
 private bool EditAccount()
 {
     if (!GetAllPharmacies().Where(p => p.PharmacyID != Authenticator.CurrentUser.PharmacyID).Contains(Pharmacy))
     {
         if (Pharmacy.IsValid())
         {
             _uow.PharmacyRepo.Edit(Pharmacy);
             int ok = _uow.Save();
             if (ok > 0)
             {
                 Authenticator.CurrentUser = Pharmacy;
                 return(true);
             }
             MessageBox.Show("Er is iets misgegaan bij het wijzigen van je profiel!", "Foutmelding",
                             MessageBoxButton.OK, MessageBoxImage.Error);
             return(false);
         }
         else
         {
             MessageBox.Show(Pharmacy.Error, "Foutmelding", MessageBoxButton.OK, MessageBoxImage.Error);
             return(false);
         }
     }
     MessageBox.Show("Deze gebruikersnaam bestaat al!", "Foutmelding", MessageBoxButton.OK, MessageBoxImage.Error);
     return(false);
 }
Exemplo n.º 2
0
        private void AddPharmacy()
        {
            string errors = "";

            errors += ValidateInputFields(CopyPassword);
            if (string.IsNullOrWhiteSpace(errors))
            {
                if (!GetAllPharmacies().Contains(Pharmacy))
                {
                    if (Pharmacy.IsValid())
                    {
                        _uow.PharmacyRepo.Add(Pharmacy);
                        int ok = _uow.Save();
                        if (ok > 0)
                        {
                            Authenticator.CurrentUser = Pharmacy;
                        }
                        else
                        {
                            MessageBox.Show("Het registreren is niet gelukt!", "Foutmelding", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show(Pharmacy.Error, "Foutmelding", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Deze gebruiker bestaat al!", "Foutmelding", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show(errors, "Foutmelding", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }