Exemple #1
0
        /// <summary>
        /// <inheritdoc cref="ICashiersService.OnCustomerEnters"/>
        /// </summary>
        public void OnCustomerEnters(object sender, Customer customer)
        {
            Cashier cashier = getEmptiestOpenCashier();

            if (cashier == null)
            {
                _lineService.CustomersLine.AddLineItem(customer);
                Console.WriteLine($"The supermarket is close (no worker has checked-in).\n" +
                                  $" Customer '{customer}' sent back to the line.\n");
                return;
            }

            List <Product> randomProducts = ProductUtils.GenerateRandomProducts(_supermarketProducts);

            cashier.Registers[customer] = randomProducts;
            Console.WriteLine($"Customer '{customer}' has entered to the supermarket\n");
        }