Пример #1
0
        public void RefuelFuelVehicle(string i_LicensePlate, FuelEnergy.eFuelType i_FuelType, float i_FuelToAdd)
        {
            this.checkLicensePlate(i_LicensePlate);
            FuelEnergy currentEnergy = this.m_Vehicle[i_LicensePlate].Vehicle.Energy as FuelEnergy;

            if (currentEnergy == null)
            {
                throw new ArgumentException("Vehicle doesn't have fuel type energy!");
            }

            currentEnergy.Refuel(i_FuelToAdd, i_FuelType);
        }
Пример #2
0
        private void refuelVehicle(string i_PlateNumber)
        {
            this.printMultiChoiceList(FuelEnergy.FuelTypeKey, Enum.GetNames(typeof(FuelEnergy.eFuelType)));
            this.printEnterChoiceMsg();
            string i_Choice = Console.ReadLine();

            try
            {
                FuelEnergy.eFuelType fuelTypeChosen = LogicUtils.EnumValidation <FuelEnergy.eFuelType>(i_Choice, FuelEnergy.FuelTypeKey);
                float amountToAdd = this.getAmountOfUnitsToAdd(FuelEnergy.FuelUnits);
                this.m_Garage.RefuelFuelVehicle(i_PlateNumber, fuelTypeChosen, amountToAdd);
                Console.WriteLine("The vehicle with license plate: {0} was refueled successfuly!", i_PlateNumber);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }