コード例 #1
0
        /// <summary>
        /// Get Public Holidays
        /// </summary>
        /// <param name="countryCode">ISO 3166-1 ALPHA-2</param>
        /// <param name="year"></param>
        /// <returns></returns>
        public static IEnumerable <PublicHoliday> GetPublicHoliday(CountryCode countryCode, int year)
        {
            IPublicHolidayProvider provider = null;

            switch (countryCode)
            {
            case CountryCode.AT:
                provider = new AustriaProvider();
                break;

            case CountryCode.BE:
                provider = new BelgiumProvider();
                break;

            case CountryCode.BG:
                provider = new BulgariaProvider();
                break;

            case CountryCode.BY:
                provider = new BelarusProvider();
                break;

            case CountryCode.CA:
                provider = new CanadaProvider();
                break;

            case CountryCode.CH:
                provider = new SwitzerlandProvider();
                break;

            case CountryCode.CY:
                provider = new CyprusProvider();
                break;

            case CountryCode.CZ:
                provider = new CzechRepublicProvider();
                break;

            case CountryCode.DE:
                provider = new GermanyProvider();
                break;

            case CountryCode.DK:
                provider = new DenmarkProvider();
                break;

            case CountryCode.EE:
                provider = new EstoniaProvider();
                break;

            case CountryCode.ES:
                provider = new SpainProvider();
                break;

            case CountryCode.FI:
                provider = new FinlandProvider();
                break;

            case CountryCode.FR:
                provider = new FranceProvider();
                break;

            case CountryCode.GL:
                provider = new GreenlandProvider();
                break;

            case CountryCode.GR:
                provider = new GreeceProvider();
                break;

            case CountryCode.HR:
                provider = new CroatiaProvider();
                break;

            case CountryCode.HU:
                provider = new HungaryProvider();
                break;

            case CountryCode.IE:
                provider = new IrelandProvider();
                break;

            case CountryCode.IT:
                provider = new ItalyProvider();
                break;

            case CountryCode.LI:
                provider = new LiechtensteinProvider();
                break;

            case CountryCode.LT:
                provider = new LithuaniaProvider();
                break;

            case CountryCode.LU:
                provider = new LuxembourgProvider();
                break;

            case CountryCode.LV:
                provider = new LatviaProvider();
                break;

            case CountryCode.MG:
                provider = new MadagascarProvider();
                break;

            case CountryCode.MT:
                provider = new MaltaProvider();
                break;

            case CountryCode.NL:
                provider = new NetherlandsProvider();
                break;

            case CountryCode.NO:
                provider = new NorwayProvider();
                break;

            case CountryCode.NZ:
                provider = new NewZealandProvider();
                break;

            case CountryCode.PL:
                provider = new PolandProvider();
                break;

            case CountryCode.PT:
                provider = new PortugalProvider();
                break;

            case CountryCode.RO:
                provider = new RomaniaProvider();
                break;

            case CountryCode.RU:
                provider = new RussiaProvider();
                break;

            case CountryCode.SI:
                provider = new SloveniaProvider();
                break;

            case CountryCode.SE:
                provider = new SwedenProvider();
                break;

            case CountryCode.SK:
                provider = new SlovakiaProvider();
                break;

            case CountryCode.GB:
                provider = new UnitedKingdomProvider();
                break;

            case CountryCode.US:
                provider = new UnitedStatesProvider();
                break;

            case CountryCode.ZA:
                provider = new SouthAfricaProvider();
                break;
            }

            return(provider?.Get(year));
        }
