Exemple #1
0
        /// <summary>
        /// Computes the overall currency
        /// </summary>
        protected override void ComputeComposite()
        {
            // Compute currency according to 61.57(c)(1)-(5) and 61.57(e)
            // including each one's expiration.  The one that expires latest is the expiration date if you are current, the one that
            // expired most recently is the expiration date since when you were not current.

            // 61.57(c)(1) (66-HIT in airplane, flight simulator, ATD, or FTD) OR an IPC.
            FlightCurrency fcIFR = fcIPCOrCheckride.OR(fcIFRApproach.AND(fcIFRHold));

            CompositeCurrencyState = fcIFR.CurrentState;
            CompositeExpiration    = fcIFR.ExpirationDate;

            if (fcIPCOrCheckride.IsCurrent() && fcIPCOrCheckride.ExpirationDate.CompareTo(CompositeExpiration) >= 0)
            {
                Query.HasHolds = Query.HasApproaches = false;
                Query.PropertiesConjunction = GroupConjunction.Any;
                Query.PropertyTypes.Clear();
                foreach (CustomPropertyType cpt in CustomPropertyType.GetCustomPropertyTypes())
                {
                    if (cpt.IsIPC)
                    {
                        Query.PropertyTypes.Add(cpt);
                    }
                }
            }

            if (CompositeCurrencyState == CurrencyState.NotCurrent)
            {
                // if more than 6 calendar months have passed since expiration, an IPC is required.
                // otherwise, just assume 66-HIT.
                if (DateTime.Compare(CompositeExpiration.AddCalendarMonths(6).Date, DateTime.Now.Date) > 0)
                {
                    CompositeDiscrepancy = String.Format(CultureInfo.CurrentCulture, Resources.Currency.DiscrepancyTemplateIFR,
                                                         fcIFRHold.Discrepancy,
                                                         (fcIFRHold.Discrepancy == 1) ? Resources.Currency.Hold : Resources.Currency.Holds,
                                                         fcIFRApproach.Discrepancy,
                                                         (fcIFRApproach.Discrepancy == 1) ? Resources.Totals.Approach : Resources.Totals.Approaches);
                }
                else
                {
                    CompositeDiscrepancy = Resources.Currency.IPCRequired;
                }
            }
            else
            {
                // Check to see if IPC is required by looking for > 6 month gap in IFR currency.
                // For now, we won't make you un-current, but we'll warn.
                // (IPC above, though, is un-current).
                CurrencyPeriod[] rgcpMissingIPC = fcIFR.FindCurrencyGap(fcIPCOrCheckride.MostRecentEventDate, 6);

                CompositeDiscrepancy = rgcpMissingIPC != null
                    ? String.Format(CultureInfo.CurrentCulture, Resources.Currency.IPCMayBeRequired, rgcpMissingIPC[0].EndDate.ToShortDateString(), rgcpMissingIPC[1].StartDate.ToShortDateString())
                    : string.Empty;
            }
        }
Exemple #2
0
        /// <summary>
        /// Computes the overall currency
        /// </summary>
        protected override void ComputeComposite()
        {
            // Compute currency according to 61.57(c)(3) (i) and (ii) including each one's expiration.

            // 61.57(c)(6)(i) => (c)(3)(i) -  no passengers.  IPC covers this.
            FlightCurrency fc6157c6i = fcGliderIFRTime.AND(fcGliderInstrumentManeuvers).OR(fcGliderIPC);

            // 61.57(c)(6)(ii) => (c)(3)(ii) -  passengers.  Above + two more.  Again, IPC covers this too.
            FlightCurrency fc6157c6ii = fc6157c6i.AND(fcGliderIFRTimePassengers).AND(fcGliderInstrumentPassengers).OR(fcGliderIPC);

            m_fCurrentSolo       = fc6157c6i.IsCurrent();
            m_fCurrentPassengers = fc6157c6ii.IsCurrent();

            if (m_fCurrentSolo || m_fCurrentPassengers)
            {
                if (m_fCurrentPassengers)
                {
                    CompositeCurrencyState = fc6157c6ii.CurrentState;
                    CompositeExpiration    = fc6157c6ii.ExpirationDate;
                    CompositeDiscrepancy   = fc6157c6ii.DiscrepancyString;
                }
                else // must be current solo)
                {
                    CompositeCurrencyState = fc6157c6i.CurrentState;
                    CompositeExpiration    = fc6157c6i.ExpirationDate;
                    CompositeDiscrepancy   = fc6157c6i.DiscrepancyString;
                }

                // check to see if there is an embedded gap that needs an IPC
                CurrencyPeriod[] rgcpMissingIPC = fc6157c6i.FindCurrencyGap(fcGliderIPC.MostRecentEventDate, 6);
                if (rgcpMissingIPC != null && CompositeDiscrepancy.Length == 0)
                {
                    CompositeDiscrepancy = String.Format(CultureInfo.CurrentCulture, Resources.Currency.IPCMayBeRequired, rgcpMissingIPC[0].EndDate.ToShortDateString(), rgcpMissingIPC[1].StartDate.ToShortDateString());
                }
            }
            else
            {
                // And expiration date is the later of the passenger/no-passenger date
                CompositeExpiration = fc6157c6i.ExpirationDate.LaterDate(fc6157c6ii.ExpirationDate);

                // see if we need an IPC
                // if more than 6 calendar months have passed since expiration, an IPC is required.
                // otherwise, just name the one that is short
                CompositeDiscrepancy = DateTime.Compare(CompositeExpiration.AddCalendarMonths(6).Date, DateTime.Now.Date) > 0
                    ? String.Format(CultureInfo.CurrentCulture, Resources.Currency.DiscrepancyTemplateGliderIFRPassengers, fcGliderIFRTime.Discrepancy, fcGliderInstrumentManeuvers.Discrepancy)
                    : Resources.Currency.IPCRequired;
            }
        }