public void SearchCommandExecute(string text) { SearchedAirlineCompany = wpfFacade.GetAirlineCompanyByName(text); Flights.Clear(); if (SearchedAirlineCompany is null == false) { Flights.AddRange(wpfFacade.GetFlightsByAirlineCompanyId(SearchedAirlineCompany)); } }
public async Task Search() { Flights.Clear(); List <Flight> tempFlights = await flightService.GetAll(); foreach (var item in tempFlights) { Flights.Add(item); } }
public void Search() { Flights.Clear(); var flights = Enumerable.Range(0, 10) .Select(i => new FlightViewModel { Arrives = SelectedArrival, Departs = SelectedDeparture, Name = String.Format("METRO {0}", i) }); Flights.AddRange(flights); }
protected void SearchAsync() { List <Flight> temp = Flights.ToList(); Flights.Clear(); if (string.IsNullOrWhiteSpace(SearchFilter)) { temp.Clear(); UpdateDataAsync(); } else { Flights = new ObservableCollection <Flight>(temp.Where(s => s.FlightNumber.StartsWith(SearchFilter, StringComparison.CurrentCultureIgnoreCase) || s.DeparturePoint.StartsWith(SearchFilter, StringComparison.CurrentCultureIgnoreCase) || s.DeparturePoint.StartsWith(SearchFilter, StringComparison.CurrentCultureIgnoreCase)).ToList()); } RaisePropertyChanged(nameof(Flights)); }
private void CmdCleanMap_Execute(object obj) { FireAlert = Visibility.Collapsed; AreaIsGood = Visibility.Collapsed; NotifyPropertyChanged("FireAlert"); NotifyPropertyChanged("AreaIsGood"); Flights.Clear(); AreasOfInterest.Clear(); NotifyPropertyChanged("Flights"); NotifyPropertyChanged("AreasOfInterest"); AddToMyAreasVisibility = Visibility.Hidden; NotifyPropertyChanged("AddToMyAreasVisibility"); RenderMap(); }
public void LoadFlights() { Flights.Clear(); using (SqlConnection conn = new SqlConnection()) { conn.ConnectionString = CONNECTION_STRING; conn.Open(); SqlCommand command = conn.CreateCommand(); command.CommandText = @"SELECT * FROM Flight"; SqlDataAdapter daFlight = new SqlDataAdapter(); DataSet dsFlight = new DataSet(); daFlight.SelectCommand = command; daFlight.Fill(dsFlight, "Flights"); foreach (DataRow row in dsFlight.Tables["Flights"].Rows) { Flight flight = new Flight(); flight.Id = (int)row["Id"]; flight.FlightNumber = (string)row["FlightNumber"]; flight.AirplaneId = GetAirplanePilot((string)row["AirplaneId"]); flight.DepartureTime = (DateTime)row["DepartureTime"]; flight.ArrivalTime = (DateTime)row["ArrivalTime"]; flight.DeparturePlace = AirportCity((string)row["DeparturePlace"]); flight.Destination = AirportCity((string)row["Destination"]); flight.OneWayTicketPrice = (decimal)row["OneWayTicketPrice"]; flight.CompanyPassword = GetPass((string)row["CompanyPassword"]); flight.Active = (bool)row["Active"]; Flights.Add(flight); } } }