예제 #1
0
        public override void ExamineFlight(ExaminerFlightRow cfr)
        {
            if (cfr == null)
            {
                throw new ArgumentNullException("cfr");
            }

            // No training devices for sport pilots
            if (!cfr.fIsRealAircraft)
            {
                return;
            }

            // Keep track of heavier-than-air time, reduce minimums if achieved
            if (CategoryClass.IsHeavierThanAir(cfr.idCatClassOverride))
            {
                TotalHeavierThanAir += cfr.Total;
                if (!QualifiesByHeavierThanAir && TotalHeavierThanAir >= 20)
                {
                    QualifiesByHeavierThanAir      = true;
                    miMinTime.Threshold            = 3;
                    miMinTrainingFlights.Threshold = 5;
                    miMinSolo.Threshold            = 1;
                    miMinSolo.Threshold            = 3;
                }
            }

            // now reject anything not in a glider
            if (CatClassID != cfr.idCatClassOverride)
            {
                return;
            }

            miMinTime.AddEvent(cfr.Total);
            if (cfr.Dual > 0)
            {
                miMinTrainingFlights.AddEvent(Math.Max(1, cfr.cLandingsThisFlight));
                if (DateTime.Now.AddCalendarMonths(-2).CompareTo(cfr.dtFlight) <= 0)
                {
                    miTestPrep.AddEvent(cfr.Dual);
                }
            }

            decimal soloTime = 0.0M;

            cfr.ForEachEvent(pf => { if (pf.PropertyType.IsSolo)
                                     {
                                         soloTime += pf.DecValue;
                                     }
                             });
            if (soloTime > 0)
            {
                miMinSolo.AddEvent(soloTime);
                miMinSoloFlights.AddEvent(cfr.cLandingsThisFlight); // assuming no touch-and-go in a glider!
            }
        }