Esempio n. 1
0
        /// <summary>
        /// Computes the overall currency - DEPRECATED
        /// </summary>
        public void RefreshCurrencyOLD()
        {
            // Compute currency according to 61.57(c)(6) (i) and (ii)  => (c)(3) including each one's expiration.

            if (m_fCacheValid)
            {
                return;
            }

            m_szDiscrepancy = string.Empty;
            m_csCurrent     = CurrencyState.NotCurrent;
            m_dtExpiration  = DateTime.MinValue;

            DateTime dtExpirationSolo;
            DateTime dtExpirationPassengers;

            // 61.57(c)(6)(i)  => (c)(3)(i) - basic instrument currency
            if (fcGliderIFRTime.HasBeenCurrent && fcGliderInstrumentManeuvers.HasBeenCurrent)
            {
                // find the earliest expiration
                DateTime dtExpIFRTime = fcGliderIFRTime.ExpirationDate;
                DateTime dtExpInstMan = fcGliderInstrumentManeuvers.ExpirationDate;

                dtExpirationSolo = dtExpIFRTime;
                dtExpirationSolo = dtExpInstMan.EarlierDate(dtExpirationSolo);
                m_dtExpiration   = dtExpirationSolo;

                m_csCurrent = FlightCurrency.IsAlmostCurrent(m_dtExpiration) ? CurrencyState.GettingClose :
                              (FlightCurrency.IsCurrent(m_dtExpiration) ? CurrencyState.OK : CurrencyState.NotCurrent);

                m_fCurrentSolo = (m_csCurrent != CurrencyState.NotCurrent);

                // at this point we've determined if you're current for solo (61.57(c)(6)(i))  => (c)(3)(i); now see if we can carry passengers
                if (m_fCurrentSolo && fcGliderIFRTimePassengers.HasBeenCurrent && fcGliderInstrumentPassengers.HasBeenCurrent)
                {
                    DateTime dtExpIFRTimePassengers = fcGliderIFRTimePassengers.ExpirationDate;
                    DateTime dtExpIFRPassengers     = fcGliderInstrumentPassengers.ExpirationDate;

                    dtExpirationPassengers = dtExpIFRTimePassengers.EarlierDate(dtExpIFRPassengers);

                    CurrencyState csPassengers = FlightCurrency.IsAlmostCurrent(dtExpirationPassengers) ? CurrencyState.GettingClose :
                                                 (FlightCurrency.IsCurrent(dtExpirationPassengers) ? CurrencyState.OK : CurrencyState.NotCurrent);

                    // if current for passengers, then we are the more restrictive of overall close to losing currency or fully current.
                    if (m_fCurrentPassengers = (csPassengers != CurrencyState.NotCurrent))
                    {
                        m_csCurrent    = (m_csCurrent == CurrencyState.OK && csPassengers == CurrencyState.OK) ? CurrencyState.OK : CurrencyState.GettingClose;
                        m_dtExpiration = dtExpirationPassengers.EarlierDate(dtExpirationSolo);
                    }
                }
            }

            // IPC can also set currency.
            if (fcGliderIPC.HasBeenCurrent)
            {
                // set currency to the most permissive of either current state or IPC state
                m_csCurrent = (fcGliderIPC.CurrentState > m_csCurrent) ? fcGliderIPC.CurrentState : m_csCurrent;

                // Expiration date is the LATER of the current expiration date OR the IPC expiration date, with one exception below.
                m_dtExpiration = fcGliderIPC.ExpirationDate.LaterDate(m_dtExpiration);

                // if you have a valid IPC, you are currently valid for both passengers and solo.
                // however, IPC could expire before the solo requirements expire, so if it is the
                // IPC that is driving passengers, use the IPC date as the expiration date.  Otherwise, use the later one.
                // That way, when the IPC expires, your passenger privs expire too, so you'll see a new "no passengers" priv remaining
                // with a new date.
                if (fcGliderIPC.IsCurrent())
                {
                    if (m_fCurrentSolo && !m_fCurrentPassengers)
                    {
                        m_dtExpiration = fcGliderIPC.ExpirationDate;
                    }
                    m_fCurrentPassengers = m_fCurrentSolo = true;
                }
            }

            m_fCacheValid = true;
        }