public static GarageVehicleStatus Parse(string i_GarageVehicleStatusAsStr)
        {
            eGarageVehicleStatus vehicleStatusToSet = eGarageVehicleStatus.UnderRepair;

            if (i_GarageVehicleStatusAsStr == "2" || i_GarageVehicleStatusAsStr.Contains("Fi") || i_GarageVehicleStatusAsStr.Contains("fi") || i_GarageVehicleStatusAsStr.Contains("FI"))
            {
                vehicleStatusToSet = eGarageVehicleStatus.Fixed;
            }
            else if (i_GarageVehicleStatusAsStr == "3" || i_GarageVehicleStatusAsStr.Contains("Pa") || i_GarageVehicleStatusAsStr.Contains("pa") || i_GarageVehicleStatusAsStr.Contains("PA"))
            {
                vehicleStatusToSet = eGarageVehicleStatus.Paid;
            }
            else if (i_GarageVehicleStatusAsStr == "4" || i_GarageVehicleStatusAsStr.Contains("Al") || i_GarageVehicleStatusAsStr.Contains("AL") || i_GarageVehicleStatusAsStr.Contains("al"))
            {
                vehicleStatusToSet = eGarageVehicleStatus.AllStatuses;
            }
            else if (i_GarageVehicleStatusAsStr != "1" && !i_GarageVehicleStatusAsStr.Contains("Un") && !i_GarageVehicleStatusAsStr.Contains("UN") && !i_GarageVehicleStatusAsStr.Contains("un"))
            {
                throw new FormatException();
            }

            GarageVehicleStatus vehicleStatus = new GarageVehicleStatus();

            vehicleStatus.VehicleStatus = vehicleStatusToSet;

            return(vehicleStatus);
        }
示例#2
0
        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);
            }
        }
示例#3
0
        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);
        }
示例#4
0
        public string[] GetLicenseNumsOfAllVehiclesWithSpecStatus(GarageVehicleStatus i_Status)
        {
            Dictionary <string, Vehicle> collectionToScan = detectCollectionByStatus(i_Status);

            return(extractKeyValues(collectionToScan));
        }