void stationProvider_InputChanged(object sender, EventArgs e) { WebServiceTextSearchProvider provider = (WebServiceTextSearchProvider)sender; string inputString = provider.InputString; if (!string.IsNullOrEmpty(inputString)) { string p = inputString.ToLower(); var stations = this.AllStations.Where(x => x.Name.ToLower().StartsWith(p)).Take(5); if (stations.Count() < 5) { var extraStations = AllStations.Where(x => x.StartsWith(p)).Take(5 - stations.Count()); stations = stations.Union(extraStations); } provider.LoadItems(stations); } else { provider.Reset(); } }
public void DisplayStations(string condition = null) { Console.WriteLine(); Console.WriteLine("Please select the station:"); foreach (var i in AllStations.Where(m => m.Value != condition)) { Console.WriteLine(i.Value); } }
public Station GetStationByName(string value) { var selectedStation = AllStations.Where(x => x.Name.ToLower() == value.ToLower()).FirstOrDefault(); if (selectedStation == null) { selectedStation = AllStations.Where(x => x.NamesExtra.Select(y => y.ToLower()).Contains(value.ToLower())).FirstOrDefault(); } return(selectedStation); }
public Tuple <int, string> RouteInformation() { while (_condition == Constants.FalseCondition) { Console.WriteLine(); var selection = Console.ReadLine(); var currentMatches = AllStations.Where(i => i.Value.Contains(selection)); LogicToDisplay(currentMatches); } return(new Tuple <int, string>(_order, _station)); }