Example #1
0
        private void addVehicleToGarage(string io_LicensePlate)
        {
            string  ownerName;
            string  ownerPhone;
            Vehicle newVehicle;

            if (m_Garage.IsVehicleExists(io_LicensePlate))
            {
                Console.WriteLine("Vehcile is allready listed in the garage!");
                Console.WriteLine("Changing the vehicle status to 'In Repair'...");
                m_Garage.ChangeStatus(io_LicensePlate, GarageLogic.VehicleTicket.eVehicleStatus.InRepair);
            }
            else
            {
                try
                {
                    Console.WriteLine("Owner name:");
                    ownerName = Console.ReadLine();
                    QualityCheck.IsStringContainOnlyChars(ownerName);
                    Console.WriteLine("Owner phone number:");
                    ownerPhone = Console.ReadLine();
                    QualityCheck.IsPhoneNumberValid(ownerPhone);
                    newVehicle = getNewVehicle(io_LicensePlate);
                    m_Garage.AddVehicleTicket(ownerName, ownerPhone, newVehicle);
                    Console.WriteLine("Vehicle was added successfully");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine("Vehicle was not added!");
                }
            }
        }