/// <summary>
 /// Adds night-time takeoff(s) to the currency.  This is mostly informative - we don't currently require these to be logged
 /// </summary>
 /// <param name="dt">The date of the takeoff(s)</param>
 /// <param name="cEvents">The number of takeoffs</param>
 /// <param name="nco">Indicates whether 61.57(e) applies, and if so, whether it is sim or real aircraft</param>
 private void AddNighttimeTakeOffEvent(DateTime dt, decimal cEvents, NightCurrencyOptions nco)
 {
     NightTakeoffCurrency.AddRecentFlightEvents(dt, cEvents);
     if (nco == NightCurrencyOptions.FAR6157eAirplane)
     {
         m_fc6157eiTakeoffs.AddRecentFlightEvents(dt, cEvents);
     }
     else if (nco == NightCurrencyOptions.FAR6157eSim)
     {
         m_fc6157eiiTakeoffs.AddRecentFlightEvents(dt, cEvents);
     }
 }
 /// <summary>
 /// Adds night-time landing(s) to the currency.
 /// </summary>
 /// <param name="dt">The date of the landing(s)</param>
 /// <param name="cEvents">The number of landings</param>
 /// <param name="nco">Indicates whether 61.57(e) applies, and if so, whether it is sim or real aircraft</param>
 private void AddNighttimeLandingEvent(DateTime dt, decimal cEvents, NightCurrencyOptions nco)
 {
     AddRecentFlightEvents(dt, cEvents);
     if (nco == NightCurrencyOptions.FAR6157eAirplane)
     {
         m_fc6157ei.AddRecentFlightEvents(dt, cEvents);
     }
     else if (nco == NightCurrencyOptions.FAR6157eSim)
     {
         m_fc6157eii.AddRecentFlightEvents(dt, cEvents);
     }
 }
Exemple #3
0
        public override void ExamineFlight(ExaminerFlightRow cfr)
        {
            if (cfr == null)
            {
                throw new ArgumentNullException(nameof(cfr));
            }
            base.ExamineFlight(cfr);

            if (!cfr.fIsCertifiedLanding)
            {
                return;
            }

            // 61.57(e) only applies if turbine and type rated.  Everything else must be in certified landing, or turbine airplane, or not type rated, or not in the type for this aircraft
            bool fIsMatchingType     = !String.IsNullOrEmpty(TypeDesignator) && cfr.szType.CompareCurrentCultureIgnoreCase(cfr.szType) == 0 && CategoryClass.IsAirplane(cfr.idCatClassOverride) && cfr.turbineLevel.IsTurbine() && !cfr.fIsCertifiedSinglePilot;
            NightCurrencyOptions nco = fIsMatchingType ? (cfr.fIsRealAircraft ? NightCurrencyOptions.FAR6157eAirplane : NightCurrencyOptions.FAR6157eSim) : NightCurrencyOptions.FAR6157bOnly;

            // 61.57(e)(4)(i/ii)(A) - 1500 hrs - comes into play after finalize

            // 61.57(e)(4)(i/ii)(C) - 15 hours in this type in the last 90 days.  Only if in an actual aircraft, since it doesn't seem to allow sim time.
            // Do this first because we'll exclude others if you were pilot monitoring
            if (nco == NightCurrencyOptions.FAR6157eAirplane)
            {
                m_fc6157TimeInType.AddRecentFlightEvents(cfr.dtFlight, cfr.Total);
            }

            if (!cfr.FlightProps.PropertyExistsWithID(CustomPropertyType.KnownProperties.IDPropPilotMonitoring))
            {
                // we need to subtract out monitored landings, or ignore all if you were monitoring for the whole flight
                int cMonitoredLandings = cfr.FlightProps.IntValueForProperty(CustomPropertyType.KnownProperties.IDPropMonitoredNightLandings);
                int cMonitoredTakeoffs = cfr.FlightProps.IntValueForProperty(CustomPropertyType.KnownProperties.IDPropMonitoredNightTakeoffs);
                int cNightLandings     = cfr.cFullStopNightLandings + (AllowTouchAndGo ? cfr.FlightProps.IntValueForProperty(CustomPropertyType.KnownProperties.IDPropNightTouchAndGo) : 0);

                // 61.57(e)(4)(i/ii)(B) - passenger currency in this type
                m_fc6157Passenger.ExamineFlight(cfr);

                // 61.57(b), 61.57(e)(4)(i/ii)(D) - Night takeoffs/landings
                if (cNightLandings > 0)
                {
                    AddNighttimeLandingEvent(cfr.dtFlight, Math.Max(cNightLandings - cMonitoredLandings, 0), nco);
                }

                // Night-time take-offs are also technically required for night currency
                int cNightTakeoffs = cfr.FlightProps.TotalCountForPredicate(cfp => cfp.PropertyType.IsNightTakeOff);
                if (cNightTakeoffs > 0)
                {
                    AddNighttimeTakeOffEvent(cfr.dtFlight, Math.Max(cNightTakeoffs - cMonitoredTakeoffs, 0), nco);
                }
            }
        }