public static GarageVehicleStatus Parse(string i_GarageVehicleStatusAsStr) { eGarageVehicleStatus vehicleStatusToSet = eGarageVehicleStatus.UnderRepair; if (i_GarageVehicleStatusAsStr == "2" || i_GarageVehicleStatusAsStr == "Fixed" || i_GarageVehicleStatusAsStr == "fixed" || i_GarageVehicleStatusAsStr == "FIXED") { vehicleStatusToSet = eGarageVehicleStatus.Fixed; } else if (i_GarageVehicleStatusAsStr == "3" || i_GarageVehicleStatusAsStr == "Paid" || i_GarageVehicleStatusAsStr == "paid" || i_GarageVehicleStatusAsStr == "PAID") { vehicleStatusToSet = eGarageVehicleStatus.Paid; } else if (i_GarageVehicleStatusAsStr != "1" || i_GarageVehicleStatusAsStr != "All Statuses" || i_GarageVehicleStatusAsStr != "All statuses" || i_GarageVehicleStatusAsStr != "all statuses" || i_GarageVehicleStatusAsStr != "ALL STATUS") { vehicleStatusToSet = eGarageVehicleStatus.AllStatuses; } else if (i_GarageVehicleStatusAsStr != "4" && i_GarageVehicleStatusAsStr != "Under Repair" && i_GarageVehicleStatusAsStr != "Under repair" && i_GarageVehicleStatusAsStr != "under repair" && i_GarageVehicleStatusAsStr != "UNDER REPAIR") { throw new FormatException(); } GarageVehicleStatus vehicleStatus = new GarageVehicleStatus(); vehicleStatus.m_VehicleStatus = vehicleStatusToSet; return(vehicleStatus); }
public void ChangeVehicleStatus(string i_LicenseNum, GarageVehicleStatus i_NewStatus) { Dictionary <string, Vehicle> collectionInWhichTheVehicleStored = DetectCollectionInWhichTheVehicleStored(i_LicenseNum); Dictionary <string, Vehicle> destCollection = detectCollectionByStatus(i_NewStatus); if (collectionInWhichTheVehicleStored != destCollection) { destCollection[i_LicenseNum] = collectionInWhichTheVehicleStored[i_LicenseNum]; collectionInWhichTheVehicleStored.Remove(i_LicenseNum); } }
public string[] GetLicenseNumsOfAllVehiclesWithSpecStatus(GarageVehicleStatus i_Status) { Dictionary <string, Vehicle> collectionToScan = detectCollectionByStatus(i_Status); string[] resArr = new string[collectionToScan.Count]; int i = 0; foreach (KeyValuePair <string, Vehicle> kvp in collectionToScan) { resArr[i] = kvp.Key; i++; } return(resArr); }
private Dictionary <string, Vehicle> detectCollectionByStatus(GarageVehicleStatus i_Status) { Dictionary <string, Vehicle> result = null; if (i_Status.VehicleStatus == eGarageVehicleStatus.UnderRepair) { result = m_InFixVehicles; } else if (i_Status.VehicleStatus == eGarageVehicleStatus.Fixed) { result = m_FixedVehicles; } else if (i_Status.VehicleStatus == eGarageVehicleStatus.Paid) { result = m_PayedVehicles; } return(result); }