public void AddVehicleToGarage(string i_Owner, string i_Phone, VehicleInputData i_VehicleData) { VehicleCard newCard, foundCard; Vehicle newVehicle; try { foundCard = FindCardByLicense(i_VehicleData.m_LicenseNumber); } catch (KeyNotFoundException) { foundCard = null; } if (foundCard == null) { newVehicle = VehicleCreator.CreateNewVehicle(i_VehicleData); newCard = new VehicleCard(i_Owner, i_Phone, VehicleCard.eVehicleStatus.InService, newVehicle); m_Cards.Add(newCard); } else { foundCard.Status = VehicleCard.eVehicleStatus.InService; throw new VehicleAllreadyInGarageException(new Exception(), foundCard.Vehicle.LicenseNumber); } }
public void ChangeVehicleStatus(string i_LicenseNumber, VehicleCard.eVehicleStatus i_NewsStatus) { VehicleCard cardToChange = null; cardToChange = m_Cards.Find(vehicleToChange => vehicleToChange.Vehicle.LicenseNumber.Equals(i_LicenseNumber)); if (cardToChange == null) { throw new KeyNotFoundException(); ///// license number? empty ctor? } cardToChange.Status = i_NewsStatus; }
public VehicleCard FindCardByLicense(string i_LicenseNumber) { VehicleCard o_FoundCard = null; o_FoundCard = m_Cards.Find(card => card.Vehicle.LicenseNumber.Equals(i_LicenseNumber)); if (o_FoundCard == null) { throw new KeyNotFoundException(); } return(o_FoundCard); }
public void AddNewVehicle(string i_VehicleType, string i_LicensePlateSrting, string i_VehicleModel, string i_OwnerName, string i_OwnerPhone, float i_EnergyLeft, string i_WheelManufacturer, float i_WheelCurrentAirPressure, string[] i_Parameters) { Vehicle newVehicle = VehicleInfo.CreateVehicle(i_VehicleType, i_LicensePlateSrting, i_VehicleModel, i_EnergyLeft, i_WheelManufacturer, i_WheelCurrentAirPressure, i_Parameters); m_VehicleCards[i_LicensePlateSrting] = new VehicleCard(i_OwnerName, i_OwnerPhone, newVehicle); }