Ejemplo n.º 1
0
        public DPEBase(DPEThresholds dpet, CategoryClass.CatClassID ccid, string szFarRef)
        {
            if (dpet == null)
            {
                throw new ArgumentNullException("dpet");
            }
            BaseFAR = "Order 8900.2A";
            string szResolved = ResolvedFAR(szFarRef);

            catClass = CategoryClass.CategoryClassFromID(ccid);
            string szCatClass = String.Format(CultureInfo.CurrentCulture, Resources.LocalizedText.LocalizedJoinWithSpace, catClass.Category, catClass.Class);

            miPIC                   = new MilestoneItem(String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.DPEPICTime, dpet.PIC), szResolved, string.Empty, MilestoneItem.MilestoneType.Time, dpet.PIC);
            miPICPastYear           = new MilestoneItem(String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.DPEPICTimePastYear, dpet.PICPastYear, catClass.Category), szResolved, string.Empty, MilestoneItem.MilestoneType.Time, dpet.PICPastYear);
            miPICCategory           = new MilestoneItem(String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.DPEPICCategory, dpet.PICCategory, catClass.Category), szResolved, string.Empty, MilestoneItem.MilestoneType.Time, dpet.PICCategory);
            miPICClass              = new MilestoneItem(String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.DPEPICClass, dpet.PICClass, szCatClass), szResolved, string.Empty, MilestoneItem.MilestoneType.Time, dpet.PICClass);
            miPICNight              = new MilestoneItem(String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.DPEPICNight, dpet.PICNight), szResolved, string.Empty, MilestoneItem.MilestoneType.Time, dpet.PICNight);
            miCFICategory           = new MilestoneItem(String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.DPECFICategory, dpet.CFICategory, catClass.Category), szResolved, string.Empty, MilestoneItem.MilestoneType.Time, dpet.CFICategory);
            miCFIClass              = new MilestoneItem(String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.DPECFIClass, dpet.CFIClass, szCatClass), szResolved, string.Empty, MilestoneItem.MilestoneType.Time, dpet.CFIClass);
            miPICFlightsInPriorYear = new MilestoneItem(String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.DPEFlightsPastYear, dpet.PICFlightsInClassPriorYear, catClass.Category), szResolved, string.Empty, MilestoneItem.MilestoneType.Count, dpet.PICFlightsInClassPriorYear);
            miPICComplexTime        = new MilestoneItem(String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.DPEComplex, dpet.PICComplexTime), szResolved, string.Empty, MilestoneItem.MilestoneType.Time, dpet.PICComplexTime);
            miPICInstrumentTime     = new MilestoneItem(String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.DPEInstrument, dpet.PICInstrumentTime), szResolved, string.Empty, MilestoneItem.MilestoneType.Time, dpet.PICInstrumentTime);
            miCFIITime              = new MilestoneItem(String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.DPEInstrumentInstruction, dpet.CFIITime), szResolved, string.Empty, MilestoneItem.MilestoneType.Time, dpet.CFIITime);
            miCFIITimeInCategory    = new MilestoneItem(String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.DPEInstrumentInstructionInCategory, dpet.CFIITimeInCategory, catClass.Category), szResolved, string.Empty, MilestoneItem.MilestoneType.Time, dpet.CFIITimeInCategory);
        }
Ejemplo n.º 2
0
    protected MakeModel MakeFromForm()
    {
        CategoryClass.CatClassID ccId = (CategoryClass.CatClassID)Enum.Parse(typeof(CategoryClass.CatClassID), cmbCatClass.SelectedValue, true);
        Boolean fSea = CategoryClass.IsSeaClass(ccId);

        if (ckComplex.Checked)
        {
            if (fSea)
            {
                ckRetract.Checked = true;
            }
            ckCowlFlaps.Checked    = true;
            ckConstantProp.Checked = true;
        }

        // if we were going to be really anal here, there would be no "complex" field in the database;
        // it would be entirely derived.  but we're not being really anal.
        // Complex is FAR 61.31.
        if ((fSea || ckRetract.Checked) &&
            ckConstantProp.Checked && ckCowlFlaps.Checked)
        {
            ckComplex.Checked = true;
        }

        MakeModel mk = (MakeID == -1) ? new MakeModel() : new MakeModel(MakeID);

        mk.Model                   = txtModel.Text.Trim();
        mk.ModelName               = txtName.Text.Trim();
        mk.TypeName                = txtType.Text.Trim();
        mk.FamilyName              = txtFamilyName.Text.Trim().ToUpper(CultureInfo.InvariantCulture).Replace("-", string.Empty).Replace(" ", string.Empty);
        mk.CategoryClassID         = ccId;
        mk.ManufacturerID          = Convert.ToInt32(cmbManufacturer.SelectedValue, CultureInfo.InvariantCulture);
        mk.IsComplex               = ckComplex.Checked;
        mk.PerformanceType         = HighPerfType;
        mk.IsTailWheel             = ckTailwheel.Checked;
        mk.IsConstantProp          = ckConstantProp.Checked;
        mk.HasFlaps                = ckCowlFlaps.Checked;
        mk.IsRetract               = ckRetract.Checked;
        mk.AvionicsTechnology      = AvionicsTechnology;
        mk.EngineType              = (MakeModel.TurbineLevel)rblTurbineType.SelectedIndex;
        mk.ArmyMDS                 = txtArmyMDS.Text;
        mk.AllowedTypes            = (AllowedAircraftTypes)rblAircraftAllowedTypes.SelectedIndex;
        mk.IsMotorGlider           = (ckTMG.Checked && (ccId == CategoryClass.CatClassID.Glider));
        mk.IsMultiEngineHelicopter = (ckMultiHeli.Checked && (ccId == CategoryClass.CatClassID.Helicopter));
        mk.IsCertifiedSinglePilot  = ckSinglePilot.Checked && mk.EngineType.IsTurbine() && !String.IsNullOrEmpty(mk.TypeName);

        // Sanity check - no complex for a jet
        if (mk.EngineType == MakeModel.TurbineLevel.Jet)
        {
            mk.IsComplex = mk.IsConstantProp = false;
        }

        // these don't get persisted, but help with dupe detection.
        mk.CategoryClassDisplay = cmbCatClass.SelectedItem.Text;
        mk.ManufacturerDisplay  = cmbManufacturer.SelectedItem.Text;

        UpdateRowsForCatClass(mk.CategoryClassID);

        return(mk);
    }
