public Flight CreateFlight(int id,
                                   FlightNumber number,
                                   Airport departureAirport,
                                   DateTime departureDate,
                                   Airport arrivalAirport,
                                   DateTime arrivalDate,
                                   Airline carrier,
                                   decimal price)
        {
            if (departureAirport == null)
            {
                throw  new ArgumentNullException(nameof(departureAirport), "Departure airport is required to create a booking.");
            }

            if (arrivalAirport == null)
            {
                throw  new ArgumentNullException(nameof(arrivalAirport), "Arrival airport is required to create a booking.");
            }

            if (carrier == null)
            {
                throw  new ArgumentNullException(nameof(carrier), "Carrier is required to create a booking.");
            }

            var flight = new Flight(id,
                                    number,
                                    departureAirport.Id,
                                    departureDate,
                                    arrivalAirport.Id,
                                    arrivalDate,
                                    carrier.Id,
                                    price);

            return(flight);
        }
Exemple #2
0
        /// <summary>
        /// Заполняет поля для редактирования директивы
        /// </summary>
        public void UpdateInformation(FlightNumber _currentDirective, List <SchedulePeriods> schedulePeriods, FlightNumberScreenType screenType)
        {
            if (_currentDirective == null)
            {
                return;
            }
            _screenType = screenType;
            UpdateControl(_screenType);

            //Выставление значений
            dictionaryComboBoxFlightNo.SelectedItem = _currentDirective.FlightNo;
            comboBoxAircraftCode.SelectedItem       = _currentDirective.FlightAircraftCode;

            if (_screenType == FlightNumberScreenType.UnSchedule)
            {
                comboBoxFlightType.SelectedItem = _currentDirective.FlightType;
            }
            else
            {
                comboBoxFlightType.SelectedItem = FlightType.Schedule;
            }
            comboBoxFlightCategory.SelectedItem  = _currentDirective.FlightCategory;
            dictComboBoxStationFrom.SelectedItem = _currentDirective.StationFrom;
            dictComboBoxStationTo.SelectedItem   = _currentDirective.StationTo;
            textBoxHiddenRemarks.Text            = _currentDirective.HiddenRemarks;
            textBoxDescription.Text = _currentDirective.Description;
            textBoxRemarks.Text     = _currentDirective.Remarks;

            _flightNumberPeriodListControl.SchedulePeriods = schedulePeriods;
            _flightNumberPeriodListControl.UpdateControl(_currentDirective, _screenType);
        }
Exemple #3
0
 ///<summary>
 ///Возвращает значение, показывающее были ли изменения в данном элементе управления
 ///</summary>
 ///<param name="directiveExist">Показывает, существует ли уже директива или нет</param>
 ///<returns></returns>
 public bool GetChangeStatus(FlightNumber _currentDirective)
 {
     if (_currentDirective.ItemId > 0)
     {
         return(_flightNumberPeriodListControl.GetChangeStatus() ||
                _currentDirective.FlightNo != dictionaryComboBoxFlightNo.SelectedItem ||
                _currentDirective.FlightAircraftCode != (FlightAircraftCode)comboBoxAircraftCode.SelectedItem ||
                _currentDirective.FlightType != (FlightType)comboBoxFlightType.SelectedItem ||
                _currentDirective.FlightCategory != (FlightCategory)comboBoxFlightCategory.SelectedItem ||
                _currentDirective.StationFrom != dictComboBoxStationFrom.SelectedItem ||
                _currentDirective.StationTo != dictComboBoxStationTo.SelectedItem ||
                textBoxHiddenRemarks.Text != _currentDirective.HiddenRemarks ||
                textBoxDescription.Text != _currentDirective.Description ||
                textBoxRemarks.Text != _currentDirective.Remarks);
     }
     return(dictionaryComboBoxFlightNo.SelectedItem != null ||
            comboBoxAircraftCode.SelectedItem != null ||
            comboBoxFlightType.SelectedItem != null ||
            comboBoxFlightCategory.SelectedItem != null ||
            dictComboBoxStationFrom.SelectedItem != null ||
            dictComboBoxStationTo.SelectedItem != null ||
            textBoxHiddenRemarks.Text != "" ||
            textBoxDescription.Text != "" ||
            textBoxRemarks.Text != "");
 }
