} // StartArticleSamples // ---------------------------------------------------------------------- private static void StartCalendarDemo() { ConsoleTool.WriteSeparatorLine(); Console.WriteLine("Itenso Time Period Demo"); TimePeriodDemoData demoData = new TimePeriodDemoData(); // culture if (demoData.QueryCulture() == false) { return; } string periodType = "y"; while (!string.IsNullOrEmpty(periodType)) { try { if (QueryPeriodData(ref periodType, demoData) == false) { break; } } catch (Exception e) { Console.WriteLine("input error: " + e.Message); } if (string.IsNullOrEmpty(periodType)) { break; } ShowPeriodData(periodType, demoData); } } // Main
} // 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