Ejemplo n.º 3
0
 protected SportPilotWeightShiftControlBase(string szTitle, CategoryClass.CatClassID catClassID) : base(szTitle, catClassID)
 {
     Title         = szTitle;
     CatClassID    = catClassID;
     MinXCDistance = 50;
     RatingSought  = RatingType.SportWeightShift;
 }
Ejemplo n.º 4
0
    protected void UpdateRowsForCatClass(CategoryClass.CatClassID idCatClass)
    {
        bool fIsGlider = idCatClass == CategoryClass.CatClassID.Glider;

        divTMG.Visible       = fIsGlider;
        divTailwheel.Visible = CategoryClass.IsAirplane(idCatClass) && !CategoryClass.IsSeaClass(idCatClass);
        divMultiHeli.Visible = (idCatClass == CategoryClass.CatClassID.Helicopter);

        bool hasEngine = CategoryClass.HasEngine(idCatClass);

        rowEngineType.Visible    = hasEngine;
        pnlHighPerfBlock.Visible = ckConstantProp.Enabled = ckComplex.Enabled = hasEngine;

        divComplex.Style["display"] = hasEngine || fIsGlider ? "inline-block" : "none";
        if (!hasEngine)
        {
            ckComplex.Checked            = ckConstantProp.Checked = ckCowlFlaps.Checked = ckRetract.Checked = false;
            rblTurbineType.SelectedIndex = 0;
        }

        bool fIsLegacyEligible = (idCatClass == CategoryClass.CatClassID.AMEL || idCatClass == CategoryClass.CatClassID.AMES || idCatClass == CategoryClass.CatClassID.Helicopter);

        pnlLegacyHighPerf.Style["display"] = fIsLegacyEligible ? "inline" : "none";
        if (ckLegacyHighPerf.Checked && !fIsLegacyEligible)
        {
            HighPerfType = MakeModel.HighPerfType.NotHighPerf;
        }
    }
Ejemplo n.º 5
0
        public static bool HasICAO(CategoryClass.CatClassID ccid)
        {
            switch (ccid)
            {
            case CategoryClass.CatClassID.ASEL:
            case CategoryClass.CatClassID.ASES:
            case CategoryClass.CatClassID.AMEL:
            case CategoryClass.CatClassID.AMES:
            case CategoryClass.CatClassID.Helicopter:
            case CategoryClass.CatClassID.Gyroplane:
            case CategoryClass.CatClassID.Airship:
                return(true);

            case CategoryClass.CatClassID.GasBalloon:
            case CategoryClass.CatClassID.HotAirBalloon:
            case CategoryClass.CatClassID.Glider:
            case CategoryClass.CatClassID.UnmannedAerialSystem:
            case CategoryClass.CatClassID.WeightShiftControlLand:
            case CategoryClass.CatClassID.WeightShiftControlSea:
                return(false);

            default:
                return(true);
            }
        }
Ejemplo n.º 6
0
 protected ATPRestrictedBase(string title, CategoryClass.CatClassID ccid, string szBaseFAR, decimal minTime, decimal minXCTime) : base(title, ccid, minTime, minXCTime, fCanCreditSICAndFlightEngineer: true)
 {
     BaseFAR          = "61.160";
     FARLink          = "https://www.law.cornell.edu/cfr/text/14/61.160";
     miTotal.FARRef   = ResolvedFAR(szBaseFAR);
     miMinXCTime.Note = Resources.MilestoneProgress.ATPMinXCTimeNoteRestricted;
     RatingSought     = RatingType.ATPAirplaneRestricted;
 }
