public override void UpdateUniqueProperties(string i_Key, string i_Value) { const int trueValue = 1; const int falseValue = 2; int trunkCool; if (i_Key == k_IsTrunkCooledKey) { int.TryParse(i_Value, out trunkCool); if (trunkCool > falseValue || trunkCool < trueValue) { throw new ValueOutOfRangeException(0, 1); } this.m_IsTrunkCooled = trunkCool == trueValue; } else if (i_Key == k_TrunkCapacityKey) { this.m_TrunkCapacity = LogicUtils.NumericValueValidation(i_Value, float.MaxValue); } else { throw new ArgumentException("Invalid key"); } }
public override void UpdateUniqueProperties(string i_Key, string i_Value) { if (i_Key == k_EngineVolumeKey) { this.m_EngineVolume = (int)LogicUtils.NumericValueValidation(i_Value, int.MaxValue); } else if (i_Key == k_LicenseTypeKey) { this.m_LicenseType = LogicUtils.EnumValidation <eLicenseType>(i_Value, i_Key); } else { throw new ArgumentException("Invalid key"); } }
public override void UpdateUniqueProperties(string i_Key, string i_Value) { if (i_Key == k_ColorKey) { this.m_Color = LogicUtils.EnumValidation <eColor>(i_Value, k_ColorKey); } else if (i_Key == k_DoorsNumKey) { this.m_DoorsNumber = LogicUtils.EnumValidation <eDoorsNumber>(i_Value, k_DoorsNumKey); } else { throw new ArgumentException("Invalid key"); } }
public string DisplayVehiclesList(string i_FilterByStatus) { eVehicleStatus fillter = eVehicleStatus.InProcess; StringBuilder licensePlatesStr = new StringBuilder(); if (i_FilterByStatus != this.k_NoStatusFilter) { fillter = LogicUtils.EnumValidation <Garage.eVehicleStatus>(i_FilterByStatus, Garage.k_VehicleStatusKey); } foreach (ClientVehicle client in this.m_Vehicle.Values) { if (i_FilterByStatus == this.k_NoStatusFilter || client.Status == fillter) { licensePlatesStr.Append(string.Format("{0}{1}", client.Vehicle.LicensePlate, Environment.NewLine).ToString()); } } return(licensePlatesStr.ToString()); }
public void UpdateVehicleStatus(string i_LicensePlate, string i_NewStatus) { Garage.eVehicleStatus statusToUpdate = LogicUtils.EnumValidation <Garage.eVehicleStatus>(i_NewStatus, k_VehicleStatusKey); this.checkLicensePlate(i_LicensePlate); this.m_Vehicle[i_LicensePlate].Status = statusToUpdate; }