public void AddSommerhus() { try { Sommerhuse.Add(new Sommerhus(AntalPersoner, AntalBadeværelser, AntalSoveværelser, Beliggenhed, HusdyrTilladt, Pris, Størrelse, Swimmingpool)); Dialog.Show("Sommerhus er tilføjet"); SommerhusPersistency.SaveSommerhusAsJsonAsync(Sommerhuse); } catch (ArgumentException ex) { Dialog.Show(ex.Message); } }
public void InitSommerhus() { Sommerhuse.Add(new Sommerhus(1, 2, 4, "Bordeaux", true, 500, 120, true)); Sommerhuse.Add(new Sommerhus(2, 3, 6, "Val Torens", false, 1000, 220, true)); Sommerhuse.Add(new Sommerhus(3, 1, 3, "Lyon", false, 1400, 330, false)); Sommerhuse.Add(new Sommerhus(4, 2, 4, "Toulouse", true, 900, 180, false)); Sommerhuse.Add(new Sommerhus(5, 5, 5, "Strasbourg", false, 700, 140, true)); Sommerhuse.Add(new Sommerhus(6, 2, 3, "Lille", false, 1100, 210, false)); Sommerhuse.Add(new Sommerhus(7, 2, 4, "Nantes", true, 1800, 250, true)); Sommerhuse.Add(new Sommerhus(8, 1, 5, "Cannes", true, 2000, 290, false)); Sommerhuse.Add(new Sommerhus(9, 3, 3, "Dijon", false, 700, 90, false)); SommerhusPersistency.SaveSommerhusAsJsonAsync(Sommerhuse); }
private void MatchAfSommerhus() { SommerhusMatch.Clear(); foreach (var matchingSommerhus in Sommerhuse.Where(x => x.AntalPersoner >= SelectedAntalPersoner && x.AntalSoveværelser >= SelectedAntalVærelser && x.HusdyrTilladt == SelectedHusdyr && x.Swimmingpool == SelectedSwimmingpool)) { SommerhusMatch.Add(matchingSommerhus); foreach (var bookings in BookingRegister.Bookings) { if (matchingSommerhus.Equals(bookings.BookingSommerhus)) { if ((FraDato > bookings.BookingFra && FraDato < bookings.BookingTil) || (TilDato > bookings.BookingFra && TilDato < bookings.BookingTil)) { SommerhusMatch.Remove(matchingSommerhus); } } } } }
private async void LoadSommerhuse() { var loadedSommerhuse = await SommerhusPersistency.LoadSommerhuseFromJsonAsync(); if (loadedSommerhuse != null) { Sommerhuse.Clear(); foreach (var s in loadedSommerhuse) { Sommerhuse.Add(s); } PersoneriCombobox.Clear(); foreach (var item in loadedSommerhuse.OrderBy(x => x.AntalPersoner).Select(x => x.AntalPersoner).Distinct()) { PersoneriCombobox.Add(item); } VærelserICombobox.Clear(); foreach (var item in loadedSommerhuse.OrderBy(x => x.AntalSoveværelser).Select(x => x.AntalSoveværelser).Distinct()) { VærelserICombobox.Add(item); } } }