Пример #1
0
        private void OrderItem()
        {
            int Choice = 0;
            List <ItemOrderd> itemOrderds = new List <ItemOrderd>();
            int LimitOfItem = MaxLimitOfOrder;

            while (LimitOfItem != 0)
            {
OrderItem:
                ItemOrderd item = restro.BookItem(restro.ShowItem());
                if (item != null)
                {
                    itemOrderds.Add(item);
                }
                else
                {
                    goto OrderItem;
                }

                LimitOfItem--;
                if (LimitOfItem != 0)
                {
                    Choice = GetYesNoChoice("Do you want to order more Item ?");

                    if (Choice == 2)
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
            }
            restro.SetOrderedItemToCustomer(CustomerId, itemOrderds);

            while (true)
            {
                Choice = GetYesNoChoice("Do you want to Print Bill ?");

                if (Choice == 1)
                {
                    UpdateGrandTotal();
                    Console.WriteLine("   -------------------------------------------------------------------");
                    Console.WriteLine($"       Customer Name : {CustomerName}");
                    Console.WriteLine("   -------------------------------------------------------------------");
                    Console.WriteLine($"      ItemId  ItemName\tItemQuantity  ItemPrice   TotalAmount\n");

                    foreach (ItemOrderd item in itemOrderds)
                    {
                        Console.WriteLine(item.ToString());
                    }

                    Console.WriteLine("   -------------------------------------------------------------------");
                    Console.WriteLine($"  \t\t\tGrand Total : {GrandTotal}");
                    Console.WriteLine("   -------------------------------------------------------------------");
                    Console.WriteLine($"  \t**************Thank You !! Visit Again**************");
                    Console.WriteLine("   -------------------------------------------------------------------");

                    Console.WriteLine($"\nEvent Triggerd :\n\t{emailEvent.SendEmailToCustomer(this)}");
                    break;
                }
            }
        }