//Constructor for the flight details form that fills the binding source with the flight details. public FlightDetailsForm() { InitializeComponent(); List <FlightDetails> fD = fR.GetFlightDetailsFromDB(); if (fD.Count > 0) { _flightDetalisBindingSource.DataSource = fD; } else { dataGridViewFlightDetails.Visible = false; lblEmptyList.Visible = true; comboBoxSearchParam.Enabled = false; comboBoxSearchParam.Text = "Disabled"; btnExportFlightsToTxt.Enabled = false; btnExportFlightsToTxt.Text = "No flights to export"; } }
//Triggers on form load gets the num of flights currently tracked and the num of details of those flights sets the label and generates a graph on prices. private void FlightDetailsStatistics_Load(object sender, EventArgs e) { int numOfFlights = fR.GetFlightsFromDB().Count(); var flightDetails = fR.GetFlightDetailsFromDB(); int numOfDetailsOfFlights = flightDetails.Count(); lblNumOfDetailsAndFlights.Text = "Currently tracking |" + numOfFlights + "| flights out of which |" + numOfDetailsOfFlights + "| have detailed information"; chartPrice.Series.Clear(); int index = 1; foreach (var flight in flightDetails) { chartPrice.Series.Add(flight.flightId.ToString()); chartPrice.Series[index - 1].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column; chartPrice.Series[index - 1].Points.AddXY(1, flight.flightPrice); chartPrice.Series[index - 1].IsXValueIndexed = true; index += 1; } }