예제 #1
0
        }         // QueryHour

        // ----------------------------------------------------------------------
        public bool QueryMinute()
        {
            int?minute = ConsoleTool.QueryNumber("Minute (0..59) [enter=" + Minute + "]: ", Minute, 0, TimeSpec.MinutesPerHour - 1);

            if (!minute.HasValue)
            {
                return(false);
            }
            Minute = minute.Value;
            return(true);
        }         // QueryMinute
예제 #2
0
        }         // QueryYearWeekType

        // ----------------------------------------------------------------------
        public bool QueryDay()
        {
            int?day = ConsoleTool.QueryNumber("Day (1..31) [enter=" + Day + "]: ", Day, 1, 31);

            if (!day.HasValue)
            {
                return(false);
            }
            Day = day.Value;
            return(true);
        }         // QueryDay
예제 #3
0
        }         // QueryDay

        // ----------------------------------------------------------------------
        public bool QueryHour()
        {
            int?hour = ConsoleTool.QueryNumber("Hour (0..23) [enter=" + Hour + "]: ", Hour, 0, TimeSpec.HoursPerDay - 1);

            if (!hour.HasValue)
            {
                return(false);
            }
            Hour = hour.Value;
            return(true);
        }         // QueryHour
예제 #4
0
        }         // QueryYearMonth

        // ----------------------------------------------------------------------
        public bool QueryWeek()
        {
            int?week = ConsoleTool.QueryNumber("Week (1..53) [enter=" + Week + "]: ", Week, 1, 53);

            if (!week.HasValue)
            {
                return(false);
            }
            Week = week.Value;
            return(true);
        }         // QueryWeek
예제 #5
0
        }         // QueryCulture

        // ----------------------------------------------------------------------
        public bool QueryPeriodCount()
        {
            int?periodCount = ConsoleTool.QueryNumber("Period count [enter=" + PeriodCount + "]: ", PeriodCount, 1, 10000);

            if (!periodCount.HasValue)
            {
                return(false);
            }
            PeriodCount = periodCount.Value;
            return(true);
        }         // QueryPeriodCount
예제 #6
0
        }         // QueryPeriodCount

        // ----------------------------------------------------------------------
        public bool QueryYear()
        {
            int?year = ConsoleTool.QueryNumber("Year [enter=" + Year + "]: ", Year, DateTime.MinValue.Year, DateTime.MaxValue.Year);

            if (!year.HasValue)
            {
                return(false);
            }
            Year = year.Value;
            return(true);
        }         // QueryYear
예제 #7
0
        }         // QueryWeek

        // ----------------------------------------------------------------------
        public bool QueryYearWeekType()
        {
            int?weekType = ConsoleTool.QueryNumber("Week type (0..1) [enter=" + (int)YearWeekType + "/" + YearWeekType + "]: ",
                                                   (int)YearWeekType, 0, 2);

            if (!weekType.HasValue)
            {
                return(false);
            }
            YearWeekType = (YearWeekType)weekType.Value;
            return(true);
        }         // QueryYearWeekType
예제 #8
0
        }         // QueryYearQuarter

        // ----------------------------------------------------------------------
        public bool QueryYearMonth()
        {
            int?yearMonth = ConsoleTool.QueryNumber("Month (1..12) [enter=" + (int)Month + "/" + Month + "]: ",
                                                    (int)Month, 1, TimeSpec.QuartersPerYear);

            if (!yearMonth.HasValue)
            {
                return(false);
            }
            Month = (YearMonth)yearMonth.Value;
            return(true);
        }         // QueryYearMonth
예제 #9
0
        }         // QueryYearBaseMonth

        // ----------------------------------------------------------------------
        public bool QueryYearHalfyear()
        {
            int?halfyear = ConsoleTool.QueryNumber("Halfyear (1..2) [enter=" + (int)Halfyear + "/" + Halfyear + "]: ",
                                                   (int)Halfyear, 1, TimeSpec.HalfyearsPerYear);

            if (!halfyear.HasValue)
            {
                return(false);
            }
            Halfyear = (YearHalfyear)halfyear.Value;
            return(true);
        }         // QueryYearHalfyear
예제 #10
0
        }         // QueryYear

        // ----------------------------------------------------------------------
        public bool QueryYearBaseMonth()
        {
            int?yearStartMonth = ConsoleTool.QueryNumber("Year start month (1..12) [enter=" + (int)YearBaseMonth + "/" + YearBaseMonth + "]: ",
                                                         (int)YearBaseMonth, 1, TimeSpec.MonthsPerYear);

            if (!yearStartMonth.HasValue)
            {
                return(false);
            }
            YearBaseMonth = (YearMonth)yearStartMonth.Value;
            return(true);
        }         // QueryYearBaseMonth