Ejemplo n.º 7
0
 public DPEAirplaneCommBase(CategoryClass.CatClassID ccid, string szTitle) : base(new DPEThresholds() { PIC = 2000, PICCategory = 1000, PICClass = 500, PICNight = 100, PICComplexTime = 200, PICInstrumentTime = 100, PICPastYear = 300, CFICategory = 500, CFIClass = 100, CFIITime = 250, CFIITimeInCategory = 200 }, ccid, " Figure 7-3A")
 {
     Title             = szTitle;
     GeneralDisclaimer = Resources.MilestoneProgress.DPECommInstrumentDisclaimer;
     if (ccid == CategoryClass.CatClassID.AMEL || ccid == CategoryClass.CatClassID.AMES)
     {
         GeneralDisclaimer += Resources.LocalizedText.LocalizedSpace + Resources.MilestoneProgress.DPEMultiHelicopterDisclaimer;
     }
 }
Ejemplo n.º 8
0
        protected CFIBase(string title, CategoryClass.CatClassID ccid, RatingType rt)
        {
            Title = title;
            requiredCatClassID = ccid;
            BaseFAR            = "61.183";
            RatingSought       = rt;

            miPIC = new MilestoneItem(String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.CFITimeInCategoryClass, CFIMinTime, CategoryClass.CategoryClassFromID(ccid).CatClass), ResolvedFAR("(j)"), string.Empty, MilestoneItem.MilestoneType.Time, CFIMinTime);
        }
Ejemplo n.º 9
0
 public CatClassTotal(string catClass, CategoryClass.CatClassID ccid)
 {
     Total           = 0.0M;
     CatClassDisplay = catClass;
     CCId            = ccid;
     CatClass        = CategoryClass.CategoryClassFromID(ccid);
     Count           = 0;
     TotalLandings   = TotalFSDayLandings = TotalFSNightLandings = TotalApproaches = 0;
 }
Ejemplo n.º 10
0
        public NVCurrency(CategoryClass.CatClassID ccid)
        {
            m_ccid = ccid;
            bool fIsHeliOrPowered = IsHelicopterOrPoweredLift(ccid);
            int  requiredOps      = fIsHeliOrPowered ? 6 : 3;

            fcNVPassengers   = new NVCurrencyItem(requiredOps, 2, String.Format(CultureInfo.CurrentCulture, Resources.Currency.NVPIC, fIsHeliOrPowered ? Resources.Currency.NVHeliOrPoweredLift : Resources.Currency.NVAirplane, Resources.Currency.NVPassengers), 4);
            fcNVNoPassengers = new NVCurrencyItem(requiredOps, 4, String.Format(CultureInfo.CurrentCulture, Resources.Currency.NVPIC, fIsHeliOrPowered ? Resources.Currency.NVHeliOrPoweredLift : Resources.Currency.NVAirplane, Resources.Currency.NVNoPassengers), 0);
            fcNVIPC          = new NVCurrencyItem(1, 4, "NV Proficiency Check", 0);
            szNVGeneric      = String.Format(CultureInfo.CurrentCulture, Resources.Currency.NVPIC, fIsHeliOrPowered ? Resources.Currency.NVHeliOrPoweredLift : string.Empty, string.Empty);
            m_lstCurrencies  = new List <FlightCurrency>();
        }
Ejemplo n.º 11
0
        protected SportPilotAirplane(string szTitle, CategoryClass.CatClassID catClassID) : base()
        {
            // Basic MilestoneProgress stuff
            Title        = szTitle;
            CatClassID   = catClassID;
            BaseFAR      = "61.313(a)";
            RatingSought = RatingType.SportSingleEngine;

            // Parameters for SportBasePilot and SportPilotAirplaneRotorcraft
            minTime        = 20.0M;
            minInstruction = 15.0M;
            minSolo        = 5.0M;
            MinXCDistance  = 75;
            CategoryName   = Resources.MilestoneProgress.SportAirplaneCategory;
            Init();
        }
Ejemplo n.º 12
0
        public static FlightCurrency CurrencyForCatClass(CategoryClass.CatClassID ccid, string szName)
        {
            switch (ccid)
            {
            case CategoryClass.CatClassID.GasBalloon:
            case CategoryClass.CatClassID.HotAirBalloon:
            // TODO: implement EASA balloon FCL.060
            default:
                return(new PassengerCurrency(szName));

            case CategoryClass.CatClassID.Airship:
            case CategoryClass.CatClassID.AMEL:
            case CategoryClass.CatClassID.AMES:
            case CategoryClass.CatClassID.ASEL:
            case CategoryClass.CatClassID.ASES:
            case CategoryClass.CatClassID.Glider:
            case CategoryClass.CatClassID.Helicopter:
            case CategoryClass.CatClassID.PoweredLift:
                return(new PassengerCurrency(String.Format(CultureInfo.CurrentCulture, Resources.LocalizedText.LocalizedJoinWithSpace, szName, Resources.Currency.PassengersEASA)));
            }
        }
