Пример #1
0
 private static void tryEnterVehicleToTheGarage(Garage i_Garage, string i_LicensePlate)
 {
     if (i_Garage.IsVehicleInGarage(i_LicensePlate))
     {
         Console.WriteLine("Your Vehicle Already In The Garage.");
         i_Garage.ChangeVehicleStatus(i_LicensePlate, Garage.eVehicleStatus.InProgress);
     }
     else
     {
         string ownerName, ownerPhone;
         getOwnerDetails(out ownerName, out ownerPhone);
         i_Garage.EnterNewVehicle(ownerName, ownerPhone, getVehicleFromClient(i_LicensePlate, i_Garage));
     }
 }
Пример #2
0
        public static void Run()
        {
            Garage myGarage = new Garage();

            Console.WriteLine(string.Format("Welcome To The Garage!"));
            Garage.eGarageOptions?clientChoosement = null;
            string     licensePlate  = null;
            const bool k_GarageExist = true;

            do
            {
                Console.WriteLine();
                printActionOptionsToClient();
                clientChoosement = getClientChoosement();
                if (clientChoosement != Garage.eGarageOptions.ShowLicensePlates)
                {
                    licensePlate = GetLicensePlate();
                    if (clientChoosement != Garage.eGarageOptions.EnterVehicle)
                    {
                        if (myGarage.IsVehicleInGarage(licensePlate) == false)
                        {
                            Console.WriteLine("This Vehicle Is Not In The Garage.");
                            continue;
                        }
                    }
                }

                switch (clientChoosement)
                {
                case Garage.eGarageOptions.EnterVehicle:
                {
                    tryEnterVehicleToTheGarage(myGarage, licensePlate);
                    break;
                }

                case Garage.eGarageOptions.ShowLicensePlates:
                {
                    showLicensePlates(myGarage);
                    break;
                }

                case Garage.eGarageOptions.ChangeVehicleStatus:
                {
                    Garage.eVehicleStatus vehicleStatus = getVehicleStatus();
                    myGarage.ChangeVehicleStatus(licensePlate, vehicleStatus);
                    break;
                }

                case Garage.eGarageOptions.InflateTires:
                {
                    myGarage.InflateTires(licensePlate);
                    break;
                }

                case Garage.eGarageOptions.FuelTank:
                {
                    tryFuelTank(myGarage, licensePlate);
                    break;
                }

                case Garage.eGarageOptions.ChargeElectricVehicle:
                {
                    tryChargeElectricVehicle(myGarage, licensePlate);
                    break;
                }

                case Garage.eGarageOptions.ShowVehicleDetails:
                {
                    Console.WriteLine(myGarage.GetVehicleDetailsString(licensePlate));
                    break;
                }

                default:
                {
                    break;
                }
                }
            }while (k_GarageExist);
        }