Exemplo n.º 1
0
        private void SearchInFlights()
        {
            DepSearchExcludedItems.ForEach(d => { if (!Departures.Contains(d))
                                                  {
                                                      Departures.Add(d);
                                                  }
                                           });
            ArrSearchExcludedItems.ForEach(d => { if (!Arrivals.Contains(d))
                                                  {
                                                      Arrivals.Add(d);
                                                  }
                                           });

            DepSearchResultItems.Clear();
            ArrSearchResultItems.Clear();
            DepSearchExcludedItems.Clear();
            ArrSearchExcludedItems.Clear();

            DepSearchResultItems = Departures.Where(d =>
                                                    d.AirwayCompany.name.ToUpper().Contains(SearchText.ToUpper()) ||
                                                    d.AirwayCompany.ID_comp.ToString().Contains(SearchText) ||
                                                    d.DepTimeString.Contains(SearchText) ||
                                                    d.ArrTimeString.Contains(SearchText) ||
                                                    d.Date.Contains(SearchText) ||
                                                    d.Plane.ToUpper().Contains(SearchText.ToUpper()) ||
                                                    d.TownFrom.ToUpper().Contains(SearchText.ToUpper()) ||
                                                    d.TownTo.ToUpper().Contains(SearchText.ToUpper()) ||
                                                    d.TripNumber.ToString().Contains(SearchText)
                                                    ).ToList();

            ArrSearchResultItems = Arrivals.Where(d =>
                                                  d.AirwayCompany.name.ToUpper().Contains(SearchText.ToUpper()) ||
                                                  d.AirwayCompany.ID_comp.ToString().Contains(SearchText) ||
                                                  d.DepTimeString.Contains(SearchText) ||
                                                  d.ArrTimeString.Contains(SearchText) ||
                                                  d.Date.Contains(SearchText) ||
                                                  d.Plane.ToUpper().Contains(SearchText.ToUpper()) ||
                                                  d.TownFrom.ToUpper().Contains(SearchText.ToUpper()) ||
                                                  d.TownTo.ToUpper().Contains(SearchText.ToUpper()) ||
                                                  d.TripNumber.ToString().Contains(SearchText)
                                                  ).ToList();

            DepSearchExcludedItems = Departures.Where(d =>
                                                      !d.AirwayCompany.name.ToUpper().Contains(SearchText.ToUpper()) ||
                                                      !d.AirwayCompany.ID_comp.ToString().Contains(SearchText) ||
                                                      !d.DepTimeString.Contains(SearchText) ||
                                                      !d.ArrTimeString.Contains(SearchText) ||
                                                      !d.Date.Contains(SearchText) ||
                                                      !d.Plane.ToUpper().Contains(SearchText.ToUpper()) ||
                                                      !d.TownFrom.ToUpper().Contains(SearchText.ToUpper()) ||
                                                      !d.TownTo.ToUpper().Contains(SearchText.ToUpper()) ||
                                                      !d.TripNumber.ToString().Contains(SearchText)).ToList();
            Departures.Clear();

            ArrSearchExcludedItems = Arrivals.Where(d =>
                                                    !d.AirwayCompany.name.ToUpper().Contains(SearchText.ToUpper()) ||
                                                    !d.AirwayCompany.ID_comp.ToString().Contains(SearchText) ||
                                                    !d.DepTimeString.Contains(SearchText) ||
                                                    !d.ArrTimeString.Contains(SearchText) ||
                                                    !d.Date.Contains(SearchText) ||
                                                    !d.Plane.ToUpper().Contains(SearchText.ToUpper()) ||
                                                    !d.TownFrom.ToUpper().Contains(SearchText.ToUpper()) ||
                                                    !d.TownTo.ToUpper().Contains(SearchText.ToUpper()) ||
                                                    !d.TripNumber.ToString().Contains(SearchText)).ToList();
            Arrivals.Clear();

            DepSearchResultItems.ForEach(d => Departures.Add(d));
            ArrSearchResultItems.ForEach(a => Arrivals.Add(a));
        }