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 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);
        }
Ejemplo n.º 3
0
 public static void ChangeVehicleStatus(string i_LicenseID, eGarageVehicleStatus i_NewStatus)
 {
     if (!CurrentGarageVehicles.TryGetValue(i_LicenseID.GetHashCode(), out GarageVehicle currentVehicle))
     {
         throw new ArgumentException();
     }
     else
     {
         currentVehicle.CarStatus = i_NewStatus;
     }
 }
Ejemplo n.º 4
0
        public static List <string> GetLicenseIDsWithFilter(eGarageVehicleStatus i_StatusToFilter)
        {
            List <string> licenseIDs = new List <string>();

            foreach (GarageVehicle garageVehicle in CurrentGarageVehicles.Values)
            {
                if (i_StatusToFilter == garageVehicle.CarStatus)
                {
                    licenseIDs.Add(garageVehicle.VehicleOfGarage.LicenceID);
                }
            }
            return(licenseIDs);
        }
Ejemplo n.º 5
0
        private static void ChangeVehicleStatusParser()
        {
            Messages.printShortMessage("Please insert a License ID to change:");
            string o_LicenseID = r_UIGarageTypesParser.parseString(ReciveInput());

            if (!checkifLicenseIDExists(o_LicenseID))
            {
                sayAndThrowExceptIfLicenseIDNotExists();
            }
            Messages.askForVehcleStatus();
            eGarageVehicleStatus o_VehicleStatus = r_UIGarageTypesParser.parseGarageVehicleStatus(ReciveInputAsInt());

            Garage.ChangeVehicleStatus(o_LicenseID, o_VehicleStatus);
        }
Ejemplo n.º 6
0
 public GarageVehicle(Vehicle i_NewVehicleToInsert, string i_OwnerName, string i_OwnerPhoneNumber)
 {
     if (!CurrentGarageVehicles.ContainsKey(i_NewVehicleToInsert.GetHashCode()))
     {
         m_OwnerName        = i_OwnerName;
         m_OwnerPhoneNumber = i_OwnerPhoneNumber;
         m_CarStatus        = eGarageVehicleStatus.OnRepair;
         m_Vehicle          = i_NewVehicleToInsert;
         CurrentGarageVehicles.Add(i_NewVehicleToInsert.GetHashCode(), this);
     }
     else
     {
         CurrentGarageVehicles.TryGetValue(i_NewVehicleToInsert.GetHashCode(), out GarageVehicle garageVehicle);
         garageVehicle.m_CarStatus = eGarageVehicleStatus.OnRepair;
     }
 }
Ejemplo n.º 7
0
        private static void GetLicenseIDsParser()
        {
            List <string> licenseIDs;

            Messages.askForBool("you want to filter vehicle license IDs by status");
            if (r_UIGarageTypesParser.parseBool(ReciveInput()))
            {
                Messages.askForVehcleStatus();
                int i_input = ReciveInputAsInt();
                eGarageVehicleStatus statusOfVehicle = r_UIGarageTypesParser.parseGarageVehicleStatus(i_input);
                licenseIDs = Garage.GetLicenseIDsWithFilter(statusOfVehicle);
            }
            else
            {
                licenseIDs = Garage.GetLicenseIDs();
            }
            Console.Clear();
            Messages.printShortMessage(@"Garage Vehicles are:");
            foreach (string licenseID in licenseIDs)
            {
                Console.WriteLine(licenseID);
            }
        }