} // 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
// ---------------------------------------------------------------------- public static void ShowAll(int periodCount, int year, YearMonth month, int day, int hourValue) { WriteLine("Input: count={0}, year={1}, month={2}, day={3}, hour={4}", periodCount, year, month, day, hourValue); WriteLine(); HourTimeRange hourTimeRange; if (periodCount == 1) { Hour hour = new Hour(year, (int)month, day, hourValue); hourTimeRange = hour; Hour previousHour = hour.GetPreviousHour(); Hour nextHour = hour.GetNextHour(); ShowHour(hour); ShowCompactHour(previousHour, "Previous Hour"); ShowCompactHour(nextHour, "Next Hour"); WriteLine(); } else { Hours hours = new Hours(year, (int)month, day, hourValue, periodCount); hourTimeRange = hours; ShowHours(hours); WriteLine(); foreach (Hour hour in hours.GetHours()) { ShowCompactHour(hour); } WriteLine(); } foreach (Minute minute in hourTimeRange.GetMinutes()) { MinuteDemo.ShowCompactMinute(minute); } WriteLine(); } // ShowAll