/// <summary> /// Computes the overall currency /// </summary> public void RefreshCurrency() { // Compute currency according to 61.57(c)(6) ( => (c)(3)) (i) and (ii) including each one's expiration. if (m_fCacheValid) { return; } // 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) { m_csCurrent = fc6157c6ii.CurrentState; m_dtExpiration = fc6157c6ii.ExpirationDate; m_szDiscrepancy = fc6157c6ii.DiscrepancyString; } else // must be current solo) { m_csCurrent = fc6157c6i.CurrentState; m_dtExpiration = fc6157c6i.ExpirationDate; m_szDiscrepancy = 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 && m_szDiscrepancy.Length == 0) { m_szDiscrepancy = 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 m_dtExpiration = 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 if (DateTime.Compare(m_dtExpiration.AddCalendarMonths(6).Date, DateTime.Now.Date) > 0) { m_szDiscrepancy = String.Format(CultureInfo.CurrentCulture, Resources.Currency.DiscrepancyTemplateGliderIFRPassengers, fcGliderIFRTime.Discrepancy, fcGliderInstrumentManeuvers.Discrepancy); } else { m_szDiscrepancy = Resources.Currency.IPCRequired; } } m_fCacheValid = true; }
protected void btnViewDutyPeriods_Click(object sender, EventArgs e) { pnlResults.Visible = true; DutyPeriodExaminer dpe = new DutyPeriodExaminer(Profile.GetUser(Page.User.Identity.Name).UsesFAR117DutyTimeAllFlights); DBHelper dbh = new DBHelper(FlightCurrency.CurrencyQuery(FlightCurrency.CurrencyQueryDirection.Descending)); dbh.ReadRows( (comm) => { comm.Parameters.AddWithValue("UserName", Page.User.Identity.Name); comm.Parameters.AddWithValue("langID", Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName); }, (dr) => { dpe.ExamineFlight(new ExaminerFlightRow(dr)); }); dpe.Finalize(0, 0); TimeSpan ts = new TimeSpan(decDayTimeSpan.IntValue, 0, 0, 0); lblCutoffDate.Text = DateTime.UtcNow.Subtract(ts).UTCDateFormatString(false); IEnumerable <EffectiveDutyPeriod> effectiveDutyPeriods = dpe.EffectiveDutyPeriods; decimal dutyTime = EffectiveDutyPeriod.DutyTimeSince(ts, effectiveDutyPeriods); decimal flightdutyTime = EffectiveDutyPeriod.FlightDutyTimeSince(ts, effectiveDutyPeriods); decimal rest = (decimal)((decimal)ts.TotalHours - dutyTime); lblTotalFlightDuty.Text = String.Format(CultureInfo.CurrentCulture, "{0:#,##0.0}hrs ({1})", flightdutyTime, flightdutyTime.ToHHMM()); lblTotalDuty.Text = String.Format(CultureInfo.CurrentCulture, "{0:#,##0.0}hrs ({1})", dutyTime, dutyTime.ToHHMM()); lblTotalRest.Text = String.Format(CultureInfo.CurrentCulture, "{0:#,##0.0}hrs ({1})", rest, rest.ToHHMM()); gvDutyPeriods.DataSource = dpe.EffectiveDutyPeriods; gvDutyPeriods.DataBind(); }
/// <summary> /// Computes the overall currency /// </summary> protected override void ComputeComposite() { // Only bother doing any real computation if we've ever been fully current on things. if (fcHoursSPL.HasBeenCurrent && fcHoursTMG.HasBeenCurrent && fcLandings.HasBeenCurrent && fcProficiency.HasBeenCurrent && fcTrainingFlights.HasBeenCurrent) { FlightCurrency fcAggregate = fcHoursSPL.AND(fcHoursTMG).AND(fcLandings).AND(fcProficiency).AND(fcTrainingFlights); CompositeCurrencyState = fcAggregate.CurrentState; CompositeExpiration = fcAggregate.ExpirationDate; CompositeDiscrepancy = string.Empty; // Set a discrepancy string in order that we find one if (CompositeCurrencyState == CurrencyState.NotCurrent) { CompositeDiscrepancy = !fcHoursSPL.IsCurrent() ? String.Format(CultureInfo.CurrentCulture, Resources.Currency.DiscrepancyTemplate, fcHoursSPL.Discrepancy, Resources.Currency.HoursSailPlane) : !fcHoursTMG.IsCurrent() ? String.Format(CultureInfo.CurrentCulture, Resources.Currency.DiscrepancyTemplate, fcHoursTMG.Discrepancy, Resources.Currency.HoursTMG) : !fcLandings.IsCurrent() ? String.Format(CultureInfo.CurrentCulture, Resources.Currency.DiscrepancyTemplate, fcLandings.Discrepancy, Resources.Currency.Landings) : !fcTrainingFlights.IsCurrent() ? String.Format(CultureInfo.CurrentCulture, Resources.Currency.DiscrepancyTemplate, fcTrainingFlights.Discrepancy, Resources.Currency.TrainingFlights) : Resources.Currency.ProficiencyCheckRequired; } } }
protected override void ComputeComposite() { FlightCurrency fcComposite = this.AND(NightTakeoffCurrency); CompositeCurrencyState = fcComposite.CurrentState; CompositeDiscrepancy = fcComposite.DiscrepancyString; CompositeExpiration = fcComposite.ExpirationDate; }
/// <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; } }
protected LAPLBase(int cLandings, decimal picTime, int period, string szName) : base() { fcLandings = new FlightCurrency(cLandings, period, true, "Landings (takeoffs implied)"); fcAlternateLandings = new FlightCurrency(cLandings, period, true, "Alternate Landings (takeoffs implied)"); fcPIC = new FlightCurrency(picTime, period, true, "PIC time"); fcAlternatePIC = new FlightCurrency(picTime, period, true, "Alternate PIC time"); fcDual = new FlightCurrency(1.0M, period, true, "Dual"); fcProficiencyCheck = new FlightCurrency(1, period, true, "Proficiency check"); DisplayName = szName; DiscrepancyOverride = null; }
private void RefreshCurrency() { if (m_fCacheValid) { return; } // Compute both loose (ignores takeoffs) and strict (requires takeoffs) night currencies. // Discrepancy can't be counted on after AND/OR so we set that to the one we wish to expose FlightCurrency fc6157b = this; // just for clarity that the "this" object does the basic 61.57(b) implementation. FlightCurrency fc6157e4i = m_fc6157eTotalTime.AND(m_fc6157Passenger).AND(m_fc6157TimeInType).AND(m_fc6157ei); FlightCurrency fc6157e4ii = m_fc6157eTotalTime.AND(m_fc6157Passenger).AND(m_fc6157TimeInType).AND(m_fc6157eii); FlightCurrency fcLoose = fc6157b.OR(fc6157e4i.OR(fc6157e4ii)); fcLoose.Discrepancy = fc6157b.Discrepancy; FlightCurrency fc6157bStrict = fc6157b.AND(NightTakeoffCurrency); FlightCurrency fc6157e4iStrict = fc6157e4i.AND(m_fc6157eiTakeoffs); FlightCurrency fc6157e4iiStrict = fc6157e4ii.AND(m_fc6157eiiTakeoffs); FlightCurrency fcStrict = fc6157bStrict.OR(fc6157e4iStrict).OR(fc6157e4iiStrict); // Loose rules for purposes of determining state m_csCurrent = fcLoose.CurrentState; m_dtExpiration = fcLoose.ExpirationDate; m_szDiscrepancy = fcLoose.DiscrepancyString; // determine the correct discrepancy string to show // if we've met the strict definition, we're fine - no discrepancy if (fcStrict.CurrentState.IsCurrent()) { m_szDiscrepancy = string.Empty; m_dtExpiration = fcStrict.ExpirationDate; } // else if we met the loose definition but not strict - meaning takeoffs were not found; Give a reminder about required takeoffs else if (m_csCurrent.IsCurrent()) { if (NightTakeoffCurrency.Discrepancy >= NightTakeoffCurrency.RequiredEvents) { m_szDiscrepancy = Resources.Currency.NightTakeoffReminder; } else { m_szDiscrepancy = String.Format(CultureInfo.CurrentCulture, Resources.Currency.DiscrepancyTemplateNight, NightTakeoffCurrency.Discrepancy, (NightTakeoffCurrency.Discrepancy > 1) ? Resources.Currency.Takeoffs : Resources.Currency.Takeoff); } } // else we aren't current at all - use the full discrepancy template using 61.57(b). DON'T CALL DISCREPANCY STRING because that causes an infinite recursion. else { m_szDiscrepancy = String.Format(CultureInfo.CurrentCulture, Resources.Currency.DiscrepancyTemplate, this.Discrepancy, (this.Discrepancy > 1) ? Resources.Totals.Landings : Resources.Totals.Landing); } m_fCacheValid = true; }
public NightCurrency(string szName) : base(RequiredLandings, TimeSpan, false, szName) { NightTakeoffCurrency = new FlightCurrency(RequiredTakeoffs, TimeSpan, false, szName); Query = new FlightQuery() { DateRange = FlightQuery.DateRanges.Trailing90, HasNightLandings = true, PropertiesConjunction = GroupConjunction.None }; Query.PropertyTypes.Add(CustomPropertyType.GetCustomPropertyType((int)CustomPropertyType.KnownProperties.IDPropPilotMonitoring)); }
/// <summary> /// Computes the overall currency /// </summary> protected override void ComputeComposite() { if (fcLandings.HasBeenCurrent || fcHours.HasBeenCurrent) { FlightCurrency fcAggregate = fcHours.OR(fcLandings); CompositeCurrencyState = fcAggregate.CurrentState; CompositeExpiration = fcAggregate.ExpirationDate; // By definition, if we are not current then both are not current. Arbitrarily pick hours as instructor as discrepancy CompositeDiscrepancy = (CompositeCurrencyState == CurrencyState.NotCurrent) ? String.Format(CultureInfo.CurrentCulture, Resources.Currency.DiscrepancyTemplate, fcHours.Discrepancy, Resources.Currency.HoursAsInstructor) : string.Empty; } }
public override void Finalize(decimal totalTime, decimal picTime) { FlightCurrency fcNormal = fcLandings.AND(fcPIC).AND(fcDual); FlightCurrency fcAlternate = fcAlternateLandings.AND(fcAlternatePIC); FlightCurrency fcIPCAlternate = fcAlternate.OR(fcProficiencyCheck); fcResult = fcNormal.OR(fcIPCAlternate); // If you're NOT current, then you MUST follow the alternate OR a proficiency check. So don't give a "short by", just say that you need that. if (!fcResult.IsCurrent()) { DiscrepancyOverride = Resources.Currency.LAPLProficiencyCheckRequired; } }
protected override void ComputeComposite() { /* * MUST meet: * - 401.05(1)(a) OR 401.05(1)(b) AND * - 401.05(3) (24 month IPC) AND * - 6 hours and 6 approaches IF the review is more than 12 months old * * To do the latter two, we do this as (12 month IPC) OR (24 month IPC AND 6+6) */ FlightCurrency fcIFRCanada = (fc401_05_3_a_c_12month.OR(fc401_05_3_a_c_24month.AND(fc401_05_3_1_aTime).AND(fc401_05_3_1_bApproaches))).AND(fc401_05_1a.OR(fc401_05_1b)); CompositeCurrencyState = fcIFRCanada.CurrentState; CompositeExpiration = fcIFRCanada.ExpirationDate; // If the IPC is controlling, then display that an IPC is required. CompositeDiscrepancy = fc401_05_3_a_c_24month.IsCurrent() ? string.Empty : Resources.Currency.IPCRequired; }
protected override void ComputeComposite() { // Compute both loose (ignores takeoffs) and strict (requires takeoffs) night currencies. // Discrepancy can't be counted on after AND/OR so we set that to the one we wish to expose FlightCurrency fc6157b = this; // just for clarity that the "this" object does the basic 61.57(b) implementation. FlightCurrency fc6157e4i = m_fc6157eTotalTime.AND(m_fc6157Passenger).AND(m_fc6157TimeInType).AND(m_fc6157ei); FlightCurrency fc6157e4ii = m_fc6157eTotalTime.AND(m_fc6157Passenger).AND(m_fc6157TimeInType).AND(m_fc6157eii); FlightCurrency fcLoose = fc6157b.OR(fc6157e4i.OR(fc6157e4ii)); fcLoose.Discrepancy = fc6157b.Discrepancy; FlightCurrency fc6157bStrict = fc6157b.AND(NightTakeoffCurrency); FlightCurrency fc6157e4iStrict = fc6157e4i.AND(m_fc6157eiTakeoffs); FlightCurrency fc6157e4iiStrict = fc6157e4ii.AND(m_fc6157eiiTakeoffs); FlightCurrency fcStrict = fc6157bStrict.OR(fc6157e4iStrict).OR(fc6157e4iiStrict); // Loose rules for purposes of determining state CompositeCurrencyState = fcLoose.CurrentState; CompositeExpiration = fcLoose.ExpirationDate; CompositeDiscrepancy = fcLoose.DiscrepancyString; // determine the correct discrepancy string to show // if we've EVER met the strict definition, then use that - indicates we've logged at least some takeoffs. if (fcStrict.HasBeenCurrent) { CompositeExpiration = fcStrict.ExpirationDate; CompositeCurrencyState = fcStrict.CurrentState; CompositeDiscrepancy = fcStrict.CurrentState == CurrencyState.NotCurrent ? String.Format(CultureInfo.CurrentCulture, Resources.Currency.DiscrepancyTemplate, Math.Max(NightTakeoffCurrency.Discrepancy, fc6157b.Discrepancy), NightTakeoffCurrency.Discrepancy > fc6157b.Discrepancy ? Resources.Currency.NightTakeoffs : (fc6157b.Discrepancy > 1 ? Resources.Totals.Landings : Resources.Totals.Landing)) : string.Empty; } // else if we met the loose definition but not strict - meaning takeoffs were not found; Give a reminder about required takeoffs else if (CompositeCurrencyState.IsCurrent()) { CompositeDiscrepancy = NightTakeoffCurrency.Discrepancy >= NightTakeoffCurrency.RequiredEvents ? Resources.Currency.NightTakeoffReminder : String.Format(CultureInfo.CurrentCulture, Resources.Currency.DiscrepancyTemplateNight, NightTakeoffCurrency.Discrepancy, (NightTakeoffCurrency.Discrepancy > 1) ? Resources.Currency.Takeoffs : Resources.Currency.Takeoff); } // else we aren't current at all - use the full discrepancy template using 61.57(b). DON'T CALL DISCREPANCY STRING because that causes an infinite recursion. else { CompositeDiscrepancy = String.Format(CultureInfo.CurrentCulture, Resources.Currency.DiscrepancyTemplate, this.Discrepancy, (this.Discrepancy > 1) ? Resources.Totals.Landings : Resources.Totals.Landing); } }
private void RefreshCurrency() { if (m_fCacheValid) { return; } // 401.05(3)(a)-(c) say you have an IPC OR 6approaches+6hours OR 6approaches+6hours instructing. FlightCurrency fcIFRCanada = fc401_05_3_a.OR(fc401_05_3_bTime.AND(fc401_05_3_bApproaches)).OR(fc401_05_3_cTime.AND(fc401_05_3_cApproaches)); m_csCurrent = fcIFRCanada.CurrentState; m_dtExpiration = fcIFRCanada.ExpirationDate; if (m_csCurrent == CurrencyState.NotCurrent) { m_szDiscrepancy = Resources.Currency.IPCRequired; } m_fCacheValid = true; }
/// <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; }
public MilestoneItemDecayable(string title, string farref, string note, MilestoneType type, decimal threshold, int timespan, bool fCalendar = true) : base(title, farref, note, type, threshold) { DecayingCurrency = new FlightCurrency(threshold, timespan, fCalendar, string.Empty); }
/// <summary> /// Computes the overall currency /// </summary> protected void RefreshCurrency() { // 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. if (m_fCacheValid) { return; } // This is ((61.57(c)(1) OR (2) OR (3) OR (4) OR (5) OR 61.57(e)), each of which is the AND of several currencies. // 61.57(c)(1) (66-HIT in airplane) FlightCurrency fc6157c1 = fcIFRApproach.AND(fcIFRHold); // 61.57(c)(2) (66-HIT in an FTD or flight simulator) FlightCurrency fc6157c2 = fcFTDApproach.AND(fcFTDHold); // 61.57(c)(3) - ATD FlightCurrency fc6157c3 = fcATDHold.AND(fcATDApproach).AND(fcUnusualAttitudesAsc).AND(fcUnusualAttitudesDesc).AND(fcInstrumentHours); // 61.57(c)(4) - Combo STRICT - 6 approaches/hold in an ATD PLUS an approach/hold in an airplane PLUS an approach/hold in an FTD FlightCurrency fc6157c4 = fcATDAppch6Month.AND(fcATDHold6Month).AND(fcIFRHold).AND(fcAirplaneApproach6Month).AND(fcFTDApproach6Month).AND(fcFTDHold); // 61.57(c)(4) - Combo LOOSE - any combination that yields 66-HIT, but require at least one aircraft approach and hold. // FlightCurrency fc6157c4Loose = fcComboApproach6Month.AND(fcAirplaneApproach6Month).AND(fcIFRHold.OR(fcATDHold6Month).OR(fcFTDHold)); // 61.57(c)(5) - combo meal, but seems redundant with (c)(2)/(3). I.e., if you've met this, you've met (2) or (3). // 61.57 (e) - IPC; no need to AND anything together for this one. FlightCurrency fcIFR = fc6157c1.OR(fc6157c2).OR(fc6157c3).OR(fc6157c4).OR(fcIPCOrCheckride); /* * if (m_fUseLoose6157c4) * fcIFR = fcIFR.OR(fc6157c4Loose); */ m_csCurrent = fcIFR.CurrentState; m_dtExpiration = fcIFR.ExpirationDate; if (fcIPCOrCheckride.IsCurrent() && fcIPCOrCheckride.ExpirationDate.CompareTo(m_dtExpiration) >= 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 (m_csCurrent == CurrencyState.NotCurrent) { // if more than 6 calendar months have passed since expiration, an IPC is required. // otherwise, just assume 66-HIT. if (DateTime.Compare(m_dtExpiration.AddCalendarMonths(6).Date, DateTime.Now.Date) > 0) { m_szDiscrepancy = 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 { m_szDiscrepancy = 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); if (rgcpMissingIPC != null) { m_szDiscrepancy = String.Format(CultureInfo.CurrentCulture, Resources.Currency.IPCMayBeRequired, rgcpMissingIPC[0].EndDate.ToShortDateString(), rgcpMissingIPC[1].StartDate.ToShortDateString()); } else { m_szDiscrepancy = string.Empty; } } m_fCacheValid = true; }
public UASCurrency() { TrainingCourse = new FlightCurrency(1, 24, true, "107.65(a)"); KnowledgeTest = new FlightCurrency(1, 24, true, "107.65(b)"); BFR = new FlightCurrency(1, 24, true, "107.65(c)"); }