/// <summary> /// This method will display the guest info with specfic name. /// </summary> /// <param name="logic"><see cref="IFrontOffice"/>.</param> public static void GetGuestInfo(IFrontOffice logic) { if (logic == null) { throw new ArgumentNullException(nameof(logic)); } Console.WriteLine("Enter Guest Name to Search: "); string name = Console.ReadLine(); var q = logic.SearchGuest(name); q.ToConsole(); }
/// <summary> /// This method will allow user to sell the ticket to guest for particular event. /// </summary> /// <param name="logic"><see cref="IFrontOffice"/>.</param> public static void SellTicket(IFrontOffice logic) { if (logic == null) { throw new ArgumentNullException(nameof(logic)); } bool done = false; int guestId = 0, eventId = 0; Console.WriteLine("Enter Ticket Type "); string type = Console.ReadLine(); Console.WriteLine("Ticket Expiry "); string expiry = Console.ReadLine(); Console.WriteLine("Discount "); int discount = int.Parse(Console.ReadLine()); Console.WriteLine("Order Info "); string orderInfo = Console.ReadLine(); while (!done) { Console.WriteLine("Guest Name: "); string name = Console.ReadLine(); var q1 = logic.SearchGuest(name); if (q1.Count == 0) { Console.WriteLine("Guest profile doesn't exits"); var menu = new ConsoleMenu() .Add("Add new Guest", () => { AddGuest(logic); }) .Add("Quit", ConsoleMenu.Close); menu.Show(); } else if (q1.Count == 1) { guestId = q1.FirstOrDefault().ID; done = true; } else if (q1.Count > 1) { q1.ToConsole(); Console.WriteLine("Enter Guest ID"); int id = int.Parse(Console.ReadLine()); done = true; } } Console.WriteLine("Event Name: "); string eventName = Console.ReadLine(); var q = logic.SearchEvent(eventName); if (q.Count == 1) { eventId = q.FirstOrDefault().Id; } else { Console.WriteLine("Event Doesn't Exists"); Console.ReadKey(); return; } int price = logic.CalculatePricePaid(eventId, discount); logic.Add(expiry, discount, type, price, orderInfo, guestId, eventId); }