Пример #1
0
        /// <summary>
        /// This will list all the Guest present in the Database.
        /// </summary>
        /// <param name="logic"><see cref="IFrontOffice"/>.</param>
        public static void GetAllGuests(IFrontOffice logic)
        {
            if (logic == null)
            {
                throw new ArgumentNullException(nameof(logic));
            }

            var q = logic.GetAllGuests();

            q.ToConsole();
        }
Пример #2
0
        /// <summary>
        /// This method will list all the events in the database to the console.
        /// </summary>
        /// <param name="logic"><see cref="IAdminstratorLogic"/>.</param>
        public static void AllEvent(IFrontOffice logic)
        {
            if (logic == null)
            {
                throw new ArgumentNullException(nameof(logic));
            }

            var events = logic.GetAllEvent();

            events.ToConsole();
        }
Пример #3
0
        /// <summary>
        /// This method will display the Event info with specfic name.
        /// </summary>
        /// <param name="logic"><see cref="IFrontOffice"/>.</param>
        public static void GetEventInfo(IFrontOffice logic)
        {
            if (logic == null)
            {
                throw new ArgumentNullException(nameof(logic));
            }

            Console.WriteLine("Enter Event Name to Search: ");
            string name = Console.ReadLine();
            var    q    = logic.SearchEvent(name);

            q.ToConsole();
        }
Пример #4
0
        /// <summary>
        /// This method will ask the user for the ticket id and will show the result.
        /// </summary>
        /// <param name="logic"><see cref="IFrontOffice"/>.</param>
        public static void GetTicketInfo(IFrontOffice logic)
        {
            if (logic == null)
            {
                throw new ArgumentNullException(nameof(logic));
            }

            Console.WriteLine("Enter Ticket Id: ");
            int    id   = int.Parse(Console.ReadLine());
            Ticket item = logic.GetOneTicket(id);

            if (item != null)
            {
                Console.WriteLine($"Ticket Id: {item.Id} \nPrice Paid: {item.PricePaid} \nEvent: {item.Events.Name} \nDiscount: {item.Discount}\n");
            }
            else
            {
                Console.WriteLine("No ticket found with this ID");
            }

            Console.ReadKey();
        }
Пример #5
0
        /// <summary>
        /// This method will ask the Guest info from the user.
        /// </summary>
        /// <param name="logic"><see cref="IFrontOffice"/>.</param>
        public static void AddGuest(IFrontOffice logic)
        {
            if (logic == null)
            {
                throw new ArgumentNullException(nameof(logic));
            }

            Console.WriteLine("Enter Name: ");
            string name = Console.ReadLine();

            Console.WriteLine("Enter Mobile Number: ");
            string contact = Console.ReadLine();

            Console.WriteLine("Enter City: ");
            string city = Console.ReadLine();

            Console.WriteLine("Enter Email Address: ");
            string email = Console.ReadLine();

            Console.WriteLine("Enter Gender: ");
            string gender = Console.ReadLine();

            logic.Add(name, contact, city, email, gender);
        }
Пример #6
0
 public FrontOfficeController(IFrontOffice office)
 {
     _office = office;
 }
Пример #7
0
        /// <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);
        }