public void CheckLoginInformationAndNavigate() { try { CheckForNullOrWhiteSpace(Username, Password); if (LoginTypes[SelectedIndexLoginType] == "Kunde") { Pro = ProfileRegister.FindDicProfile(Username, Password); KundeLogin = KundeRegister.FindKunde(Pro.Username, Pro.Password); LoginUsername = Pro.Username; NavigateToMainSystem(); } if (LoginTypes[SelectedIndexLoginType] == "Admin") { AdminRegister.FindAdmin(Username, Password); NavigateToAdminPage(); } } catch (ArgumentException ex) { Dialog.Show(ex.Message); } catch (NullReferenceException ex) { Dialog.Show(ex.Message); } }
public void AddCustomerWithProfile() { try { ProfileRegister.AddDicProfile(Username, Password); KundeRegister.AddKunde(Username, Password, Adress, Email, Name, Tlf); CheckRepeatPassword(Password, RepeatPassword); Dialog.Show("Profil er tilføjet"); } catch (ArgumentException ex) { Dialog.Show(ex.Message); } ProfilePersistency.SaveProfilesAsJsonAsync(ProfileRegister.DicProfile); KundePersistency.SaveKunderAsJsonAsync(KundeRegister.Kunder); }
public BookingSystem() { Sommerhuse = new ObservableCollection <Sommerhus>(); PersoneriCombobox = new ObservableCollection <int>(); VærelserICombobox = new ObservableCollection <int>(); //InitSommerhus(); ProfileRegister = new ProfileRegister(); KundeRegister = new KundeRegister(); AdminRegister = new AdminRegister(); BookingRegister = new BookingRegister(); FavoritRegister = new FavoritRegister(); LoadKunder(); LoadProfiles(); LoadSommerhuse(); LoadBookings(); LoadFavorits(); _navigationService = new NavigationService(); NavToMainSystemCommand = new RelayCommand(CheckLoginInformationAndNavigate); AddProfileWithCustomerCommand = new RelayCommand(AddCustomerWithProfile); NavToOretProfilCommand = new RelayCommand(() => { _navigationService.Navigate(typeof(OpretProfil)); }); SendEmailCommand = new RelayCommand(() => { Dialog.Show("Logininformationer er sendt til din email"); }); NavToOpretSommerhus = new RelayCommand(() => { _navigationService.Navigate(typeof(OpretSommerhus)); }); NavToListSommerhus = new RelayCommand(() => { try { CheckComboboxValue(SelectedAntalPersoner, SelectedAntalVærelser); CheckTime(FraDato, TilDato); MatchAfSommerhus(); _navigationService.Navigate(typeof(SommerhusListe)); } catch (ArgumentException ex) { Dialog.Show(ex.Message); } }); LogudCommand = new RelayCommand(() => { _navigationService.Navigate(typeof(Login)); }); DeleteKundeCommand = new RelayCommand(DeleteKundeFromListe); AddSommerhusCommand = new RelayCommand(AddSommerhus); ShowPageOmOsCommand = new RelayCommand(ShowOmOs); ShowPageKontaktOsCommand = new RelayCommand(ShowKontaktOs); BookingCommand = new RelayCommand(TryToBook); NavToMinProfilCommand = new RelayCommand(() => { MatchFavorites(); _navigationService.Navigate(typeof(MinProfil)); }); AddFavoritCommand = new RelayCommand(AddToFavorites); }