Example #1
0
        public void Recharge(string i_LicenseNumber, string i_MinuetsToCharge)
        {
            Customer customer = GetCustomer(i_LicenseNumber);

            if (!(customer.Vehicle.Engine is ElectricEngine))
            {
                throw new ArgumentException("Cannot recharge fuel engine");
            }

            float minuetsToAddToBattery = PropertiesValidation.PositiveFloatValidation(i_MinuetsToCharge);

            ((ElectricEngine)(customer.Vehicle.Engine)).Recharge(minuetsToAddToBattery / 60);
        }
        private void validationOfWheels(Dictionary <string, string> i_VehicleInfo)
        {
            float maximalAirPressure = PropertiesValidation.PositiveFloatValidation(i_VehicleInfo["Wheel maximal air pressure:"]);

            try
            {
                float currentAirPressure = PropertiesValidation.PositiveFloatValidation(i_VehicleInfo["Wheel current air pressure:"]);
                PropertiesValidation.ValidateCurrentAmount(currentAirPressure, maximalAirPressure);
            }
            catch (Exception ecxeption)
            {
                throw new ArgumentException("impossible wheel current air pressure. " + ecxeption.Message);
            }
        }
        private static void validationOfEngine(string i_CurrentEnergyAmount, string i_MaxEnergyAmount)
        {
            float MaxEnergyAmount = PropertiesValidation.PositiveFloatValidation(i_MaxEnergyAmount);

            try
            {
                float CurrentEnergyAmount = PropertiesValidation.PositiveFloatValidation(i_CurrentEnergyAmount);
                PropertiesValidation.ValidateCurrentAmount(CurrentEnergyAmount, MaxEnergyAmount);
            }
            catch (Exception ecxeption)
            {
                throw new ArgumentException("impossible current energy amount. " + ecxeption.Message);
            }
        }
Example #4
0
        public void Refuel(string i_LicenseNumber, string i_FuelType, string i_FuelAmountToAdd)
        {
            Customer customer = GetCustomer(i_LicenseNumber);

            if (!(customer.Vehicle.Engine is FuelEngine))
            {
                throw new ArgumentException("Cannot refuel electric engine");
            }

            int optionNumber = int.Parse(i_FuelType);

            FuelEngine.eFuelType fuelType = (FuelEngine.eFuelType)optionNumber;
            float amountToAdd             = PropertiesValidation.PositiveFloatValidation(i_FuelAmountToAdd);

            ((FuelEngine)(customer.Vehicle.Engine)).Refuel(amountToAdd, fuelType);
        }
 private void validationOfTruck(Dictionary <string, string> i_TruckInfo)
 {
     PropertiesValidation.ValidateLisenceNumber(i_TruckInfo["Lisence number:"]);
     PropertiesValidation.CheckeIfAnswerIsYesOrNo(i_TruckInfo["Carry dangerous materials:"]);
     PropertiesValidation.PositiveFloatValidation(i_TruckInfo["Carrying capacity:"]);
 }