Exemple #4
0
        public Flight(
            int id,
            FlightNumber number,
            int departureAirportId,
            DateTime departureDate,
            int arrivalAirportId,
            DateTime arrivalDate,
            int carrierId,
            decimal price) : base(id)
        {
            Number             = number ?? throw  new ArgumentNullException(nameof(number), "Number is required to construct a booking.");
            CarrierId          = carrierId;
            DepartureAirportId = departureAirportId;
            DepartureDate      = departureDate;
            ArrivalAirportId   = arrivalAirportId;
            ArrivalDate        = arrivalDate;
            Price = price;

            if (price < 0)
            {
                throw  new ArgumentException("Price should be greater than or equal to zero.", nameof(price));
            }

            if (DepartureDate >= ArrivalDate)
            {
                throw new ArgumentException("Departure date should be earlier than arrival date.", nameof(departureDate));
            }

            if (ArrivalDate.Subtract(DepartureDate) > new TimeSpan(24, 0, 0))
            {
                throw new ArgumentException("Max raw duration between departure and arrival dates should be less than 24 hours.", nameof(departureDate));
            }
        }
Exemple #5
0
        void ReleaseDesignerOutlets()
        {
            if (AircraftReg != null)
            {
                AircraftReg.Dispose();
                AircraftReg = null;
            }

            if (DestinationLabel != null)
            {
                DestinationLabel.Dispose();
                DestinationLabel = null;
            }

            if (FlightNumber != null)
            {
                FlightNumber.Dispose();
                FlightNumber = null;
            }

            if (ScheduleLabel != null)
            {
                ScheduleLabel.Dispose();
                ScheduleLabel = null;
            }
        }
Exemple #6
0
        /// <summary>
        /// Заполняет поля для редактирования директивы
        /// </summary>
        public void UpdateInformation(FlightNumber _currentDirective)
        {
            if (_currentDirective == null)
            {
                return;
            }

            dictComboBoxMinLevel.Type = typeof(CruiseLevel);
            Program.MainDispatcher.ProcessControl(dictComboBoxMinLevel);

            comboBoxMeasure.Items.Clear();
            foreach (Measure o in Measure.Items.Where(i => i == Measure.Kilometres || i == Measure.Miles || i == Measure.Unknown))
            {
                comboBoxMeasure.Items.Add(o);
            }

            numericUpDownDistance.Value        = _currentDirective.Distance;
            comboBoxMeasure.SelectedItem       = _currentDirective.DistanceMeasure;
            dictComboBoxMinLevel.SelectedItem  = _currentDirective.MinLevel;
            numericUpDownPassengers.Value      = _currentDirective.MaxPassengerAmount;
            numericUpDownFuel.Value            = (decimal)_currentDirective.MaxFuelAmount;
            numericUpDownFuelRemainAfter.Value = (decimal)_currentDirective.MinFuelAmount;
            numericUpDownPayload.Value         = (decimal)_currentDirective.MaxPayload;
            numericUpDownCargo.Value           = (decimal)_currentDirective.MaxCargoWeight;
            numericUpDownTakeOffWeight.Value   = (decimal)_currentDirective.MaxTakeOffWeight;
            numericUpDownMaxLandWeight.Value   = (decimal)_currentDirective.MaxLandWeight;

            dataGridViewCrew.ViewedType           = typeof(FlightNumberCrewRecord);
            dataGridViewAirports.ViewedType       = typeof(FlightNumberAirportRelation);
            dataGridViewAircraftModels.ViewedType = typeof(FlightNumberAircraftModelRelation);

            dataGridViewCrew.SetItemsArray(_currentDirective.FlightNumberCrewRecords.ToArray());
            dataGridViewAirports.SetItemsArray(_currentDirective.AlternateAirports.ToArray());
            dataGridViewAircraftModels.SetItemsArray(_currentDirective.AircraftModels.ToArray());
        }
