Example #1
0
        public override void ExamineFlight(ExaminerFlightRow cfr)
        {
            if (cfr == null)
            {
                throw new ArgumentNullException(nameof(cfr));
            }
            if (cfr.FlightProps.PropertyExistsWithID(CustomPropertyType.KnownProperties.IDPropPilotMonitoring) || cfr.Night == 0.0M || !cfr.fIsCertifiedLanding)
            {
                return;
            }

            int  cNightTouchAndGo   = cfr.FlightProps.TotalCountForPredicate(fp => fp.PropTypeID == (int)CustomPropertyType.KnownProperties.IDPropNightTouchAndGo);
            int  cNightTakeoffs     = cfr.FlightProps.TotalCountForPredicate(fp => fp.PropTypeID == (int)CustomPropertyType.KnownProperties.IDPropNightTakeoff) + cNightTouchAndGo;
            int  cNightLandings     = cfr.cFullStopNightLandings + cNightTouchAndGo;
            bool fMeetsFlightReview = false;

            cfr.FlightProps.ForEachEvent((cfp) =>
            {
                if ((cfp.PropertyType.IsIPC || cfp.PropertyType.IsBFR) && cNightLandings > 0 && cNightTakeoffs > 0)
                {
                    fMeetsFlightReview = true;
                }
            });

            if (fMeetsFlightReview)
            {
                AddRecentFlightEvents(cfr.dtFlight, 3);
                NightTakeoffCurrency.AddRecentFlightEvents(cfr.dtFlight, 3);
            }
            else
            {
                AddRecentFlightEvents(cfr.dtFlight, cNightLandings);
                NightTakeoffCurrency.AddRecentFlightEvents(cfr.dtFlight, cNightTakeoffs);
            }
        }
 /// <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);
     }
 }