Esempio n. 1
0
 public bool SelectManufacturer()
 {
     if (manufacturerService.GetAll().Any())
     {
         BaseConsoleFunction.WithdrawList(manufacturerService.GetAll().ToArray());
         Console.WriteLine("Select number of manufacturer");
         while (true)
         {
             var id = Checker.GetPropertyInt(Console.ReadLine());
             if (manufacturerService.SearchManufacturer(id) != null)
             {
                 break;
             }
             else
             {
                 Console.WriteLine($"{id} manufacturer does not exist");
             }
         }
         return(true);
     }
     else
     {
         BaseConsoleFunction.GetProperty("Manufacturers not yet established");
         return(false);
     }
 }
Esempio n. 2
0
        public void ChangeProduct(Action action)
        {
            var checkMenu = true;

            while (checkMenu)
            {
                Console.Clear();
                BaseConsoleFunction.WithdrawList(_changeMenuItems);
                BaseConsoleFunction.ConsoleDelimiter();
                BaseConsoleFunction.WithdrawList(_manufacturerService.Manufacturer.Foods.ToArray());
                var checkItem = Checker.GetPropertyInt(Console.ReadLine());
                switch (checkItem)
                {
                case 1:
                    CheckProduct(action);
                    break;

                case 2:
                    checkMenu = false;
                    break;

                default:
                    Console.WriteLine("Incorrect data");
                    Console.ReadLine();
                    break;
                }
            }
        }
Esempio n. 3
0
        public async Task PersonalArea()
        {
            var checkMenu = true;

            while (checkMenu)
            {
                Console.Clear();
                Console.WriteLine($"{_clientController.Client.FirstName} {_clientController.Client.LastName}");

                BaseConsoleFunction.WithdrawList(_cabinetMenuItems);

                var checkItem = Checker.GetPropertyInt(Console.ReadLine());
                switch (checkItem)
                {
                case 1:
                    ShowOrders();
                    break;

                case 2:
                    await CreateNewOrder();

                    break;

                case 3:
                    checkMenu = false;
                    break;

                default:
                    Console.WriteLine("Incorrect data");
                    Console.ReadLine();
                    break;
                }
            }
            Exit();
        }
Esempio n. 4
0
        public void PersonalArea()
        {
            var checkMenu = true;

            while (checkMenu)
            {
                Console.Clear();
                Console.WriteLine(manufacturerService.Manufacturer.Name);

                BaseConsoleFunction.WithdrawList(_cabinetMenuItems);
                var checkItem = Checker.GetPropertyInt(Console.ReadLine());
                switch (checkItem)
                {
                case 1:
                    _foodMenu.Start();
                    break;

                case 2:
                    checkMenu = false;
                    break;

                default:
                    Console.WriteLine("Incorrect data");
                    Console.ReadLine();
                    break;
                }
            }

            Exit();
        }
Esempio n. 5
0
        public void ShowMenu()
        {
            var foods = (manufacturerService.GetFoods());

            if (foods.Any())
            {
                BaseConsoleFunction.WithdrawList(foods.ToArray());
            }
            else
            {
                Console.WriteLine("This manufacturer have not foods yet");
            }
        }
Esempio n. 6
0
     public async Task Start()
     {
         _serviceMenu = null;
         Console.WriteLine("Press Number");
         BaseConsoleFunction.WithdrawList(_menuItems);
         while (_serviceMenu is null)
         {
             var checkItem = Checker.GetPropertyInt(Console.ReadLine());
             _serviceMenu = checkItem switch
             {
                 1 => new ManufacturerMenu(this, new FoodMenu(_foodontroller, _manufacturerService), _manufacturerService, _addressController),
                 2 => new ClientMenu(this, _clientController, _basketController, _addressController, _manufacturerService, _currencyController),
                 _ => null
             };
             if (_serviceMenu is null)
             {
                 Console.WriteLine("Input value outside the menu ");
             }
         }
         await _serviceMenu.Start();
     }
 }
Esempio n. 7
0
        public async Task Start()
        {
            var checkMenu = true;

            while (checkMenu)
            {
                Console.Clear();
                BaseConsoleFunction.WithdrawList(_foodMenuItems);
                var checkItem = Checker.GetPropertyInt(Console.ReadLine());
                switch (checkItem)
                {
                case 1:
                    ShowProducts();
                    break;

                case 2:
                    CreateNewProduct();
                    break;

                case 3:
                    ChangeProduct(Action.UPDATE);
                    break;

                case 4:
                    ChangeProduct(Action.DELETE);
                    break;

                case 5:
                    checkMenu = false;
                    break;

                default:
                    Console.WriteLine("Incorrect data");
                    Console.ReadLine();
                    break;
                }
            }
        }
Esempio n. 8
0
        public async Task  CreateNewOrder()
        {
            Console.Clear();
            if (SelectManufacturer())
            {
                var continueCheck = true;
                while (continueCheck)
                {
                    Console.Clear();
                    await ShowOrderPrice();

                    BaseConsoleFunction.ConsoleDelimiter();
                    BaseConsoleFunction.WithdrawList(_orderMenuItems);
                    BaseConsoleFunction.ConsoleDelimiter();
                    ShowMenu();

                    var checkItem = Checker.GetPropertyInt(Console.ReadLine());
                    switch (checkItem)
                    {
                    case 1:
                        AddProduct();
                        break;

                    case 2:
                        CreateOrder();
                        break;

                    case 3:
                        continueCheck = false;
                        break;

                    default:
                        Console.WriteLine("Incorrect data");
                        break;
                    }
                }
            }
        }
Esempio n. 9
0
        private void CreateOrder()
        {
            var items = _basketController.GetBasketItems();

            if (items.Any())
            {
                BaseConsoleFunction.WithdrawList(items.ToArray());
                if (BaseConsoleFunction.CheckArea("Want to issue a order ? y/n", "y"))
                {
                    var phoneNumber = Checker.GetPropertyPhoneNumber(BaseConsoleFunction.GetProperty("Enter phone"));
                    var street      = Checker.GetPropertyStreet(BaseConsoleFunction.GetProperty("Enter street"));
                    var houseNumber = Checker.GetPropertyHome(BaseConsoleFunction.GetProperty("Enter house number"));
                    var address     = AddressController.CreateAddress(street, houseNumber);
                    _clientController.CreateOrder(phoneNumber, address, _basketController.Basket);
                    _basketController.ClearBasket();
                    Console.WriteLine("Order was created!");
                    Console.ReadLine();
                }
            }
            else
            {
                BaseConsoleFunction.GetProperty("Your basket is empty. Press enter to continue ");
            }
        }
Esempio n. 10
0
 public void ShowProducts()
 {
     Console.Clear();
     BaseConsoleFunction.WithdrawList(_manufacturerService.Manufacturer.Foods.ToArray());
     Console.ReadLine();
 }
Esempio n. 11
0
 public void ShowOrders()
 {
     Console.Clear();
     BaseConsoleFunction.WithdrawList(_clientController.Client.Orders.ToArray());
     Console.ReadLine();
 }