Exemplo n.º 1
0
        static void AddInstrumentCurrency(Section section, string caption, List <Aircraft> aircraft)
        {
            DateTime oldestApproach;
            int      approaches = 0;
            int      holds      = 0;

            if (aircraft != null && aircraft.Count > 0)
            {
                foreach (var flight in LogBook.GetFlightsForInstrumentCurrencyRequirements(aircraft))
                {
                    approaches += flight.InstrumentApproaches;
                    holds      += flight.InstrumentHoldingProcedures;

                    oldestApproach = flight.Date;

                    if (approaches >= 6 && holds > 0)
                    {
                        DateTime expires = GetInstrumentCurrencyExipirationDate(oldestApproach);
                        section.Add(new CurrencyElement(caption, expires));
                        return;
                    }
                }
            }

            // currency is out of date
            section.Add(new CurrencyElement(caption, DateTime.Today));
        }
Exemplo n.º 2
0
        void AddInstrumentCurrency(Section section, List <Aircraft> list, AircraftCategory category)
        {
            string   caption        = "Instrument Current";
            DateTime oldestApproach = DateTime.Now;
            int      approaches     = 0;

            foreach (var flight in LogBook.GetFlightsForInstrumentCurrencyRequirements(list))
            {
                approaches    += flight.InstrumentApproaches;
                oldestApproach = flight.Date;

                if (approaches >= 6)
                {
                    DateTime expires = GetInstrumentCurrencyExipirationDate(oldestApproach);
                    section.Add(new CurrencyElement(caption, expires));
                    return;
                }
            }

            // currency is out of date
            section.Add(new CurrencyElement(caption, DateTime.Now));
        }