public void TryToBook() { try { NoSelectedIndex(SommerhusIndex); Sommerhus temp = SommerhusMatch[SommerhusIndex]; BonDialog = new MessageDialog("Er du sikker på at du vil booke sommerhuset i " + temp.Beliggenhed + " fra: " + FraDato.ToString("d") + " til: " + TilDato.ToString("d")); BonDialog.Commands.Add(new UICommand("JA", command => { BookingRegister.CheckIfBooking(Pro, temp, FraDato, TilDato); Dialog.Show("Booking gennemført"); BookingPersistency.SaveBookingAsJsonAsync(BookingRegister.Bookings); })); BonDialog.Commands.Add(new UICommand("NEJ", command => { })); BonDialog.ShowAsync(); } catch (ArgumentOutOfRangeException) { Dialog.Show("Du har ikke valgt noget sommerhus at booke"); } catch (NullReferenceException ex) { Dialog.Show(ex.Message); } catch (ArgumentException ex) { Dialog.Show(ex.Message); } }
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); }