Inheritance: TimePeriodDemo
コード例 #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
コード例 #2
0
        // ----------------------------------------------------------------------
        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
コード例 #3
0
        // ----------------------------------------------------------------------
        public static void ShowAll(int periodCount, int startYear, YearHalfyear yearHalfyear, TimeCalendarConfig calendarConfig)
        {
            WriteLine("Input: count={0}, year={1}, halfyear={2}", periodCount, startYear, yearHalfyear);
            WriteLine();

            HalfyearTimeRange halfyearTimeRange;

            if (periodCount == 1)
            {
                Halfyear halfyear = new Halfyear(startYear, yearHalfyear, new TimeCalendar(calendarConfig));
                halfyearTimeRange = halfyear;

                Halfyear previousHalfyear = halfyear.GetPreviousHalfyear();
                Halfyear nextHalfyear     = halfyear.GetNextHalfyear();

                ShowHalfyear(halfyear);
                ShowCompactHalfyear(previousHalfyear, "Previous Halfyear");
                ShowCompactHalfyear(nextHalfyear, "Next Halfyear");
                WriteLine();
            }
            else
            {
                Halfyears halfyears = new Halfyears(startYear, yearHalfyear, periodCount, new TimeCalendar(calendarConfig));
                halfyearTimeRange = halfyears;

                ShowHalfyears(halfyears);
                WriteLine();

                foreach (Halfyear halfyear in halfyears.GetHalfyears())
                {
                    ShowCompactHalfyear(halfyear);
                }
                WriteLine();
            }

            foreach (Quarter quarter in halfyearTimeRange.GetQuarters())
            {
                QuarterDemo.ShowCompactQuarter(quarter);
            }
            WriteLine();
            foreach (Month month in halfyearTimeRange.GetMonths())
            {
                MonthDemo.ShowCompactMonth(month);
            }
            WriteLine();
        }         // ShowAll
コード例 #4
0
        // ----------------------------------------------------------------------
        public static void ShowAll(int periodCount, int startYear, YearQuarter yearQuarter, TimeCalendarConfig calendarConfig)
        {
            WriteLine("Input: count={0}, year={1}, quarter={2}", periodCount, startYear, yearQuarter);
            WriteLine();

            QuarterTimeRange quarterTimeRange;

            if (periodCount == 1)
            {
                Quarter quarter = new Quarter(startYear, yearQuarter, new TimeCalendar(calendarConfig));
                quarterTimeRange = quarter;

                Quarter previousQuarter = quarter.GetPreviousQuarter();
                Quarter nextQuarter     = quarter.GetNextQuarter();

                ShowQuarter(quarter);
                ShowCompactQuarter(previousQuarter, "Previous Quarter");
                ShowCompactQuarter(nextQuarter, "Next Quarter");
                WriteLine();
            }
            else
            {
                Quarters quarters = new Quarters(startYear, yearQuarter, periodCount, new TimeCalendar(calendarConfig));
                quarterTimeRange = quarters;

                ShowQuarters(quarters);
                WriteLine();

                foreach (Quarter quarter in quarters.GetQuarters())
                {
                    ShowCompactQuarter(quarter);
                }
                WriteLine();
            }

            foreach (Month month in quarterTimeRange.GetMonths())
            {
                MonthDemo.ShowCompactMonth(month);
            }
            WriteLine();
        }         // ShowAll