Ejemplo n.º 13
0
        protected ATPAirplane(string title, CategoryClass.CatClassID ccid, decimal minTime = 1500, decimal minXCTime = 500, bool fCanCreditSICAndFlightEngineer = false)
        {
            Title = title;
            requiredCatClassID            = ccid;
            BaseFAR                       = "61.159";
            RatingSought                  = RatingType.ATPAirplane;
            ATPTotalTime                  = minTime;
            ATPMinXC                      = minXCTime;
            CanCreditSICAndFlightEngineer = fCanCreditSICAndFlightEngineer;
            CategoryClass cc = CategoryClass.CategoryClassFromID(ccid);

            miTotal             = new MilestoneItem(String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.ATPMinTime, ATPTotalTime), ResolvedFAR("(a)"), fCanCreditSICAndFlightEngineer ? Branding.ReBrand(Resources.MilestoneProgress.ATPTotalTimeSubstitutionNote) : string.Empty, MilestoneItem.MilestoneType.Time, ATPTotalTime);
            miMinXCTime         = new MilestoneItem(Resources.MilestoneProgress.ATPMinXCTime, ResolvedFAR("(a)(1)"), string.Empty, MilestoneItem.MilestoneType.Time, ATPMinXC);
            miMinNightTime      = new MilestoneItem(Resources.MilestoneProgress.ATPMinNightTime, ResolvedFAR("(a)(2)"), Resources.MilestoneProgress.ATPAirplaneNightLandingsNote, MilestoneItem.MilestoneType.Time, ATPMinNight);
            miMinTimeInClass    = new MilestoneItem(String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.ATPTimeInClass, ATPMinTimeInClass, cc.Class), ResolvedFAR("(a)(3)"), Branding.ReBrand(Resources.MilestoneProgress.ATPAirplaneClassSimulatorNote), MilestoneItem.MilestoneType.Time, ATPMinTimeInClass);
            miMinInstrumentTime = new MilestoneItem(Resources.MilestoneProgress.ATPInstrumentTime, ResolvedFAR("(a)(4)"), Resources.MilestoneProgress.ATPAirplaneSimulatorNote, MilestoneItem.MilestoneType.Time, ATPMinIFR);
            miMinPIC            = new MilestoneItem(Resources.MilestoneProgress.ATPPICTime, ResolvedFAR("(a)(5)"), Resources.MilestoneProgress.ATPPICTimeNote, MilestoneItem.MilestoneType.Time, ATPMinPIC);
            miMinPICXC          = new MilestoneItem(Resources.MilestoneProgress.ATPXCPICTime, ResolvedFAR("(a)(5)(i)"), Resources.MilestoneProgress.ATPPICTimeNote, MilestoneItem.MilestoneType.Time, ATPMinPICXC);
            miMinPICNight       = new MilestoneItem(Resources.MilestoneProgress.ATPNightPICTime, ResolvedFAR("(a)(5)(ii)"), Resources.MilestoneProgress.ATPPICTimeNote, MilestoneItem.MilestoneType.Time, ATPMinPICNight);
            miNightTO           = new MilestoneItem(string.Empty, ResolvedFAR("(b)"), string.Empty, MilestoneItem.MilestoneType.Count, ATPMinNightTakeoffs);
            miNightLanding      = new MilestoneItem(string.Empty, ResolvedFAR("(b)"), string.Empty, MilestoneItem.MilestoneType.Count, ATPMinNightLandings);
        }
Ejemplo n.º 14
0
        protected void Init(CategoryClass.CatClassID ccid)
        {
            CategoryClass cc = CategoryClass.CategoryClassFromID(CatClassID = ccid);

            Title        = String.Format(CultureInfo.CurrentCulture, "{0} - {1}", Resources.MilestoneProgress.Title6199, cc.CatClass);
            BaseFAR      = "61.99";
            RatingSought = RatingType.RecreationalPilot;

            // 61.99 overall
            miMinTime = new MilestoneItem(Resources.MilestoneProgress.RecreationalMinTime, BaseFAR, string.Empty, MilestoneItem.MilestoneType.Time, 30.0M);

            // 61.99(a) - 15 hours of dual
            miMinInstruction = new MilestoneItem(Resources.MilestoneProgress.RecreationalMinTraining, ResolvedFAR("(a)"), String.Empty, MilestoneItem.MilestoneType.Time, 15.0M);

            // 61.99(a)(1)(i) - 2 hours of flight training in 25nm flights with at least 4 landings
            miXCFlight = new MilestoneItem(Resources.MilestoneProgress.RecreationalMinXC, ResolvedFAR("(a)(1)(i)"), Resources.MilestoneProgress.RecreationalMinXCNote, MilestoneItem.MilestoneType.Time, 2.0M);

            // 61.99(a)(1)(ii) - 3 hours of flight training within preceding 2 months.
            miTestPrep = new MilestoneItem(Resources.MilestoneProgress.RecreationTestPrep, ResolvedFAR("(a)(1)(ii)"), Branding.ReBrand(Resources.MilestoneProgress.NoteTestPrep), MilestoneItem.MilestoneType.Time, 3.0M);

            // 61.99(a)(2) - 3 hours of solo time
            miMinSolo = new MilestoneItem(Resources.MilestoneProgress.RecreationalMinSolo, ResolvedFAR("(a)(2)"), Resources.MilestoneProgress.NoteSoloTime, MilestoneItem.MilestoneType.Time, 3.0M);
        }
