Пример #1
0
        static void Main(string[] args)
        {
            FileDatabaseService fileDatabaseService = new FileDatabaseService();
            StockService        stockService        = new StockService();
            MenuService         menuService         = new MenuService();
            OrdersService       ordersService       = new OrdersService();
            ConsoleUIService    consoleUIService    = new ConsoleUIService(fileDatabaseService, stockService, menuService, ordersService);

            string[] stockData = fileDatabaseService.ReadStock();
            if (stockData != null)
            {
                stockService.StockList = stockService.ParseStock(stockData);
            }

            string[] menuData = fileDatabaseService.ReadMenu();
            if (menuData != null)
            {
                menuService.MenuList = menuService.ParseMenu(menuData);
            }

            string[] ordersData = fileDatabaseService.ReadOrders();
            if (ordersData != null)
            {
                ordersService.OrdersList = ordersService.ParseOrders(ordersData);
            }

            while (true)
            {
                consoleUIService.PrintMessage(Constants.mainMenuMessage);
                int input = consoleUIService.GetInput();
                consoleUIService.ProcessInput(input);
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            IDatabaseService fileDatabaseService = new FileDatabaseService();
            IContactsService contactsService     = new ContactsService();
            IUIService       consoleUIService    = new ConsoleUIService(contactsService, fileDatabaseService);

            string[] contactsData = fileDatabaseService.ReadContacts();
            if (contactsData != null)
            {
                contactsService.ContactList = contactsService.ParseContacts(contactsData);
            }

            while (true)
            {
                consoleUIService.PrintMessage(Constants.MenuMessage);
                int input = consoleUIService.GetInput();
                consoleUIService.ProcessInput(input);
            }
        }