Exemple #1
0
        /// <summary>
        /// <para>Adds a new Vehicle to the garage.</para>
        /// <seealso cref="GarageApplication.Classes.Garage.AddVehicle"/>
        /// </summary>
        public bool AddVehicle(T item)
        {
            if (VehiclesInGarage.Count() >= MaxAmountInGarage)
            {
                return(false);
            }

            VehiclesInGarage.Add(item);
            return(true);
        }
Exemple #2
0
        public void ChangeVehicleState(string i_LicensePlate, VehiclesInGarage.eStateInGarage i_ChangeState)
        {
            VehiclesInGarage vehicle = GetExistVehicles(i_LicensePlate);

            if (vehicle == null)
            {
                throw new ArgumentNullException();
            }

            vehicle.StateInGarage = i_ChangeState;
        }
Exemple #3
0
        public string DisplayVehicleInformation(string i_LicensePlate)
        {
            VehiclesInGarage vehicle = GetExistVehicles(i_LicensePlate);

            if (vehicle == null)
            {
                throw new ArgumentNullException();
            }

            return(vehicle.ToString());
        }
Exemple #4
0
 /// <summary>
 /// <para>Returns a T Vehicle by regnum.</para>
 /// <seealso cref="GarageApplication.Classes.Garage.GetVehicleByREGNUM"/>
 /// </summary>
 public T GetVehicleByREGNUM(string regNum)
 {
     try
     {
         return(VehiclesInGarage.Where(o => o.RegNumber == regNum).First());
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Exemple #5
0
        public void PumpAirInWheelsToMax(string i_LicensePlate)
        {
            VehiclesInGarage vehicle = GetExistVehicles(i_LicensePlate);

            if (vehicle == null)
            {
                throw new ArgumentNullException();
            }

            foreach (Wheel wheel in vehicle.Vehicle.Wheels)
            {
                wheel.PumpOperationToMax();
            }
        }
Exemple #6
0
        public void AddNewVehicleToGarage()
        {
            string ownersName = getOwnersName();

            Console.WriteLine("Please insert vehicle's owner's phone number: ");
            string           ownersPhoneNumber = GetValidInputs.GetValidPhoneNumber();
            Vehicle          vehicleToAdd      = getNewVehicleInfo();
            VehiclesInGarage newVehicle        = new VehiclesInGarage(ownersName, ownersPhoneNumber, vehicleToAdd);

            m_GarageSystem.AddNewVehicleToGarage(newVehicle);
            Console.WriteLine("----------------Adding new vehicle to the system----------------");
            System.Threading.Thread.Sleep(1000);
            Console.WriteLine("----------------The vehicle was added successfully!-------------");
            System.Threading.Thread.Sleep(1000);
            Console.Clear();
        }
Exemple #7
0
        public void FuelTheVehicle(string i_LicensePlate, FuelEngine.eFuelTypes i_FuelType, float i_AmountToFill)
        {
            VehiclesInGarage vehicle = GetExistVehicles(i_LicensePlate);

            if (vehicle == null)
            {
                throw new ArgumentNullException();
            }

            if (!(vehicle.Vehicle.EnergySource is FuelEngine))
            {
                throw new ArgumentException();
            }

            (vehicle.Vehicle.EnergySource as FuelEngine).FuelOperation(i_AmountToFill, i_FuelType);
        }
Exemple #8
0
        public void ChargeTheVehicle(string i_LicensePlate, float i_AddMinutes)
        {
            VehiclesInGarage vehicle = GetExistVehicles(i_LicensePlate);

            if (vehicle == null)
            {
                throw new ArgumentNullException();
            }

            if (!(vehicle.Vehicle.EnergySource is ElectricEngine))
            {
                throw new ArgumentException();
            }

            float MinutesToHours = i_AddMinutes / 60;

            (vehicle.Vehicle.EnergySource as ElectricEngine).LoadBatteryOperation(MinutesToHours);
        }
Exemple #9
0
        public bool TryToAddVehicle(Vehicle i_Vehicle, string i_OwnersName, string i_OwnersTelephone)
        {
            bool isCarExist = m_CarsInGarage.ContainsKey(i_Vehicle.LicensePlate); // true = exist, false = not exist in the garage

            if (i_Vehicle == null)
            {
                throw new ArgumentNullException();
            }

            if (isCarExist)
            {
                ChangeVehicleState(i_Vehicle.LicensePlate, VehiclesInGarage.eStateInGarage.RepairInProgress);
            }
            else
            {
                isCarExist = false;
                VehiclesInGarage newVehicle = new VehiclesInGarage(i_Vehicle, i_OwnersName, i_OwnersTelephone);
                m_CarsInGarage.Add(i_Vehicle.LicensePlate, newVehicle);
            }

            return(isCarExist);
        }
Exemple #10
0
 /// <summary>
 /// <para>Removes a Vehicle from the garage.</para>
 /// <seealso cref="GarageApplication.Classes.Garage.RemoveVehicle"/>
 /// </summary>
 public void RemoveVehicle(T item)
 {
     VehiclesInGarage.Remove(item);
 }