コード例 #2
0
        /// <summary>
        /// Get Public Holidays
        /// </summary>
        /// <param name="countryCode">ISO 3166-1 ALPHA-2</param>
        /// <param name="year"></param>
        /// <returns></returns>
        public static IEnumerable <PublicHoliday> GetPublicHoliday(CountryCode countryCode, int year)
        {
            IPublicHolidayProvider provider = null;

            switch (countryCode)
            {
            case CountryCode.AD:
                provider = new AndorraProvider();
                break;

            case CountryCode.AR:
                provider = new ArgentinaProvider();
                break;

            case CountryCode.AT:
                provider = new AustriaProvider();
                break;

            case CountryCode.AU:
                provider = new AustraliaProvider();
                break;

            case CountryCode.BE:
                provider = new BelgiumProvider();
                break;

            case CountryCode.BG:
                provider = new BulgariaProvider();
                break;

            case CountryCode.BO:
                provider = new BoliviaProvider();
                break;

            case CountryCode.BR:
                provider = new BrazilProvider();
                break;

            case CountryCode.BS:
                provider = new BahamasProvider();
                break;

            case CountryCode.BW:
                provider = new BotswanaProvider();
                break;

            case CountryCode.BY:
                provider = new BelarusProvider();
                break;

            case CountryCode.CA:
                provider = new CanadaProvider();
                break;

            case CountryCode.CH:
                provider = new SwitzerlandProvider();
                break;

            case CountryCode.CL:
                provider = new ChileProvider();
                break;

            //case Country
            //case CountryCode.CN:
            //    provider = new ChinaProvider();
            //    break;
            case CountryCode.CO:
                provider = new ColombiaProvider();
                break;

            case CountryCode.CR:
                provider = new CostaRicaProvider();
                break;

            case CountryCode.CU:
                provider = new CubaProvider();
                break;

            case CountryCode.CY:
                provider = new CyprusProvider();
                break;

            case CountryCode.CZ:
                provider = new CzechRepublicProvider();
                break;

            case CountryCode.DE:
                provider = new GermanyProvider();
                break;

            case CountryCode.DK:
                provider = new DenmarkProvider();
                break;

            case CountryCode.DO:
                provider = new DominicanRepublicProvider();
                break;

            case CountryCode.EC:
                provider = new EcuadorProvider();
                break;

            case CountryCode.EE:
                provider = new EstoniaProvider();
                break;

            case CountryCode.ES:
                provider = new SpainProvider();
                break;

            case CountryCode.FI:
                provider = new FinlandProvider();
                break;

            case CountryCode.FR:
                provider = new FranceProvider();
                break;

            case CountryCode.GB:
                provider = new UnitedKingdomProvider();
                break;

            case CountryCode.GL:
                provider = new GreenlandProvider();
                break;

            case CountryCode.GR:
                provider = new GreeceProvider();
                break;

            case CountryCode.GT:
                provider = new GuatemalaProvider();
                break;

            case CountryCode.HN:
                provider = new HondurasProvider();
                break;

            case CountryCode.HR:
                provider = new CroatiaProvider();
                break;

            case CountryCode.HT:
                provider = new HaitiProvider();
                break;

            case CountryCode.HU:
                provider = new HungaryProvider();
                break;

            case CountryCode.IE:
                provider = new IrelandProvider();
                break;

            case CountryCode.IM:
                provider = new IsleOfManProvider();
                break;

            case CountryCode.IS:
                provider = new IcelandProvider();
                break;

            case CountryCode.IT:
                provider = new ItalyProvider();
                break;

            case CountryCode.LI:
                provider = new LiechtensteinProvider();
                break;

            case CountryCode.LT:
                provider = new LithuaniaProvider();
                break;

            case CountryCode.LU:
                provider = new LuxembourgProvider();
                break;

            case CountryCode.LV:
                provider = new LatviaProvider();
                break;

            case CountryCode.JE:
                provider = new JerseyProvider();
                break;

            case CountryCode.JM:
                provider = new JamaicaProvider();
                break;

            case CountryCode.MC:
                provider = new MonacoProvider();
                break;

            case CountryCode.MG:
                provider = new MadagascarProvider();
                break;

            case CountryCode.MT:
                provider = new MaltaProvider();
                break;

            case CountryCode.NA:
                provider = new NamibiaProvider();
                break;

            case CountryCode.NL:
                provider = new NetherlandsProvider();
                break;

            case CountryCode.NO:
                provider = new NorwayProvider();
                break;

            case CountryCode.NZ:
                provider = new NewZealandProvider();
                break;

            case CountryCode.PA:
                provider = new PanamaProvider();
                break;

            case CountryCode.PE:
                provider = new PeruProvider();
                break;

            case CountryCode.PL:
                provider = new PolandProvider();
                break;

            case CountryCode.PR:
                provider = new PuertoRicoProvider();
                break;

            case CountryCode.PT:
                provider = new PortugalProvider();
                break;

            case CountryCode.PY:
                provider = new ParaguayProvider();
                break;

            case CountryCode.RO:
                provider = new RomaniaProvider();
                break;

            case CountryCode.RU:
                provider = new RussiaProvider();
                break;

            case CountryCode.SI:
                provider = new SloveniaProvider();
                break;

            case CountryCode.SE:
                provider = new SwedenProvider();
                break;

            case CountryCode.SK:
                provider = new SlovakiaProvider();
                break;

            case CountryCode.TR:
                provider = new TurkeyProvider();
                break;

            case CountryCode.VE:
                provider = new VenezuelaProvider();
                break;

            case CountryCode.US:
                provider = new UnitedStatesProvider();
                break;

            case CountryCode.UY:
                provider = new UruguayProvider();
                break;

            case CountryCode.ZA:
                provider = new SouthAfricaProvider();
                break;
            }

            return(provider?.Get(year));
        }