Beispiel #1
0
        public void BookTicket()
        {
            PassengerRepository passenger = new PassengerRepository();

            if (HomePage.LoggedInStatus)
            {
                Console.WriteLine("Welcome to booking page");
                Console.WriteLine("Please Enter the Train Number you wish to Book :");
                string trainNumber = Validate.CheckTrainNumber(Console.ReadLine());

                Console.WriteLine("Enter number of Tickets");
                int count = Validate.ValidateInteger(Console.ReadLine());

                trainRepository.UpdateTicket(trainNumber, count);

                for (int i = 0; i < count; i++)
                {
                    Console.WriteLine("\n****Enter Passenger Detail {0} *****", i + 1);
                    PassengerRepository.AddDetail();
                }
                passenger.MapBookingDetail(UserRepository.LoggedInUserId);
            }
            else
            {
                Console.WriteLine("You Must Login to Book the Ticket");
            }
        }
Beispiel #2
0
        public static void UserBookingOptions() //Provides User Option
        {
            TrainManager trainManager = new TrainManager();

            while (HomePage.LoggedInStatus)
            {
                Console.WriteLine("\n[Select a option]\n1)Book Ticket\n2)Search Train Availability\n3)Display Booking Detail\n4)Cancel Booking\n5)Exit");
                int choice = Validate.ValidateInteger(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    if (HomePage.LoggedInStatus)
                    {
                        trainManager.BookTicket();
                    }
                    else
                    {
                        Console.WriteLine("You Must Login to Book the Ticket");
                        HomePage.startUp = true;
                    }
                    break;

                case 2:
                    trainManager.SearchTrain();
                    break;

                case 3:
                    PassengerRepository.DisplayBookingDetail();
                    break;

                case 4:
                    PassengerRepository.CancelBooking();
                    break;

                case 5:
                    HomePage.LoggedInStatus = false;
                    break;

                case 6:
                    Console.WriteLine("[WARN]  --Select a valid choice");
                    break;
                }
            }
        }