Ejemplo n.º 15
0
 protected override bool IsMatchingCategory(CategoryClass.CatClassID ccid)
 {
     return(CategoryClass.IsAirplane(ccid));
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Is this a balloon?
 /// </summary>
 /// <param name="ccid">ID of the category/class</param>
 /// <returns>True if it is a gas balloon or a hot air balloon</returns>
 public static bool IsBalloon(CategoryClass.CatClassID ccid)
 {
     return(ccid == CategoryClass.CatClassID.GasBalloon || ccid == CategoryClass.CatClassID.HotAirBalloon);
 }
Ejemplo n.º 17
0
 protected ATPRestrictedBase(string title, CategoryClass.CatClassID ccid, string szBaseFAR, decimal minTime, decimal minXCTime) : base(title, ccid, minTime, minXCTime, fCanCreditSICAndFlightEngineer: true)
 {
     miTotal.FARRef   = szBaseFAR;
     miMinXCTime.Note = Resources.MilestoneProgress.ATPMinXCTimeNoteRestricted;
     RatingSought     = RatingType.ATPAirplaneRestricted;
 }
Ejemplo n.º 18
0
 public static FlightCurrency InstructorCurrencyForCatClass(CategoryClass.CatClassID ccid)
 {
     return((ccid == CategoryClass.CatClassID.Glider) ? new EASASPLInstructorCurrency(Resources.Currency.EASASailplaneFI) : null);
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Looks at all the checkrides for the user in the database and describes them and determines what ratings you likely hold.
        /// I.e., computes the Checkrides and Ratings properties.
        /// </summary>
        private void ComputeRatings()
        {
            List <Checkride> lst = new List <Checkride>();

            if (String.IsNullOrEmpty(Username))
            {
                m_lstCheckrides = new List <Checkride>();
                return;
            }

            DBHelper dbh = new DBHelper(@"SELECT cpt.idproptype, f.date, f.idflight, m.typename, cc.Category, cc.Class, cc.idCatClass
                FROM
                    flightproperties fp
                        INNER JOIN
                    custompropertytypes cpt ON fp.idproptype = cpt.idproptype
                        INNER JOIN
                    flights f ON fp.idflight = f.idflight
                        INNER JOIN
                    aircraft ac ON f.idaircraft = ac.idaircraft
                        INNER JOIN
                    models m ON ac.idmodel = m.idmodel
                        INNER JOIN
                    categoryclass cc ON m.idcategoryclass = cc.idcatclass
                WHERE
                    fp.idproptype IN (39 , 40, 42, 43, 45, 89, 131, 161, 176, 177, 225, 623)
                        AND f.username = ?userName
                ORDER BY date ASC");

            dbh.ReadRows((comm) => { comm.Parameters.AddWithValue("userName", Username); },
                         (dr) =>
            {
                Checkride cr = new Checkride()
                {
                    FlightID          = Convert.ToInt32(dr["idflight"], CultureInfo.InvariantCulture),
                    DateEarned        = Convert.ToDateTime(dr["date"], CultureInfo.InvariantCulture),
                    CheckrideProperty = (CustomPropertyType.KnownProperties)Convert.ToInt32(dr["idproptype"], CultureInfo.InvariantCulture)
                };

                string szType     = (string)dr["typename"];
                string szCategory = (string)dr["Category"];
                switch (cr.CheckrideProperty)
                {
                case CustomPropertyType.KnownProperties.IDPropCheckrideIFR:
                    cr.Privilege = szCategory;
                    break;

                case CustomPropertyType.KnownProperties.IDPropCheckrideCFI:
                case CustomPropertyType.KnownProperties.IDPropCheckrideMEI:
                    {
                        // CFI ratings are category/class, but not land/sea class, just single/multi.
                        CategoryClass.CatClassID ccid = (CategoryClass.CatClassID)Convert.ToInt32(dr["idCatClass"], CultureInfo.InvariantCulture);
                        switch (ccid)
                        {
                        case CategoryClass.CatClassID.AMEL:
                        case CategoryClass.CatClassID.AMES:
                            cr.Privilege = String.Format(CultureInfo.CurrentCulture, "{0} {1} {2}", szCategory, Resources.Achievements.PrivilegeMultiEngine, szType).Trim();
                            break;

                        case CategoryClass.CatClassID.ASEL:
                        case CategoryClass.CatClassID.ASES:
                            cr.Privilege = String.Format(CultureInfo.CurrentCulture, "{0} {1} {2}", szCategory, Resources.Achievements.PrivilegeSingleEngine, szType).Trim();
                            break;

                        default:
                            cr.Privilege = String.Format(CultureInfo.CurrentCulture, "{0} {1} {2}", dr["Category"], dr["Class"], String.IsNullOrEmpty(szType) ? string.Empty : String.Format(CultureInfo.CurrentCulture, Resources.Achievements.ratingTypeTemplate, szType)).Trim();
                            break;
                        }
                    }
                    break;

                case CustomPropertyType.KnownProperties.IDPropCheckrideCFII:
                    cr.Privilege = String.Format(CultureInfo.CurrentCulture, Resources.LocalizedText.LocalizedJoinWithSpace, Resources.Achievements.PrivilegeCFII, szCategory);
                    break;

                case CustomPropertyType.KnownProperties.IDPropNightRating:
                    cr.Privilege = Resources.Achievements.PrivilegeNight;
                    break;

                default:
                    cr.Privilege = String.Format(CultureInfo.CurrentCulture, "{0} {1} {2}", dr["Category"], dr["Class"], String.IsNullOrEmpty(szType) ? string.Empty : String.Format(CultureInfo.CurrentCulture, Resources.Achievements.ratingTypeTemplate, szType)).Trim();
                    break;
                }

                lst.Add(cr);
            });

            // We now have a set of checkrides - now we need to figure out how they applied.
            DescribeRatings(lst);

            ComputeNetCertificates();
        }
Ejemplo n.º 20
0
 public static bool IsHelicopterOrPoweredLift(CategoryClass.CatClassID ccid)
 {
     return(ccid == CategoryClass.CatClassID.Helicopter || ccid == CategoryClass.CatClassID.PoweredLift);
 }
Ejemplo n.º 21
0
        /// <summary>
        /// For layouts that have a column for all times not otherwise in columns, answers whether or not the given catclass has its own columnID.  If true, should show this in the "other" bucket, if false, should suppress
        /// </summary>
        /// <param name="OptionalColumns"></param>
        /// <param name="catClassID"></param>
        /// <returns></returns>
        public static bool ShowOtherCatClass(IEnumerable <OptionalColumn> OptionalColumns, CategoryClass.CatClassID catClassID)
        {
            if (OptionalColumns == null)
            {
                return(true);
            }

            foreach (OptionalColumn oc in OptionalColumns)
            {
                switch (catClassID)
                {
                default:
                    break;

                case CategoryClass.CatClassID.AMEL:
                    if (oc.ColumnType == OptionalColumnType.AMEL)
                    {
                        return(false);
                    }
                    break;

                case CategoryClass.CatClassID.ASEL:
                    if (oc.ColumnType == OptionalColumnType.ASEL)
                    {
                        return(false);
                    }
                    break;

                case CategoryClass.CatClassID.ASES:
                    if (oc.ColumnType == OptionalColumnType.ASES)
                    {
                        return(false);
                    }
                    break;

                case CategoryClass.CatClassID.AMES:
                    if (oc.ColumnType == OptionalColumnType.AMES)
                    {
                        return(false);
                    }
                    break;

                case CategoryClass.CatClassID.Helicopter:
                    if (oc.ColumnType == OptionalColumnType.Helicopter)
                    {
                        return(false);
                    }
                    break;

                case CategoryClass.CatClassID.Gyroplane:
                    if (oc.ColumnType == OptionalColumnType.Gyroplane)
                    {
                        return(false);
                    }
                    break;

                case CategoryClass.CatClassID.Glider:
                    if (oc.ColumnType == OptionalColumnType.Glider)
                    {
                        return(false);
                    }
                    break;

                case CategoryClass.CatClassID.HotAirBalloon:
                    if (oc.ColumnType == OptionalColumnType.HotAirBalloon)
                    {
                        return(false);
                    }
                    break;

                case CategoryClass.CatClassID.GasBalloon:
                    if (oc.ColumnType == OptionalColumnType.GasBalloon)
                    {
                        return(false);
                    }
                    break;

                case CategoryClass.CatClassID.UnmannedAerialSystem:
                    if (oc.ColumnType == OptionalColumnType.UAS)
                    {
                        return(false);
                    }
                    break;
                }
            }

            return(true);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Determines if the category/class matches the rating being sought
        /// </summary>
        /// <param name="ccid">The category/class</param>
        /// <returns>True if it applies to the rating</returns>
        protected bool CatClassMatchesRatingSought(CategoryClass.CatClassID ccid)
        {
            switch (RatingSought)
            {
            case RatingType.PPLAirplaneMulti:
            case RatingType.CommercialAMES:
            case RatingType.CommercialAMEL:
            case RatingType.PPLPart141MultiEngine:
                return(ccid == CategoryClass.CatClassID.AMEL || ccid == CategoryClass.CatClassID.AMES);

            case RatingType.PPLAirplaneSingle:
            case RatingType.CommercialASEL:
            case RatingType.CommercialASES:
            case RatingType.PPLPart141SingleEngine:
                return(ccid == CategoryClass.CatClassID.ASEL || ccid == CategoryClass.CatClassID.ASES);

            case RatingType.PPLHelicopter:
            case RatingType.InstrumentHelicopter:
            case RatingType.CommercialHelicopter:
            case RatingType.PPLPart141Helicopter:
            case RatingType.SAPPLHelicopter:
            case RatingType.SAPPLNightHelicopter:
            case RatingType.CAPPLHelicopter:
            case RatingType.CANightHelicopter:
            case RatingType.PPLJARHelicopter:
                return(ccid == CategoryClass.CatClassID.Helicopter);

            case RatingType.InstrumentAirplane:
            case RatingType.SAPPLAirplane:
            case RatingType.SAPPLNightAirplane:
            case RatingType.CAPPLAirplaneLand:
            case RatingType.CAPPLAirplaneSea:
            case RatingType.CANightAirplane:
            case RatingType.PPLJARAirplane:
                return(CategoryClass.IsAirplane(ccid));

            case RatingType.InstrumentPoweredLift:
                return(ccid == CategoryClass.CatClassID.PoweredLift);

            case RatingType.PPLPart141Gyroplane:
            case RatingType.PPLGyroplane:
                return(ccid == CategoryClass.CatClassID.Gyroplane);

            case RatingType.PPLPoweredLift:
                return(ccid == CategoryClass.CatClassID.PoweredLift);

            case RatingType.PPLAirship:
                return(ccid == CategoryClass.CatClassID.Airship);

            case RatingType.PPLGlider:
            case RatingType.PPLPart141Glider:
            case RatingType.CommercialGlider:
                return(ccid == CategoryClass.CatClassID.Glider);

            case RatingType.PPLBalloon:
                return(CategoryClass.IsBalloon(ccid));

            case RatingType.CommercialBalloonGas:
                return(ccid == CategoryClass.CatClassID.GasBalloon);

            case RatingType.CommercialBalloonHot:
                return(ccid == CategoryClass.CatClassID.HotAirBalloon);

            case RatingType.PPLPoweredParachute:
                return(ccid == CategoryClass.CatClassID.PoweredParachuteLand || ccid == CategoryClass.CatClassID.PoweredParachuteSea);

            case RatingType.PPLWeightShift:
                return(ccid == CategoryClass.CatClassID.WeightShiftControlLand || ccid == CategoryClass.CatClassID.WeightShiftControlSea);

            default:
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// For layouts that have a column for all times not otherwise in columns, answers whether or not the given catclass has its own columnID.  If true, should show this in the "other" bucket, if false, should suppress
        /// </summary>
        /// <param name="OptionalColumns"></param>
        /// <param name="catClassID"></param>
        /// <returns></returns>
        public static bool ShowOtherCatClass(IEnumerable <OptionalColumn> OptionalColumns, CategoryClass.CatClassID catClassID)
        {
            if (OptionalColumns == null)
            {
                return(true);
            }

            foreach (OptionalColumn oc in OptionalColumns)
            {
                switch (catClassID)
                {
                default:
                    break;

                case CategoryClass.CatClassID.AMEL:
                    if (oc.ColumnType == OptionalColumnType.AMEL)
                    {
                        return(false);
                    }
                    break;

                case CategoryClass.CatClassID.ASEL:
                    if (oc.ColumnType == OptionalColumnType.ASEL)
                    {
                        return(false);
                    }
                    break;

                case CategoryClass.CatClassID.ASES:
                    if (oc.ColumnType == OptionalColumnType.ASES)
                    {
                        return(false);
                    }
                    break;

                case CategoryClass.CatClassID.AMES:
                    if (oc.ColumnType == OptionalColumnType.AMES)
                    {
                        return(false);
                    }
                    break;

                case CategoryClass.CatClassID.Helicopter:
                    if (oc.ColumnType == OptionalColumnType.Helicopter)
                    {
                        return(false);
                    }
                    break;

                case CategoryClass.CatClassID.Glider:
                    if (oc.ColumnType == OptionalColumnType.Glider)
                    {
                        return(false);
                    }
                    break;
                }
            }

            return(true);
        }
Ejemplo n.º 24
0
        private void ComputeTotalsByCatClass(MySqlCommand comm, Profile pf)
        {
            // first get the totals by catclass
            Hashtable htCct = new Hashtable();

            try
            {
                using (MySqlDataReader dr = comm.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        string szModelDisplay    = (string)dr["ModelDisplay"];
                        string szCatClassDisplay = (string)dr["CatClassDisplay"];
                        string szFamilyDisplay   = (string)dr["FamilyDisplay"];

                        string szCatClass             = dr["CatClass"].ToString();
                        int    idModel                = Convert.ToInt32(dr["idmodel"], CultureInfo.InvariantCulture);
                        string szTypeName             = dr["typename"].ToString();
                        CategoryClass.CatClassID ccid = (CategoryClass.CatClassID)Convert.ToInt32(dr["idCatClass"], CultureInfo.InvariantCulture);
                        Decimal decTotal              = (Decimal)util.ReadNullableField(dr, "Total", 0.0M);
                        Int32   cLandings             = Convert.ToInt32(util.ReadNullableField(dr, "cLandings", 0), CultureInfo.InvariantCulture);
                        Int32   cApproaches           = Convert.ToInt32(util.ReadNullableField(dr, "cApproaches", 0), CultureInfo.InvariantCulture);
                        Int32   cFSDayLandings        = Convert.ToInt32(util.ReadNullableField(dr, "cFullStopLandings", 0), CultureInfo.InvariantCulture);
                        Int32   cFSNightLandings      = Convert.ToInt32(util.ReadNullableField(dr, "cNightLandings", 0), CultureInfo.InvariantCulture);

                        string szDesc = SubDescFromLandings(cLandings, cFSDayLandings, cFSNightLandings, cApproaches);

                        // keep track of the subtotal.
                        CatClassTotal cct = (CatClassTotal)htCct[szCatClass];
                        if (cct == null)
                        {
                            htCct[szCatClass] = cct = new CatClassTotal(szCatClass, ccid);
                        }
                        cct.AddTotals(decTotal, cLandings, cFSDayLandings, cFSNightLandings, cApproaches);

                        FlightQuery fq = null;

                        // don't link to a query for type-totals, since there's no clean query for that.  But if this is a clean catclass (e.g., "AMEL") it should match and we can query it.
                        fq = new FlightQuery(Restriction);
                        string szTitle = string.Empty;
                        switch (pf.TotalsGroupingMode)
                        {
                        case TotalsGrouping.CatClass:
                            AddCatClassToQuery(fq, cct.CatClass, szTypeName);
                            szTitle = szCatClassDisplay;
                            break;

                        case TotalsGrouping.Model:
                            AddModelToQuery(fq, idModel);
                            szTitle = szModelDisplay;
                            break;

                        case TotalsGrouping.Family:
                            fq.ModelName = szFamilyDisplay;
                            szTitle      = szFamilyDisplay;
                            break;
                        }

                        AddToList(new TotalsItem(szTitle, decTotal, szDesc)
                        {
                            Query = fq
                        });
                    }
                }
            }
            catch (MySqlException ex)
            {
                throw new MyFlightbookException(String.Format(CultureInfo.InvariantCulture, "Exception in UserTotals Data Bind while reading data by catclass: {0}", comm.CommandText), ex, pf.UserName);
            }

            // Add in any catclass subtotals
            foreach (CatClassTotal cct in htCct.Values)
            {
                FlightQuery fq = AddCatClassToQuery(new FlightQuery(Restriction), cct.CatClass, string.Empty);
                if (pf.TotalsGroupingMode != TotalsGrouping.CatClass || !cct.IsRedundant)
                {
                    if (pf.TotalsGroupingMode == TotalsGrouping.CatClass)
                    {
                        // If you have a mix of type-rated and non-type-rated aircraft, then the subtotal for non-typerated doesn't have a type specifier; it's just naked "AMEL", for example.
                        // So Find and fix up the query for that item
                        CategoryClass ccTarget = cct.CatClass;
                        foreach (TotalsItem ti in Totals)
                        {
                            FlightQuery q = ti.Query;
                            if (q != null && q.CatClasses != null && q.CatClasses.Length == 1 && q.CatClasses[0].IdCatClass == ccTarget.IdCatClass && (q.TypeNames == null || q.TypeNames.Length == 0))
                            {
                                q.TypeNames = new string[1] {
                                    string.Empty
                                }
                            }
                            ;
                        }
                    }

                    AddToList(new TotalsItem(cct.DisplayName, cct.Total, SubDescFromLandings(cct.TotalLandings, cct.TotalFSDayLandings, cct.TotalFSNightLandings, cct.TotalApproaches), pf.TotalsGroupingMode == TotalsGrouping.CatClass ? TotalsItem.SortMode.CatClass : TotalsItem.SortMode.Model)
                    {
                        Query = fq
                    });
                }
            }
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Determines if the flight matches the required category for the milestone
 /// </summary>
 /// <param name="ccid">the categoryclass ID</param>
 /// <returns>True if it's a match</returns>
 protected abstract bool IsMatchingCategory(CategoryClass.CatClassID ccid);
Ejemplo n.º 26
0
 public DPEAirplaneBasePPL(CategoryClass.CatClassID ccid, string szTitle) : base(new DPEThresholds() { PIC = 2000, PICCategory = 1000, PICClass = 300, PICNight = 100, PICPastYear = 300, CFICategory = 500, CFIClass = 100 }, ccid, " Figure 7-2A")
 {
     Title = szTitle;
 }
Ejemplo n.º 27
0
 protected override bool IsMatchingCategory(CategoryClass.CatClassID ccid)
 {
     return(ccid == CategoryClass.CatClassID.Helicopter);
 }
Ejemplo n.º 28
0
 public DPERotorcraftBasePPL(CategoryClass.CatClassID ccid, string szTitle) : base(new DPEThresholds() { PIC = 1000, PICCategory = 500, PICClass = (ccid == CategoryClass.CatClassID.Gyroplane ? 150 : 250), PICPastYear = 100, CFIClass = 200 }, ccid, " Figure 7-2A")
 {
     GeneralDisclaimer = Resources.MilestoneProgress.DPEMultiHelicopterDisclaimer;
     Title             = szTitle;
 }