private void btnAdd_Click(object sender, EventArgs e) { Flight = new Flight(airports[cbDeparture.SelectedIndex], airports[cbDestination.SelectedIndex], airplanes[cbAirplane.SelectedIndex], txtVluchtnummer.Text, dtTakeOffTime.Value); foreach (int pilot in lstPilots.SelectedIndices) { Flight.AddPilot(pilots[pilot]); } foreach (int crew in lstCrew.SelectedIndices) { Flight.AddCrewMember(cabinecrew[crew]); } }
public frmFlightManagement(List<Airplane> airplanes, List<Airport> airports, List<Pilot> pilots, List<Cabinecrew> crew, Flight Flight) : base() { this.Flight = Flight; InitializeComponent(); this.airplanes = airplanes; this.airports = airports; this.pilots = pilots; this.cabinecrew = crew; FillForm(); txtVluchtnummer.Text = Flight.CallSign; cbAirplane.SelectedIndex = airplanes.FindIndex(a => a.Model == Flight.Airplane.Model); cbDeparture.SelectedIndex = airports.FindIndex(a => a.Name == Flight.Departure.Name); cbDestination.SelectedIndex = airports.FindIndex(a => a.Name == Flight.Destination.Name); int index = 0; }