static Calendar() { _provider = new CalendarService(); List <Holiday> holidays = CalendarUtils.GetUnitedStatesHolidays(); CalanderDao dao = new CalanderDao("usa-holidays", holidays); _provider.Init("usa-holidays", dao, DateTime.Today.Year - 1, DateTime.Today.Year + 2); }
/// <summary> /// Get the holidays. /// </summary> /// <param name="startyear"></param> /// <param name="endYear"></param> /// <returns></returns> public List <KeyValuePair <int, List <DateTime> > > Holidays(int startyear, int endYear) { List <KeyValuePair <int, List <DateTime> > > map = new List <KeyValuePair <int, List <DateTime> > >(); List <Holiday> holidaysForCalendarCode = _holidaysByCalendarCode[_calendarCode]; for (int year = startyear; year <= endYear; year++) { List <DateTime> dates = CalendarUtils.InterpretHolidays(holidaysForCalendarCode, year); map.Add(new KeyValuePair <int, List <DateTime> >(year, dates)); } return(map); }