public void FillFuel(string i_LicenseId, float i_AmountOfFuel, VehiclesEnums.eFuelType i_TypeOfFuel)
        {
            FuelEngine eng = m_Vehicles[i_LicenseId].Vehicle.Engine as FuelEngine;

            if (eng == null)
            {
                throw new ArgumentException(string.Format(k_NotFuelVehicle, i_LicenseId, Environment.NewLine));
            }

            eng.FillFuel(i_AmountOfFuel, i_TypeOfFuel);
        }
Exemple #2
0
        // resposible to validate data and fill up gas
        public void FillUpGas(string i_LicenseNumber, FuelEngine.eFuelType i_FuelType, float i_AmountToFill)
        {
            Customer currentCar = m_Customers[i_LicenseNumber];

            if (currentCar.CustomerVehicle.VehicleEngine.TypeOfEngine != "Fuel")
            {
                throw new Exception("this Vehicle is an electric Vehicle");
            }

            FuelEngine engineToFill = (FuelEngine)currentCar.CustomerVehicle.VehicleEngine;

            engineToFill.FillFuel(i_AmountToFill, i_FuelType);
        }
Exemple #3
0
 public void FuelUpVehicle(string i_LicenseNumber, float fuelAmmountToAdd, string fuelType)
 {
     if (m_VechicleRecords[i_LicenseNumber].Vehicle.Engine is FuelEngine)
     {
         FuelEngine fuelEngine           = m_VechicleRecords[i_LicenseNumber].Vehicle.Engine as FuelEngine;
         eFuelType  fuelTypeParsedToEnum = (eFuelType)Enum.Parse(typeof(eFuelType), fuelType);
         fuelEngine.FillFuel(fuelAmmountToAdd, fuelTypeParsedToEnum);
     }
     else
     {
         throw new ArgumentException("Trying to fuel up vehicle with electric engine ");
     }
 }
Exemple #4
0
        public void FillFuelVehicle(string i_LicenseNumber, FuelEngine.eFuelType i_FuelType, float i_AmountToFill)
        {
            checkIfVehicleInGarage(i_LicenseNumber);
            FuelEngine fuelEngine = r_VehiclesInGarage[i_LicenseNumber].Engine as FuelEngine;

            if (fuelEngine != null)
            {
                if (fuelEngine.FuelType != i_FuelType)
                {
                    throw new ArgumentException("Fuel Type is not a match");
                }

                fuelEngine.FillFuel(i_FuelType, i_AmountToFill);
                r_VehiclesInGarage[i_LicenseNumber].SetEnergyPercentage();
            }
            else
            {
                throw new ArgumentException(string.Format("vehicle {0} is not on fuel!", i_LicenseNumber));
            }
        }