Example #1
0
        public void use()
        {
            SalesWork        sw               = new SalesWork();
            FileWork         fw               = new FileWork();
            List <Transport> worklist         = new List <Transport>();
            bool             flag             = true;
            bool             readFromFileFlag = false;
            string           choise;

            Console.WriteLine("Welcome to our system!!!");

            do
            {
                printMenu();
                choise = Console.ReadLine();

                switch (choise)
                {
                case "1":
                {
                    readFromFileItem(ref readFromFileFlag, worklist, fw);
                    break;
                }

                case "2":
                {
                    printAllInformationItem(worklist);
                    break;
                }

                case "3.1":
                {
                    SortWork.sortByModel(worklist);
                    PrintWork.printAll(worklist);
                    break;
                }

                case "6":
                {
                    worklist.Add(addNewItem());
                    break;
                }
                }
            } while (flag);
        }
Example #2
0
 private void readFromFileItem(ref bool readFromFileFlag, List <Transport> worklist, FileWork fw)
 {
     if (!readFromFileFlag)
     {
         worklist.AddRange(fw.readAllFromFile());
         readFromFileFlag = true;
         Console.WriteLine("Database loaded");
     }
     else
     {
         Console.WriteLine("Database is up to date");
     }
 }