Exemple #7
0
        private void HeaderControlButtonSaveAndAddClick(object sender, EventArgs e)
        {
            string message;

            if (!ValidateData(out message))
            {
                message += "\nAbort operation";
                MessageBox.Show(message, (string)new GlobalTermsProvider()["SystemName"],
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (GetChangeStatus())
            {
                SaveData();
            }

            if (MessageBox.Show("Flight added successfully" + "\nClear Fields before add new Flight?",
                                new GlobalTermsProvider()["SystemName"].ToString(),
                                MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                ClearFields();
            }
            _currentDirective = new FlightNumber();
            _directiveGeneralInformation.UpdatePeriodControl(_currentDirective);
        }
Exemple #8
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            #region Загрузка элементов

            AnimatedThreadWorker.ReportProgress(0, "load directives");

            try
            {
                if (_currentDirective.ItemId > 0)
                {
                    _currentDirective = GlobalObjects.AircraftFlightsCore.GetFlightNumberById(_currentDirective.ItemId, true);
                }
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while loading directives", ex);
            }

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }
            #endregion

            _schedulePeriods.Clear();
            _schedulePeriods.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectListAll <SchedulePeriodDTO, SchedulePeriods>());

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Exemple #9
0
        ///<summary>
        ///Возвращает значение, показывающее были ли изменения в данном элементе управления
        ///</summary>
        ///<param name="_currentDirective">Показывает, существует ли уже директива или нет</param>
        ///<returns></returns>
        public bool GetChangeStatus(FlightNumber _currentDirective)
        {
            if (dataGridViewCrew.GetChangeStatus() ||
                dataGridViewAirports.GetChangeStatus() ||
                dataGridViewAircraftModels.GetChangeStatus())
            {
                return(true);
            }

            if (_currentDirective.ItemId > 0)
            {
                return(_currentDirective.Distance != numericUpDownDistance.Value ||
                       _currentDirective.DistanceMeasure != comboBoxMeasure.SelectedItem ||
                       _currentDirective.MinLevel != dictComboBoxMinLevel.SelectedItem ||
                       _currentDirective.MaxPassengerAmount != numericUpDownPassengers.Value ||
                       _currentDirective.MaxFuelAmount != (double)numericUpDownFuel.Value ||
                       _currentDirective.MinFuelAmount != (double)numericUpDownFuelRemainAfter.Value ||
                       _currentDirective.MaxPayload != (double)numericUpDownPayload.Value ||
                       _currentDirective.MaxCargoWeight != (double)numericUpDownCargo.Value ||
                       _currentDirective.MaxLandWeight != (double)numericUpDownMaxLandWeight.Value ||
                       _currentDirective.MaxTakeOffWeight != (double)numericUpDownTakeOffWeight.Value);
            }
            return(numericUpDownDistance.Value != 0 ||
                   comboBoxMeasure.SelectedItem != null ||
                   dictComboBoxMinLevel.SelectedItem != null ||
                   numericUpDownPassengers.Value != 0 ||
                   numericUpDownFuel.Value != 0 ||
                   numericUpDownFuelRemainAfter.Value != 0 ||
                   numericUpDownPayload.Value != 0 ||
                   numericUpDownCargo.Value != 0 ||
                   numericUpDownTakeOffWeight.Value != 0);
        }
Exemple #10
0
 private bool CanGetTerminal()
 {
     return(AirlineId.HasValue &&
            FlightNumber.HasValue() &&
            _pickupAddress.SelectOrDefault(addr => addr.PlaceId.HasValue()) &&
            _carrierCodes.Any(c => c.Key == AirlineId));
 }
Exemple #11
0
        public ActionResult Create([Bind(Include = "FlightNumberID,Number,DepartTime,BaseFare")] FlightNumber flightNumber, int[] DaysChosenList, int StartCityID, int EndCityID)
        {
            if (ModelState.IsValid)
            {
                if (db.FlightNumbers.FirstOrDefault(c => c.Number == flightNumber.Number) != null)
                {
                    ViewBag.AllDays = GetAllDays();

                    ViewBag.AllAirports = GetALlAirports();
                    ViewBag.Error       = "Error: Unique Flight Number Needed";
                    return(View());
                }
                if (StartCityID == EndCityID)
                {
                    ViewBag.AllDays = GetAllDays();

                    ViewBag.AllAirports = GetALlAirports();
                    ViewBag.Error       = "Error the two cities must be different";
                    return(View());
                }
                flightNumber.DepartureDays = new List <Day>();
                Route flightRoute = new Route();
                if (DaysChosenList != null)
                {
                    foreach (int DaySelected in DaysChosenList)
                    {
                        flightNumber.DepartureDays.Add(db.Days.Find(DaySelected));
                    }
                }
                if (DaysChosenList == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                City         startCity = db.Cities.Find(StartCityID);
                City         endCity   = db.Cities.Find(EndCityID);
                List <Route> allRoutes = db.Routes.ToList();
                foreach (Route thisroute in allRoutes)
                {
                    List <City> thisroutescities = thisroute.Cities.ToList();
                    if (thisroutescities.Contains(startCity) && thisroutescities.Contains(endCity))
                    {
                        flightRoute = thisroute;
                    }
                }
                //Route flightRoute = db.Routes.Where(c => c.Cities.Contains(startCity) && c.Cities.Contains(endCity)).ToList().First();
                flightNumber.startCity      = (db.Cities.Find(StartCityID));
                flightNumber.Route          = flightRoute;
                flightNumber.endCityAirport = endCity.Airport;
                flightNumber.BeenDisabled   = false;

                db.FlightNumbers.Add(flightNumber);
                db.SaveChanges();
                return(RedirectToAction("SeedNewFlightNumber", "Flights"));
            }
            ViewBag.DaysChosenList = GetAllDays();

            ViewBag.AllAirports = GetALlAirports();
            return(View(flightNumber));
        }
        public void Test_NullStringToFlightNumberCasting_ShouldBeNull()
        {
            // Act
            FlightNumber flightNumber = (string)null;

            // Assert
            Assert.Null(flightNumber);
        }
Exemple #13
0
        ///<summary>
        ///</summary>
        public FlightNumberScreen()
        {
            InitializeComponent();

            _currentDirective = new FlightNumber();

            Initialize();
        }
Exemple #14
0
        public ActionResult DeleteConfirmed(int id)
        {
            FlightNumber flightNumber = db.FlightNumbers.Find(id);

            db.FlightNumbers.Remove(flightNumber);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #15
0
        public void FlightNumber_Constructor_Initialises_To_Known_State_And_Properties_Work()
        {
            var flightNumber = new FlightNumber();

            TestUtilities.TestProperty(flightNumber, r => r.AirlineCode, null, "Aa");
            TestUtilities.TestProperty(flightNumber, r => r.FlightCode, null, "Bb");
            Assert.AreEqual(0, flightNumber.AirportCodes.Count);
        }
Exemple #16
0
        public ActionResult SeedNewFlightNumber()
        {
            List <Day>   daysflown       = new List <Day>();
            Int32        maxindex        = db.FlightNumbers.Max(c => c.FlightNumberID);
            FlightNumber newflightNumber = db.FlightNumbers.Find(maxindex);

            if (newflightNumber.DepartureDays.Count > 0)
            {
                //var query = db.Flights.Where(c => c.DepartDateTime > DateTime.Now - DateTime.Now.TimeOfDay + new TimeSpan(24, 0, 0) && c.FlightNumber.FlightNumberID == newflightNumber.FlightNumberID).ToList();
                //foreach (Flight flightinfuturecancelled in query)
                //{
                //    var query2 = db.Seats.Where(c => c.Flight.FlightID == flightinfuturecancelled.FlightID).ToList();
                //    foreach( Seat seat in query2)
                //    {
                //        db.Seats.Remove(S)
                //    }
                //    db.Flights.Remove(flightinfuturecancelled);

                //}
                //db.SaveChanges();

                daysflown = newflightNumber.DepartureDays.ToList();
                foreach (DateTime Day in DecemberDaysLeft())
                {
                    String dayofweek = Day.DayOfWeek.ToString();
                    foreach (Day dayflown in daysflown)
                    {
                        if (dayofweek == dayflown.Name)
                        {
                            Flight newflight = new Flight(newflightNumber.BaseFare, db);
                            newflight.Cancelled      = false;
                            newflight.DepartDateTime = Day + newflightNumber.DepartTime;
                            newflight.Departed       = false;
                            newflight.FlightNumber   = newflightNumber;
                            db.Flights.Add(newflight);
                            db.SaveChanges();
                            return(RedirectToAction("Index", "Cities"));
                        }
                    }
                }
            }
            else
            {
                //var query = db.Flights.Where(c => c.DepartDateTime > DateTime.Now-DateTime.Now.TimeOfDay+new TimeSpan(24,0,0)&&c.FlightNumber.FlightNumberID==newflightNumber.FlightNumberID).ToList();
                //foreach (Flight flightinfuturecancelled in query)
                //{
                //    db.Flights.Remove(flightinfuturecancelled);

                //}
                //db.SaveChanges();
                return(RedirectToAction("Index", "FlightNumbers"));
            }
            return(RedirectToAction("Index", "Routes"));
        }
Exemple #17
0
        public Flight(long id, FlightNumber flightNumber, Departure departure, Destination destination, Aircraft aircraft)
        {
            passengers = new List <CheckedInPassenger>();
            cargo      = new List <CargoItem>();

            Id = id;

            FlightNumber = flightNumber ?? throw new ArgumentNullException(nameof(flightNumber));
            Departure    = departure ?? throw new ArgumentNullException(nameof(departure));
            Destination  = destination ?? throw new ArgumentNullException(nameof(destination));
            Aircraft     = aircraft ?? throw new ArgumentNullException(nameof(aircraft));
        }
Exemple #18
0
        /// <summary>
        ///  Создает страницу для отображения информации об одном планируемом рейсе
        /// </summary>
        /// <param name="flightNumber">рейс</param>
        /// <param name="screenType"></param>
        public FlightNumberScreen(FlightNumber flightNumber, FlightNumberScreenType screenType)
            : this()
        {
            if (flightNumber == null)
            {
                throw new ArgumentNullException("flightNumber", "Argument cannot be null");
            }

            _currentDirective = flightNumber;
            _screenType       = screenType;

            Initialize();
        }
Exemple #19
0
        /// <summary>
        /// Данные у директивы обновляются по введенным данным
        /// </summary>
        /// <param name="_currentDirective"></param>
        public void ApplyChanges(FlightNumber _currentDirective)
        {
            _currentDirective.FlightNo           = dictionaryComboBoxFlightNo.SelectedItem as FlightNum;
            _currentDirective.FlightAircraftCode = (FlightAircraftCode)comboBoxAircraftCode.SelectedItem;
            _currentDirective.FlightType         = (FlightType)comboBoxFlightType.SelectedItem;
            _currentDirective.FlightCategory     = (FlightCategory)comboBoxFlightCategory.SelectedItem;
            _currentDirective.StationFrom        = (AirportsCodes)dictComboBoxStationFrom.SelectedItem;
            _currentDirective.StationTo          = (AirportsCodes)dictComboBoxStationTo.SelectedItem;
            _currentDirective.HiddenRemarks      = textBoxHiddenRemarks.Text;
            _currentDirective.Description        = textBoxDescription.Text;
            _currentDirective.Remarks            = textBoxRemarks.Text;

            _flightNumberPeriodListControl.ApplyChanges();
        }
Exemple #20
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FlightNumber flightNumber = db.FlightNumbers.Find(id);

            if (flightNumber == null)
            {
                return(HttpNotFound());
            }
            return(View(flightNumber));
        }
        public void Test_StringToFlightNumberCasting()
        {
            // Arrrange
            string flightNumberString = "TK1706";

            // Act
            FlightNumber flightNumber = flightNumberString;

            // Assert
            Assert.Equal(flightNumberString, flightNumber);
            Assert.Equal(flightNumberString.GetHashCode(), flightNumber.GetHashCode());
            Assert.Equal(flightNumberString, flightNumber.ToString());
            Assert.True(flightNumber.Equals(flightNumberString));
        }
        public void Test_FlightNumberToStringCasting()
        {
            // Arrange
            FlightNumber flightNumber = new FlightNumber("TK1957");

            // Act
            string flightNumberString = flightNumber;

            // Arrange
            Assert.Equal(flightNumber, flightNumberString);
            Assert.Equal(flightNumber.GetHashCode(), flightNumberString.GetHashCode());
            Assert.Equal(flightNumber.ToString(), flightNumberString);
            Assert.True(flightNumber.Equals(flightNumberString));
        }
Exemple #23
0
        public ActionResult Create([Bind(Include = "FlightID,DepartTime")] Flight flight, int FlightNumberID)
        {
            if (ModelState.IsValid)
            {
                FlightNumber flightNumbertarget = db.FlightNumbers.Find(FlightNumberID);
                //flight.FlightNumber = flightNumbertarget;
                flight.DepartDateTime = flight.DepartDateTime + flightNumbertarget.DepartTime;
                flightNumbertarget.Flights.Add(flight);
                db.Flights.Add(flight);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(flight));
        }
        public void UpdateControl(FlightNumber flightNumber, FlightNumberScreenType screenType)
        {
            _flightNumber = flightNumber;
            _screenType   = screenType;

            if (_flightNumber.FlightNumberPeriod.Count > 0)
            {
                flowLayoutPanelPerformances.Controls.Clear();
            }

            foreach (var period in _flightNumber.FlightNumberPeriod)
            {
                AddPeriodControl(period);
            }
        }
        // Start is called before the first frame update
        void Start()
        {
            // Set the initial phone charge
            CurrentPhoneCharge = Conf.InitialPhoneCharge;

            // Set the initial gate timer to a large number, to avoid the game ending before a gate is selected
            CurrentGateTimer = 99;

            // Set the flight number for this round
            FlightNumber = UnityEngine.Random.Range(1000, 10000);

            // Show the tutorial object
            Refs.Tutorial.SetStartMessage(FlightNumber.ToString());
            Refs.Tutorial.StartTutorial();
        }
Exemple #26
0
        public MultiSelectList GetAllDays(FlightNumber flightnumber)
        {
            List <Day> allDays = db.Days.OrderBy(c => c.DayID).ToList();


            List <Int32> SelectedDays = new List <Int32>();

            foreach (Day day in flightnumber.DepartureDays)
            {
                SelectedDays.Add(day.DayID);
            }

            MultiSelectList DaysSelectListMulti = new MultiSelectList(allDays, "DayID", "Name", SelectedDays);

            return(DaysSelectListMulti);
        }
Exemple #27
0
        public SelectList GetALlAirports(FlightNumber flightnumber, int index)
        {
            List <City> allCities = db.Cities.OrderBy(c => c.Airport).ToList();
            SelectList  CitySelected;

            if (index == 0)
            {
                CitySelected = new SelectList(allCities, "CityID", "Airport", flightnumber.startCity.CityID);
            }
            else
            {
                CitySelected = new SelectList(allCities, "CityID", "Airport", flightnumber.Route.Cities.Where(c => c != flightnumber.startCity));
            }


            return(CitySelected);
        }
Exemple #28
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FlightNumber flightNumber = db.FlightNumbers.Find(id);

            if (flightNumber == null)
            {
                return(HttpNotFound());
            }
            ViewBag.StartAirport = GetALlAirports(flightNumber, 0);
            ViewBag.EndAirport   = GetALlAirports(flightNumber, 1);
            ViewBag.AllDays      = GetAllDays(flightNumber);
            return(View(flightNumber));
        }
Exemple #29
0
        /// <summary>
        /// Данные у директивы обновляются по введенным данным
        /// </summary>
        /// <param name="_currentDirective"></param>
        public void ApplyChanges(FlightNumber _currentDirective)
        {
            _currentDirective.Distance           = (int)numericUpDownDistance.Value;
            _currentDirective.DistanceMeasure    = (Measure)comboBoxMeasure.SelectedItem;
            _currentDirective.MinLevel           = (CruiseLevel)dictComboBoxMinLevel.SelectedItem;
            _currentDirective.MaxPassengerAmount = (int)numericUpDownPassengers.Value;
            _currentDirective.MaxFuelAmount      = (double)numericUpDownFuel.Value;
            _currentDirective.MinFuelAmount      = (double)numericUpDownFuelRemainAfter.Value;
            _currentDirective.MaxPayload         = (double)numericUpDownPayload.Value;
            _currentDirective.MaxCargoWeight     = (double)numericUpDownCargo.Value;
            _currentDirective.MaxTakeOffWeight   = (double)numericUpDownTakeOffWeight.Value;
            _currentDirective.MaxLandWeight      = (double)numericUpDownMaxLandWeight.Value;

            dataGridViewCrew.ApplyChanges();
            //очистка текущей коллекции элементов
            _currentDirective.FlightNumberCrewRecords.Clear();
            //Получение всех элементов списка
            ICommonCollection icc = dataGridViewCrew.GetItemsArray();

            //добавление в редактируемый объект
            _currentDirective.FlightNumberCrewRecords.AddRange(icc);
            //очистка коллекции элементов списка для предотвращения утечки памяти
            icc.Clear();

            dataGridViewAirports.ApplyChanges();
            //очистка текущей коллекции элементов
            _currentDirective.AlternateAirports.Clear();
            //Получение всех элементов списка
            icc = dataGridViewAirports.GetItemsArray();
            //добавление в редактируемый объект
            _currentDirective.AlternateAirports.AddRange(icc);
            //очистка коллекции элементов списка для предотвращения утечки памяти
            icc.Clear();

            dataGridViewAircraftModels.ApplyChanges();
            //очистка текущей коллекции элементов
            _currentDirective.AircraftModels.Clear();
            //Получение всех элементов списка
            icc = dataGridViewAircraftModels.GetItemsArray();
            //добавление в редактируемый объект
            _currentDirective.AircraftModels.AddRange(icc);
            //очистка коллекции элементов списка для предотвращения утечки памяти
            icc.Clear();
        }
        private void InitFlightNumbers()
        {
            FlightNumber flightNumber1 = new FlightNumber();
            FlightNumber flightNumber2 = new FlightNumber();

            flightNumber1.Airline            = "EgyAir";
            flightNumber1.Departure          = DateTime.Now;
            flightNumber1.Description        = "New Flight";
            flightNumber2.Airline            = "USAir";
            flightNumber2.Departure          = DateTime.Now;
            flightNumber2.Description        = "New Air Flight";
            flightNumber1.StartAirport       = Airports.Find(p => p.Id == 1);
            flightNumber1.DestinationAirport = Airports.Find(p => p.Id == 2);
            flightNumber2.StartAirport       = Airports.Find(p => p.Id == 2);
            flightNumber2.DestinationAirport = Airports.Find(p => p.Id == 1);
            FlightNumbers.Add(flightNumber1);
            FlightNumbers.Add(flightNumber2);
            Airports.Find(a => a.Id == 1).FlightNumbers = FlightNumbers;
            Airports.Find(a => a.Id == 2).FlightNumbers = FlightNumbers;
        }