예제 #1
0
        private static void showPurchase(ShoppingList MainList)
        {
            DateTime start;
            DateTime end;

            Console.WriteLine("Enter Start of Time period in format dd MM yyyy");

            while (!DateTime.TryParseExact(Console.ReadLine(), "dd MM yyyy", new CultureInfo("ru-Ru"), DateTimeStyles.None, out start))
            {
                Console.WriteLine("Something went wrong. Try to input one more time");
            }


            Console.WriteLine("Enter End of Time period in format dd MM yyyy");

            while (!DateTime.TryParseExact(Console.ReadLine(), "dd MM yyyy", new CultureInfo("ru-Ru"), DateTimeStyles.None, out end))
            {
                Console.WriteLine("Something went wrong. Try to input one more time");
            }


            Console.WriteLine();
            List <string> return_list = MainList.PurchasesRange(start, end);

            if (return_list.Count() == 0)
            {
                Console.WriteLine("Not found any notes in this period of time\n");
            }
            else
            {
                return_list.ForEach(x => Console.WriteLine(x));
            }
        }