public void FurtherAction(int choice)
        {
            UserActions UserActions = new UserActions();

            if (choice == 1)
            {
                System.Threading.Thread.Sleep(1500);
                UserActions.DisplayMethods();
            }
            else
            {
                LoginActions LoginActions = new LoginActions();
                LoginActions.LogOut();
            }
        }
예제 #2
0
        public void DisplayMethods()
        {
            Console.Clear();

            List <string> Actions = new List <string> {
                "Offer a ride", "Find a ride", "View your offered rides", "View your bookings",
                "View bookings of your offered rides", "View your vehicles ", "Update Profile", "LogOut"
            };

            int actionNumber = 1;

            foreach (string action in Actions)
            {
                Console.WriteLine(actionNumber + ". " + action);
                actionNumber += 1;
            }

            int choice;

            if (LoginActions.currentUser.Name == "admin")
            {
                Console.WriteLine(actionNumber + ". Add/Update VehicleType");
                choice = commonMethods.ReadInt("Enter your choice : ");
                if (choice < 0 || choice > actionNumber)
                {
                    Console.WriteLine("Sorry!! Invalid Choice ");
                    DisplayMethods();
                }
            }

            else
            {
                actionNumber -= 1;
                choice        = commonMethods.ReadInt("Enter your choice : ");
                if (choice < 0 || choice > actionNumber)
                {
                    Console.WriteLine("Sorry!! Invalid Choice ");
                    DisplayMethods();
                }
            }

            switch (choice)
            {
            case 1: rideActions.OfferRide();
                break;

            case 2: rideActions.FindARide();
                break;

            case 3: rideActions.ViewOfferedRides();
                break;

            case 4: bookingActions.ViewYourBookings();
                break;

            case 5: bookingActions.ViewOfferBookings();
                break;

            case 6: vehicleActions.ViewVehicles();
                break;

            case 7: UpdateProfile();
                break;

            case 8: LoginActions loginActions = new LoginActions();
                loginActions.LogOut();
                break;

            case 9: int decision = commonMethods.ReadInt("Do you want to add/ update the vehicle type : 1. Add Vehicle 2. Update Vehicle 3. Go Back >> ");
                while (decision < 0 || decision > 3)
                {
                    decision = commonMethods.ReadInt("Please enter a valid choice between 1 and 3 : ");
                }
                switch (decision)
                {
                case 1: vehicleTypeActions.AddVehicleType();
                    break;

                case 2:
                    vehicleTypeActions.UpdateVehicleType();
                    break;

                case 3: commonMethods.FurtherAction(1);
                    break;
                }
                break;
            }
        }