Пример #1
0
        private void displayCertainVehicle()
        {
            string        licenseNumber = getVehicleLicenseNumber();
            GarageVehicle vehicle       = m_Garage.GetVehicleDetails(licenseNumber);

            Console.WriteLine(vehicle.ToString());
        }
Пример #2
0
        private void changeStatusOfVehicle(GarageVehicle i_SearchvihicleInGarage)
        {
            Console.WriteLine("Please enter the Vehicles new status you would like to set:");
            eVehicleStatusInGarage statusToUpdate = ValidationOfData.GetStatusOnGarage();

            i_SearchvihicleInGarage.ChangeCarStatus(statusToUpdate);
            Console.WriteLine("The new status is: {0}", statusToUpdate);
        }
Пример #3
0
        public void ManageGarage()
        {
            string        liencenseIDFromUser     = string.Empty;
            bool          isVehicleInGarage       = false;
            GarageVehicle currentGarageToDealWith = null;

            Console.WriteLine("Welcome to our garage!");
            string firstMenuToPrint = string.Format(
                @"please enter your choice:
1.Enter a new vehicle to the garage.
2.Execute an action on an existing vehicle.
3.Desplay the list of vehicle license numbers.
4.Close the garage.");

            Console.WriteLine(firstMenuToPrint);
            int inputFromUser = ValidationOfData.GetIntFromUserWithinRange(4, 1);

            while (inputFromUser != 4)
            {
                switch (inputFromUser)
                {
                case 1:
                {
                    createNewVehicle();
                    break;
                }

                case 2:
                    liencenseIDFromUser = getLicenseNumberFromUser();
                    isVehicleInGarage   = m_HadarAndKochGarage.GetGarageVehicleFromUser(liencenseIDFromUser, out currentGarageToDealWith);
                    if (isVehicleInGarage)
                    {
                        performActionOnVehicle(currentGarageToDealWith);
                    }
                    else
                    {
                        Console.WriteLine("Vehicle can not be found on our Garage.");
                    }

                    break;

                case 3:
                    displayAllVehiclesLicenseNumber();
                    break;
                }

                Console.WriteLine(firstMenuToPrint);
                inputFromUser = ValidationOfData.GetIntFromUserWithinRange(4, 1);
            }
        }
Пример #4
0
        private void fillEnergyOfVehicle(GarageVehicle i_SearchvihicleInGarage, bool i_IsRefuelNeed)
        {
            bool        isSuccesfull = false;
            eFuelType   fuelToRefill;
            eEngineType engineType;

            if (i_IsRefuelNeed)
            {
                Console.WriteLine("Please enter the fuel type you would like to fill in - Soler(1)/Octan95(2)/Octan96(3)/octan98(4) :");
                fuelToRefill = ValidationOfData.GetFuelType();
                engineType   = eEngineType.Fuel;
            }
            else
            {
                fuelToRefill = eFuelType.Electricty;
                engineType   = eEngineType.Electric;
            }

            Console.WriteLine("Please enter how many energy would you like to fill in:");
            float amountOfEnergy = ValidationOfData.GetFloatFromUserWithinRange(i_SearchvihicleInGarage.VehicleInGarage.VehicleEngine.MaxAmountOfEnergy, 0); // to change it to within range

            try
            {
                isSuccesfull = i_SearchvihicleInGarage.FillFuelToMax(i_SearchvihicleInGarage.VehicleInGarage, engineType, fuelToRefill, amountOfEnergy);
            }
            catch (ValueOutOfRangeException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (ArgumentException)
            {
                Console.WriteLine(@"The fuel type entered {0} doesn't match the fuel type required .", fuelToRefill);
            }
            catch (Exception)
            {
                Console.WriteLine(@"The energy type entered {0} doesn't match to the vehicle engine .", fuelToRefill);
            }

            if (isSuccesfull)
            {
                printTheResult(isSuccesfull);
            }
        }
Пример #5
0
        private void performActionOnVehicle(GarageVehicle i_CurrentGarageToDealWith)
        {
            string secondMenuToPrint = string.Format(
                @"Choose an option to execute:
1.Change vehicle status.
2.Maximize the air pressure of your vehicle.
3.Powered by fuel your vehicle.
4.Chagre an electric vehicle.
5.Display vechile details by license number.");

            Console.WriteLine(secondMenuToPrint);
            int secondInputFromUSer = ValidationOfData.GetIntFromUserWithinRange(5, 1);

            switch (secondInputFromUSer)
            {
            case 1:
                changeStatusOfVehicle(i_CurrentGarageToDealWith);
                break;

            case 2:
                fillMaxAirOfVehicle(i_CurrentGarageToDealWith);
                break;

            case 3:
                fillEnergyOfVehicle(i_CurrentGarageToDealWith, true);
                break;

            case 4:
                fillEnergyOfVehicle(i_CurrentGarageToDealWith, false);
                break;

            case 5:
                displayFullDetailsOfVehicle(i_CurrentGarageToDealWith);
                break;
            }
        }
Пример #6
0
        private void displayFullDetailsOfVehicle(GarageVehicle i_SearchvihicleInGarage)
        {
            string infoForUSer = i_SearchvihicleInGarage.GatherInformationAboutTheVehicle();

            Console.WriteLine(infoForUSer);
        }
Пример #7
0
 private void fillMaxAirOfVehicle(GarageVehicle i_SearchvihicleInGarage)
 {
     i_SearchvihicleInGarage.FillAirInWheelsToMax();
 }