// ---------------------------------------------------------------------- public static void ShowAll(int periodCount, int startYear, TimeCalendarConfig calendarConfig) { WriteLine("Input: count={0}, year={1}", periodCount, startYear); WriteLine("Calendar: base-month={0}, week-type={1}, culture={2}", calendarConfig.YearBaseMonth, calendarConfig.YearWeekType, calendarConfig.Culture.Name); WriteLine(); YearTimeRange yearTimeRange; if (periodCount == 1) { Year year = new Year(startYear, new TimeCalendar(calendarConfig)); yearTimeRange = year; Year previousYear = year.GetPreviousYear(); Year nextYears = year.GetNextYear(); ShowYear(year); ShowCompactYear(previousYear, "Previous Year"); ShowCompactYear(nextYears, "Next Year"); WriteLine(); } else { Years years = new Years(startYear, periodCount, new TimeCalendar(calendarConfig)); yearTimeRange = years; ShowYears(years); WriteLine(); foreach (Year year in years.GetYears()) { ShowCompactYear(year); } WriteLine(); } foreach (Halfyear halfyear in yearTimeRange.GetHalfyears()) { HalfyearDemo.ShowCompactHalfyear(halfyear); } WriteLine(); foreach (Quarter quarter in yearTimeRange.GetQuarters()) { QuarterDemo.ShowCompactQuarter(quarter); } WriteLine(); foreach (Month month in yearTimeRange.GetMonths()) { MonthDemo.ShowCompactMonth(month); } WriteLine(); } // ShowAll
} // QueryPeriodData // ---------------------------------------------------------------------- private static void ShowPeriodData(string periodType, TimePeriodDemoData demoData) { Console.WriteLine(); Console.WriteLine("Time Period Demo"); Console.WriteLine("Start: {0}", demoData.SetupDate); switch (periodType.ToLower()) { case "y": YearDemo.ShowAll(demoData.PeriodCount, demoData.Year, demoData.CalendarConfig); break; case "by": BroadcastYearDemo.ShowAll(demoData.Year); break; case "hy": HalfyearDemo.ShowAll(demoData.PeriodCount, demoData.Year, demoData.Halfyear, demoData.CalendarConfig); break; case "q": QuarterDemo.ShowAll(demoData.PeriodCount, demoData.Year, demoData.Quarter, demoData.CalendarConfig); break; case "m": MonthDemo.ShowAll(demoData.PeriodCount, demoData.Year, demoData.Month); break; case "bm": BroadcastMonthDemo.ShowAll(demoData.Year, demoData.Month); break; case "w": WeekDemo.ShowAll(demoData.PeriodCount, demoData.Year, demoData.Week, demoData.CalendarConfig); break; case "bw": BroadcastWeekDemo.ShowAll(demoData.Year, demoData.Week); break; case "d": DayDemo.ShowAll(demoData.PeriodCount, demoData.Year, demoData.Month, demoData.Day); break; case "h": HourDemo.ShowAll(demoData.PeriodCount, demoData.Year, demoData.Month, demoData.Day, demoData.Hour); break; case "min": MinuteDemo.ShowAll(demoData.PeriodCount, demoData.Year, demoData.Month, demoData.Day, demoData.Hour, demoData.Minute); break; } } // StartCalendarDemo