private void AddSegment(TripCheck trip, ComboBox departAirport, ComboBox airline, DateTimePicker depart, DateTimePicker arrival) { trip.Segments.Add(new Segment() { DepartureAirport = departAirport.SelectedIndex == 0 ? "?" : AirportDataset.Airports[departAirport.SelectedIndex - 1].Code, AirlineCode = airline.SelectedIndex == 0 ? "??" : AirlineDataset.InterlineData[airline.SelectedIndex - 1].Code, LocalDepartureTime = depart.Value, LocalArrivalTime = arrival.Value }); }
private void 显示结果_Click(object sender, EventArgs e) { textBox1.Clear(); var trip = new TripCheck(); LoadIntoTripCheck(trip); trip.Check(); SetState(trip.Status); textBox1.Text = string.Join("\r\n", trip.Messages); }
private void 显示结果_Click(object sender, EventArgs e) { textBox1.Clear(); var trip = new TripCheck(); trip.PcrTimezone = _timezones[comboBox1.SelectedIndex]; LoadIntoTripCheck(trip); trip.Check(); SetState(trip.Status); textBox1.Text = string.Join("\r\n", trip.Messages); }
private void LoadIntoTripCheck(TripCheck trip) { trip.BaggageCount = comboBox10.SelectedIndex; trip.EntryPoint = comboBox5.SelectedItem.ToString(); trip.FinalDestination = comboBox6.SelectedItem.ToString(); AddSegment(trip, comboBox2, comboBox7, dateTimePicker1, dateTimePicker4); if (checkBox1.Checked) { AddSegment(trip, comboBox3, comboBox8, dateTimePicker2, dateTimePicker5); if (checkBox2.Checked) { AddSegment(trip, comboBox4, comboBox9, dateTimePicker3, dateTimePicker6); } } }