private void buttonTraziSalu_Click(object sender, RoutedEventArgs e) { TempSobe.Clear(); foreach (var soba in Sobe) { switch (SelectedKriterijum) { case "Sifra": //if (soba.Sifra.IndexOf(Pretraga, StringComparison.CurrentCultureIgnoreCase) != -1) //{ TempSobe.Add(soba); //} break; default: TempSobe.Add(soba); break; } } }
private void UpdateTempSoba() { Sobe.Clear(); TempSobe.Clear(); RoomController roomController = new RoomController(); RenovationPeriodController renovationPeriodController = new RenovationPeriodController(); List <Room> rooms = roomController.ViewRooms(); List <RenovationPeriod> periods = renovationPeriodController.ViewRenovations(); if (rooms != null) { foreach (Room r in rooms) { if (periods != null) { foreach (RenovationPeriod p in periods) { if (r.Number == p.room.Number) { Sobe.Add(new Soba() { Sifra = r.Number, Kapacitet = r.Capacity, Zauzetost = r.Occupation, Tip = r.Usage, Pocetak = p.BeginDate, Kraj = p.EndDate }); r.Renovation = true; } } } if (r.Renovation == false) { Sobe.Add(new Soba() { Sifra = r.Number, Kapacitet = r.Capacity, Zauzetost = r.Occupation, Tip = r.Usage }); } } } foreach (var soba in Sobe) { TempSobe.Add(soba); } }