Exemple #1
0
        public PlanOpsForm(FlightPlanOps flightPlanOps, IList <DateTime> dates) : this()
        {
            if (flightPlanOps == null)
            {
                return;
            }

            _flightPlanOps = flightPlanOps;
            _dates         = dates;
        }
Exemple #2
0
        public FlightPlanOpsRecordListScreen(Operator currentOperator, FlightPlanOps currentPlanOps, bool calculated = false) : this()
        {
            if (currentOperator == null)
            {
                throw new ArgumentNullException("currentOperator");
            }
            _currentPlanOps = currentPlanOps;
            _calculated     = calculated;
            aircraftHeaderControl1.Operator = currentOperator;
            statusControl.ShowStatus        = false;


            _filter = new CommonFilterCollection(typeof(IFlightPlanOpsRecordsFilterParams));

            InitToolStripMenuItems();
            InitListView();
            UpdateInformation();
        }
Exemple #3
0
        public void CreateCopyFromExistPlan(FlightPlanOps currentPlanOps)
        {
            var records = loadOpsRecordsByPlanOpsId(currentPlanOps.ItemId);

            var copyPlanOps = currentPlanOps.GetCopyUnsaved();

            _newKeeper.Save(copyPlanOps);

            var newRecords = CalculateTripForPeriod(copyPlanOps);

            foreach (var newRecord in newRecords)
            {
                var track = records.FirstOrDefault(i => i.FlightTrackRecordId == newRecord.FlightTrackRecordId);
                if (track != null)
                {
                    newRecord.AircraftId         = track.AircraftId;
                    newRecord.AircraftExchangeId = track.AircraftExchangeId;
                }
                _newKeeper.Save(newRecord);
            }
        }
Exemple #4
0
        public List <FlightPlanOpsRecords> CalculateTripForPeriod(FlightPlanOps currentPlanOps)
        {
            var preResult = new List <FlightPlanOpsRecords>();

            var calculatedDates    = DateTimeExtend.AllDatesBetween(currentPlanOps.From, currentPlanOps.To).ToList();
            var flightTrackRecords = _flightTrackCore.GetAllFlightScheduleRecordsForPeriod(currentPlanOps.From, currentPlanOps.To, true);

            flightTrackRecords.AddRange(_flightTrackCore.GetAllFlightUnScheduleRecordsForPeriod(currentPlanOps.From, currentPlanOps.To, true));

            foreach (var record in flightTrackRecords)
            {
                var date = getDateFromDayofWeek(record.FlightTrack.DayOfWeek, calculatedDates);
                if (date < DateTimeExtend.GetCASMinDateTime())
                {
                    continue;
                }

                if (record.FlightType == FlightType.Schedule && !(date >= record.FlightNumberPeriod.DepartureDate.Date && date <= record.FlightNumberPeriod.ArrivalDate.Date))
                {
                    continue;
                }
                var newOps = new FlightPlanOpsRecords
                {
                    Date = date.Value,
                    FlightTrackRecord   = record,
                    FlightTrackRecordId = record.ItemId,
                    ParentFlightPlanOps = currentPlanOps,
                    PeriodFrom          = record.FlightNumberPeriod?.PeriodFrom ?? 0,
                    PeriodTo            = record.FlightNumberPeriod?.PeriodTo ?? 0
                };

                preResult.Add(newOps);
            }

            return(preResult);
        }