예제 #11
0
        }         // QueryYearHalfyear

        // ----------------------------------------------------------------------
        public bool QueryYearQuarter()
        {
            int?yearQuarter = ConsoleTool.QueryNumber("Quarter (1..4) [enter=" + (int)Quarter + "/" + Quarter + "]: ",
                                                      (int)Quarter, 1, TimeSpec.QuartersPerYear);

            if (!yearQuarter.HasValue)
            {
                return(false);
            }
            Quarter = (YearQuarter)yearQuarter.Value;
            return(true);
        }         // QueryYearQuarter
예제 #12
0
        // ----------------------------------------------------------------------
        public bool QueryCulture()
        {
            string cultureName = ConsoleTool.QueryText("Culture [enter=" + CultureInfo.CurrentCulture.Name + "]: ", CultureInfo.CurrentCulture.Name);

            if (cultureName == null)
            {
                return(false);
            }
            if (UpdateCulture(cultureName) == false)
            {
                return(false);
            }
            return(true);
        }         // QueryCulture
예제 #13
0
        }         // Reset

        // ----------------------------------------------------------------------
        private bool UpdateCulture(string cultureName)
        {
            try
            {
                culture = new CultureInfo(cultureName);
            }
            catch (Exception e)
            {
                ConsoleTool.WriteLine(e.Message);
                return(false);
            }
            CultureName = cultureName;
            return(true);
        }         // UpdateCulture
예제 #14
0
        }         // WriteLine

        // ----------------------------------------------------------------------
        protected static void WriteIndentLine(string text)
        {
            ConsoleTool.WriteIndentLine(text);
        }         // WriteIndentLine
예제 #15
0
        }         // WriteIndentLine

        // ----------------------------------------------------------------------
        protected static string Format(DateTime dateTime, bool compact = true)
        {
            return(ConsoleTool.Format(dateTime, compact));
        } // Format
예제 #16
0
        }         // WriteIndentLine

        // ----------------------------------------------------------------------
        protected static void WriteIndentLine(string format, params object[] args)
        {
            ConsoleTool.WriteIndentLine(format, args);
        }         // WriteIndentLine
예제 #17
0
        }         // Main

        // ----------------------------------------------------------------------
        private static bool QueryPeriodData(ref string periodType, TimePeriodDemoData demoData)
        {
            ConsoleTool.WriteSeparatorLine();
            do
            {
                string input = ConsoleTool.QueryText("Period type (y/by/hy/q/m/bm/w/bw/d/h/min) [enter=" + periodType + "]: ", periodType);
                if (string.IsNullOrEmpty(input))
                {
                    return(false);
                }

                switch (input)
                {
                case "Y":
                    Console.Clear();
                    goto case "y";

                case "y":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearBaseMonth());

                case "BY":
                    Console.Clear();
                    goto case "by";

                case "by":
                    periodType = input;
                    return
                        (demoData.QueryYear());

                case "HY":
                    Console.Clear();
                    goto case "hy";

                case "hy":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearBaseMonth() &&
                         demoData.QueryYearHalfyear());

                case "Q":
                    Console.Clear();
                    goto case "q";

                case "q":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearBaseMonth() &&
                         demoData.QueryYearQuarter());

                case "M":
                    Console.Clear();
                    goto case "m";

                case "m":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearMonth());

                case "BM":
                    Console.Clear();
                    goto case "bm";

                case "bm":
                    periodType = input;
                    return
                        (demoData.QueryYear() &&
                         demoData.QueryYearMonth());

                case "W":
                    Console.Clear();
                    goto case "w";

                case "w":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearWeekType() &&
                         demoData.QueryWeek());

                case "BW":
                    Console.Clear();
                    goto case "bw";

                case "bw":
                    periodType = input;
                    return
                        (demoData.QueryYear() &&
                         demoData.QueryWeek());

                case "D":
                    Console.Clear();
                    goto case "d";

                case "d":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearMonth() &&
                         demoData.QueryDay());

                case "H":
                    Console.Clear();
                    goto case "h";

                case "h":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearMonth() &&
                         demoData.QueryDay() &&
                         demoData.QueryHour());

                case "Min":
                    Console.Clear();
                    goto case "min";

                case "min":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearMonth() &
                         demoData.QueryDay() &&
                         demoData.QueryHour() &&
                         demoData.QueryMinute());
                }
            } while (true);
        }         // QueryPeriodData
예제 #18
0
        }         // WriteLine

        // ----------------------------------------------------------------------
        protected static void WriteLine()
        {
            ConsoleTool.WriteLine();
        }         // WriteLine