private void editToolStripMenuItem_Click(object sender, EventArgs e) { if (columnIndex >= 0 && columnIndex <= 3 && rowIndex >= 0 && rowIndex <= AirplaneTimetable_dataGridView.RowCount - 1) { CustomDialog cd = new CustomDialog(this, AirplaneTimetable_dataGridView.Rows[rowIndex].Cells[columnIndex].Value.ToString()); cd.ShowDialog(); if (cd.DialogResult.Equals(DialogResult.OK)) { Airplane airplane = loginForm.Timetable[rowIndex]; switch (columnIndex) { case 0: airplane.RaceNumber = NewValue; break; case 1: airplane.AircraftType = NewValue; break; case 2: airplane.TravelDirection = NewValue; break; case 3: airplane.DepaturePeriod = NewValue; break; } loginForm.Timetable[rowIndex] = airplane; PrintTimetable(); } } }
public bool Compare(Airplane airplane) { return(Speed > airplane.Speed); }
public void GenerateFlights() { Airport <int> ataturk = new Airport <int> { Name = "Ataturk", Country = "Turkey", City = "Istanbul" }; Airport <int> boryspil = new Airport <int> { Name = "Boryspil", Country = "Ukraine", City = "Kyiv" }; Airport <int> heathrow = new Airport <int> { Name = "Heathrow", Country = "England", City = "London" }; List <Airport <int> > airports = new List <Airport <int> > { ataturk, boryspil, heathrow }; airports.ForEach(a => db.AirportDao.Add(a)); Airplane <int> a1 = new Airplane <int> { Company = "Airbus", Model = "A319", Seats = 130, DefaultPrice = 100 }; Airplane <int> a2 = new Airplane <int> { Company = "Boeing", Model = "757-200", Seats = 130, DefaultPrice = 250 }; List <Airplane <int> > airplanes = new List <Airplane <int> > { a1, a2 }; airplanes.ForEach(a => db.AirplaneDao.Add(a)); Route <int> r1 = new Route <int> { AirportDepart = boryspil, AirportArrive = ataturk, Carrier = "Ukraine Int Air", Code = "PS-713", Airplane = a1 }; Route <int> r2 = new Route <int> { AirportDepart = ataturk, AirportArrive = heathrow, Carrier = "Turkish Airlines", Code = "TK-1979", Airplane = a2 }; DateTime departDate1 = new DateTime(2021, 2, 24, 11, 30, 0); DateTime arriveDate1 = new DateTime(2021, 2, 24, 14, 30, 0); DateTime departDate2 = new DateTime(2021, 2, 25, 8, 50, 0); DateTime arriveDate2 = new DateTime(2021, 2, 25, 9, 55, 0); DateTime limit = new DateTime(2021, 4, 1); for (; departDate1 < limit && arriveDate1 < limit && departDate2 < limit && arriveDate2 < limit;) { Flight <int> flight = new Flight <int> { Route = r1, TimeArrive = arriveDate1, TimeDepart = departDate1 }; Flight <int> flight2 = new Flight <int> { Route = r2, TimeArrive = arriveDate2, TimeDepart = departDate2 }; db.FlightDao.Add(flight); db.FlightDao.Add(flight2); departDate1 = departDate1.AddDays(2); arriveDate1 = arriveDate1.AddDays(2); departDate2 = departDate2.AddDays(2); arriveDate2 = arriveDate2.AddDays(2); } }