Example #1
0
        private static void changeVehicleStatus(Garage io_Garage)
        {
            Console.WriteLine("Please enter the License Plate that you would like to change it status");
            string licensePlate = Console.ReadLine();

            Console.WriteLine("Please enter your desired status for the vehicle");
            Garage.GarageVehicle.eVehicleStatus newStatusForVehicle = getValidStatusCar();
            bool isTheCarInTheGarage = io_Garage.ChangeStateOfVehicle(licensePlate, newStatusForVehicle);

            hadnleInputCarFoundOrNot(isTheCarInTheGarage, String.Format(
                                         @"Status for vehicle {0} was changed to {1}!", licensePlate, newStatusForVehicle));
        }
Example #2
0
        private static Garage.GarageVehicle.eVehicleStatus getValidStatusCar()
        {
            Console.WriteLine(string.Format(
                                  @"1 for 'in repaired'
2 for 'Repaired'
3 for 'Paid' "));
            int statusToFilter;

            getValidAnswerToMultyplyChoiceAnswer(out statusToFilter, 1, 3);
            Garage.GarageVehicle.eVehicleStatus statusForCar = Garage.GarageVehicle.eVehicleStatus.InRepair;
            switch (statusToFilter)
            {
            case -1: throw new FormatException("You are back in the main menu");

            case 1: statusForCar = Garage.GarageVehicle.eVehicleStatus.InRepair; break;

            case 2: statusForCar = Garage.GarageVehicle.eVehicleStatus.Repaired; break;

            case 3: statusForCar = Garage.GarageVehicle.eVehicleStatus.Paid; break;
            }

            return(statusForCar);
        }
Example #3
0
        private static void printCarList(Garage io_Garage)
        {
            Console.WriteLine(string.Format
                                  (@"If you want to filter results please press'y' and then press enter
in case you do not want to filter the result press any other key and then press enter"));
            String        inputFromUser = Console.ReadLine();
            bool          toFilter      = (inputFromUser == "y");
            List <string> listOfVehicleToString;

            if (toFilter)
            {
                Console.WriteLine(string.Format(
                                      "Please enter the category that you are looking for"));
                Garage.GarageVehicle.eVehicleStatus theStatusTheUserChose = getValidStatusCar();
                listOfVehicleToString = io_Garage.GetListOfLicensePlateNumbersOfVehiclesInGarageWithFilter
                                            (theStatusTheUserChose);
            }

            else
            {
                listOfVehicleToString = io_Garage.GetListOfLicensePlateNumbersOfVehiclesInGarage();
            }

            if (listOfVehicleToString.Count == 0)
            {
                Console.WriteLine("No Vehicles in garage!");
            }

            else
            {
                Console.WriteLine("This are the list of cars according to your request:");
                foreach (string vehicle in listOfVehicleToString)
                {
                    Console.WriteLine(vehicle);
                }
            }
        }