public ItemOrderd BookItem(int ItemId) { ItemOrderd itemOrderd = new ItemOrderd(); foreach (ItemModel item in ListOfItem) { if (item.ItemId == ItemId) { if (!item.IsItemAvailable) { Console.WriteLine("Item not Available Please try anather item.\n"); return(null); } Quantity: Console.WriteLine($"Enter Quantity for {item.ItemName}"); int Quantity = Convert.ToInt32(Console.ReadLine()); if (Quantity > 0) { itemOrderd.setItem(item, Quantity, true); break; } else { Console.WriteLine("Quantity should be greater than 0"); goto Quantity; } } } return(itemOrderd); }
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; } } }