Example #1
0
        private void SelectProduct()
        {
            Console.WriteLine("Enter Product code.");
            string product = Console.ReadLine().Trim().ToUpper();

            Console.WriteLine("How many of this item?");
            string quanity = Console.ReadLine().Trim();

            Console.WriteLine();

            if (!catering.IsProductValid(product))
            {
                Console.WriteLine("Not a valid product");
            }
            else if (catering.Quanity(quanity) == 0M)
            {
                Console.WriteLine("Quanity is not valid.");
            }
            else if (catering.IsSoldOut(product))
            {
                Console.WriteLine("Product is sold out.");
            }
            else if (!catering.IsSufficientQuanity(product, quanity))
            {
                Console.WriteLine("Not enough of this product for request.");
            }
            else if (!catering.IsSufficientFunds(product, quanity))
            {
                Console.WriteLine("Not enough money for request.");
            }
            else
            {
                catering.MakePurchase(product, quanity);
            }
        }