Beispiel #1
0
        private static void changeVehicleStatus()
        {
            Console.WriteLine("Please enter registration plate number");
            string plateNumber = Console.ReadLine();

            GarageENums.eVehicleStatus newVehicleStatus = (GarageENums.eVehicleStatus)getUserChoiceFromEnumValues(typeof(GarageENums.eVehicleStatus));
            s_Garage.ChangeVehicleStatus(plateNumber, newVehicleStatus);
            Console.WriteLine("Vehicle status changed successfully");
        }
Beispiel #2
0
        public void ChangeVehicleStatus(string i_PlateNumber, GarageENums.eVehicleStatus i_NewVehicleStatus)
        {
            GarageVehicle vehicleToChangeStatus = getVehicleFromDictionary(i_PlateNumber);
            if (vehicleToChangeStatus == null)
            {
                throw new ArgumentException(string.Format("Vehicle with registration plate number {0} not found ", i_PlateNumber));
            }

            vehicleToChangeStatus.VehicleStatusInGarage = i_NewVehicleStatus;
        }
Beispiel #3
0
        public List<string> GetRegistrationPlate(GarageENums.eVehicleStatus i_StatusInGarage)
        {
            List<string> plateNumbers = new List<string>();
            foreach (GarageVehicle vehicleInGarage in m_DictOfGarageVehicles.Values)
            {
                if (vehicleInGarage.VehicleStatusInGarage == i_StatusInGarage)
                {
                    plateNumbers.Add(vehicleInGarage.Vehicle.RegistrationPlate);
                }
            }

            return plateNumbers;
        }
Beispiel #4
0
        private static void displayRegistrationPlates()
        {
            string        message;
            string        userInputAsString;
            List <string> registrationPlate;

            message = string.Format(
                "Do you want to use filter? :{0}Enter 1 for 'yes' or 2 for 'no'.",
                Environment.NewLine);
            Console.WriteLine(message);
            userInputAsString = Console.ReadLine();
            while (userInputAsString != "1" && userInputAsString != "2")
            {
                Console.WriteLine(message);
                userInputAsString = Console.ReadLine();
            }

            if (userInputAsString.Equals("1"))
            {
                GarageENums.eVehicleStatus filter = (GarageENums.eVehicleStatus)getUserChoiceFromEnumValues(typeof(GarageENums.eVehicleStatus));
                registrationPlate = s_Garage.GetRegistrationPlate(filter);
                if (registrationPlate.Count == 0)
                {
                    Console.WriteLine(String.Format("There are no vehicles in the garage with status {0}", filter));
                }
            }
            else
            {
                registrationPlate = s_Garage.GetRegistrationPlate();
                if (registrationPlate.Count == 0)
                {
                    Console.WriteLine("The garage is empty");
                }
            }

            if (registrationPlate.Count > 0)
            {
                foreach (string currentPlate in registrationPlate)
                {
                    Console.WriteLine(currentPlate);
                }
            }
        }
Beispiel #5
0
 public GarageVehicle(Vehicle i_Vehicle)
 {
     m_Vehicle = i_Vehicle;
     m_VehicleStatusInGarage = GarageENums.eVehicleStatus.InRepair;
 }