/// <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); }
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; }
public string DisplayVehicleInformation(string i_LicensePlate) { VehiclesInGarage vehicle = GetExistVehicles(i_LicensePlate); if (vehicle == null) { throw new ArgumentNullException(); } return(vehicle.ToString()); }
/// <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); } }
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(); } }
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(); }
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); }
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); }
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); }
/// <summary> /// <para>Removes a Vehicle from the garage.</para> /// <seealso cref="GarageApplication.Classes.Garage.RemoveVehicle"/> /// </summary> public void RemoveVehicle(T item) { VehiclesInGarage.Remove(item); }