protected void OnButton1Clicked(object sender, EventArgs e) { try { var airlines = new List <Airline>(); // todo: this class should have a list of airlines, dinamically add the checkboxes and get the active list if (chkWizz.Active) { airlines.Add(Airline.Wizzair); } if (chkRyanair.Active) { airlines.Add(Airline.Ryanair); } if (chkBlueair.Active) { airlines.Add(Airline.Blueair); } if (chkTarom.Active) { airlines.Add(Airline.Tarom); } var from = Airport.All.First(a => cbFrom.ActiveText.IndexOf(a.Code) == (cbFrom.ActiveText.Length - 3)); var to = from; if (!chkOnlyFrom.Active) { to = Airport.All.First(a => cbTo.ActiveText.IndexOf(a.Code) == (cbTo.ActiveText.Length - 3)); } var flights = flightsService.Search(from, to, airlines, calendarStartDate.Date, calendarEndDate.Date, chkDirectFlights.Active, chkOnlyFrom.Active); logger.Info("____________________________________"); if (!chkOnlyFrom.Active) { var tripsFrom = tripService.FindFightMatches(from, to, flights); LogTrips(from, to, tripsFrom); var tripsBack = tripService.FindFightMatches(to, from, flights); LogTrips(to, from, tripsBack); } } catch (Exception ex) { logger.Error(ex); } }