Exemplo n.º 1
0
        private void refuel()
        {
            string stringToPrint;
            float  amountOfFuelToAdd;

            FuelTank.eFuelType fuelType = new FuelTank.eFuelType();
            string             licenseNumber;

            stringToPrint = "Please enter the vehicle number";
            UI.PrintString(stringToPrint.ToString());
            licenseNumber = UI.ReadStringFromUser();

            stringToPrint = "Please enter the fuel type you want to add";
            UI.PrintString(stringToPrint.ToString());

            fuelType = (FuelTank.eFuelType)UI.GetInputAccordingToEnum(fuelType);

            stringToPrint = "Please enter the amount of fuel you want to add";
            UI.PrintString(stringToPrint.ToString());
            amountOfFuelToAdd = UI.ReadFloatFromUser();
            try
            {
                r_Garage.Refuel(licenseNumber, amountOfFuelToAdd, fuelType);
            }
            catch (Exception exception)
            {
                UI.PrintString(exception.Message);
            }
        }
Exemplo n.º 2
0
        private Vehicle.eVehicleType getVehicleType()
        {
            Vehicle.eVehicleType userChoice = new Vehicle.eVehicleType();
            string stringToPrint            = "Please choose type of vehicle:";

            UI.PrintString(stringToPrint);
            userChoice = (Vehicle.eVehicleType)UI.GetInputAccordingToEnum(userChoice);

            return(userChoice);
        }
Exemplo n.º 3
0
        private EnergySource.eEnergySourceType getEnergySource(Vehicle.eVehicleType i_TypeOfVehicle)
        {
            bool   isTruck = i_TypeOfVehicle == Vehicle.eVehicleType.Truck;
            string stringToPrint;

            EnergySource.eEnergySourceType energyType = new EnergySource.eEnergySourceType();

            if (!isTruck)
            {
                stringToPrint = "Please choose the energy source:";
                UI.PrintString(stringToPrint);
                energyType = (EnergySource.eEnergySourceType)UI.GetInputAccordingToEnum(energyType);
            }
            else
            {
                energyType = EnergySource.eEnergySourceType.Fuel;
            }

            return(energyType);
        }
Exemplo n.º 4
0
        private void changeTheStatusOfVehicle()
        {
            string stringToPrint;
            int    userChoice;
            string licenseNumber;

            VehicleFolder.eVehicleStatus statusesInGarage = new VehicleFolder.eVehicleStatus();

            stringToPrint = "Please enter the vehicle number";
            UI.PrintString(stringToPrint);
            licenseNumber = UI.ReadStringFromUser();
            userChoice    = UI.GetInputAccordingToEnum(statusesInGarage);
            try
            {
                r_Garage.ChangeTheStatusOfCar(licenseNumber, (VehicleFolder.eVehicleStatus)userChoice);
            }
            catch (ArgumentException exception)
            {
                UI.PrintString(exception.Message);
            }
        }
Exemplo n.º 5
0
        private void displayVehiclesInGarage()
        {
            string        stringToPrint;
            int           userChoice = -1, allVehicles = 1;
            List <string> vehiclesToDisplay = null;

            stringToPrint = "Press 0 to display vehicles sorted according to status, and 1 to display all vehicles in the garage: ";
            UI.PrintString(stringToPrint.ToString());
            userChoice = UI.ReadIntFromUser();
            if (userChoice == allVehicles)
            {
                vehiclesToDisplay = r_Garage.DisplayAllVehiclesInGarage(null);
            }
            else
            {
                VehicleFolder.eVehicleStatus statusesInGarage = new VehicleFolder.eVehicleStatus();
                userChoice = UI.GetInputAccordingToEnum(statusesInGarage);
                VehicleFolder.eVehicleStatus statusFilter = (VehicleFolder.eVehicleStatus)userChoice;
                vehiclesToDisplay = r_Garage.DisplayAllVehiclesInGarage(statusFilter);
            }

            UI.PrintStringList(vehiclesToDisplay);
        }