Inheritance: TimePeriodDemo
Beispiel #1
0
        }         // 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
Beispiel #2
0
        // ----------------------------------------------------------------------
        public static void ShowAll(int periodCount, int year, YearMonth yearMonth, int dayValue)
        {
            WriteLine("Input: count={0}, year={1}, month={2}, day={3}", periodCount, year, yearMonth, dayValue);
            WriteLine();

            DayTimeRange dayTimeRange;

            if (periodCount == 1)
            {
                Day day = new Day(year, (int)yearMonth, dayValue);
                dayTimeRange = day;

                Day previousDay = day.GetPreviousDay();
                Day nextDay     = day.GetNextDay();

                ShowDay(day);
                ShowCompactDay(previousDay, "Previous Day");
                ShowCompactDay(nextDay, "Next Day");
                WriteLine();
            }
            else
            {
                Days days = new Days(year, (int)yearMonth, dayValue, periodCount);
                dayTimeRange = days;

                ShowDays(days);
                WriteLine();

                foreach (Day day in days.GetDays())
                {
                    ShowCompactDay(day);
                }
                WriteLine();
            }

            foreach (Hour hour in dayTimeRange.GetHours())
            {
                HourDemo.ShowCompactHour(hour);
            }
            WriteLine();
        }         // ShowAll