Example #1
0
        static void task1()
        {
            string             path  = "";
            List <TouringTrip> goods = new List <TouringTrip>();

            Console.WriteLine("Введiть шлях до файлу '' або натиснiть будь-яку клавiшу, щоб створити новий");
            path = Console.ReadLine();
            try
            {
                goods = Kiosk.ReadDate(path);
            }
            catch
            {
                path = "Data.txt";
            }

            while (true)
            {
                Console.Clear();
                Kiosk.ShowTable(goods);
                var press = Console.ReadKey().Key;
                if (press.ToString() == "Enter")
                {
                    Main();
                }
                if (press.ToString() == "P")
                {
                    Console.WriteLine();
                    Kiosk.ChangeDate(goods);
                    Kiosk.SaveDate(goods, path);
                }
                if (press.ToString() == "D")
                {
                    Console.WriteLine();
                    Kiosk.AddNew(goods);
                    Kiosk.SaveDate(goods, path);
                }
                if (press.ToString() == "M")
                {
                    Console.WriteLine();
                    if (goods.Count > 0)
                    {
                        goods[0].Smallest(goods);
                        Console.WriteLine("Натиснiть будь-яку клавiшу");
                        Console.ReadKey();
                    }
                    Kiosk.SaveDate(goods, path);
                }
                if (press.ToString() == "T")
                {
                    Console.WriteLine();
                    if (goods.Count > 0)
                    {
                        goods[0].ToComment(goods);
                    }
                    Kiosk.SaveDate(goods, path);
                }
                if (press.ToString() == "N")
                {
                    Console.WriteLine();
                    if (goods.Count > 0)
                    {
                        goods[0].Total(goods);
                    }
                    Kiosk.SaveDate(goods, path);
                }
            }
        }
Example #2
0
        static void task1()
        {
            string             path  = "";
            List <TouringTrip> goods = new List <TouringTrip>();

            Console.WriteLine("Enter path to file like '' or enter any to create new file");
            path = Console.ReadLine();
            try
            {
                goods = Kiosk.ReadDate(path);
            }
            catch
            {
                path = "Data.txt";
            }

            while (true)
            {
                Console.Clear();
                Kiosk.ShowTable(goods);
                var press = Console.ReadKey().Key;
                if (press.ToString() == "Enter")
                {
                    Main();
                }
                if (press.ToString() == "P")
                {
                    Console.WriteLine();
                    Kiosk.ChangeDate(goods);
                    Kiosk.SaveDate(goods, path);
                }
                if (press.ToString() == "D")
                {
                    Console.WriteLine();
                    Kiosk.AddNew(goods);
                    Kiosk.SaveDate(goods, path);
                }
                if (press.ToString() == "M")
                {
                    Console.WriteLine();
                    if (goods.Count > 0)
                    {
                        goods[0].Smallest(goods);
                        Console.WriteLine("Press any key to return into table");
                        Console.ReadKey();
                    }
                    Kiosk.SaveDate(goods, path);
                }
                if (press.ToString() == "T")
                {
                    Console.WriteLine();
                    if (goods.Count > 0)
                    {
                        goods[0].ToComment(goods);
                    }
                    Kiosk.SaveDate(goods, path);
                }
                if (press.ToString() == "N")
                {
                    Console.WriteLine();
                    if (goods.Count > 0)
                    {
                        goods[0].Total(goods);
                    }
                    Kiosk.SaveDate(goods, path);
                }
            }
        }