//-----------------------------------------------------------------// private void printVehicleInformationFromGarage(Garage i_Garage) { Console.WriteLine("Printing vehicle information from the garage by license number:" + Environment.NewLine); int userChoice = 1; while (userChoice == 1) { try { string licenseNumber = this.getLicenseNumberFromUser(); Garage.InformationOfVehicle userVehicle = i_Garage.CheckForLicensePlate(licenseNumber); Console.WriteLine(userVehicle.ToString()); this.printBackToMenuPause(); userChoice = 2; } catch (ArgumentException exception) { Console.WriteLine(exception.Message); userChoice = this.printWrongInputMenuGetUserInput(); } } }
//-----------------------------------------------------------------// private void getVehicleInformation(Garage i_Garage) { Console.WriteLine("Adding vehicle to the garage:" + Environment.NewLine); Garage.InformationOfVehicle informationOfVehicle = null; string licenseNumber = this.getLicenseNumberFromUser(); if (i_Garage.VehiclesInTheGarage.TryGetValue(licenseNumber, out informationOfVehicle)) { Console.WriteLine("This license number already exists in the garage, changing state to In Repair"); informationOfVehicle.State = Garage.InformationOfVehicle.eVehicleStateInGarage.InRepair; } else { this.printVehicleMenu(); VehicleAllocator.eVehicleType vehicleType = (VehicleAllocator.eVehicleType) this.getValidInputValueInRange(1, 5); Vehicle newVehicle = VehicleAllocator.AllocateVehicle(vehicleType, licenseNumber); informationOfVehicle = this.fillInformationForVehicle(newVehicle, vehicleType); i_Garage.VehiclesInTheGarage.Add(licenseNumber, informationOfVehicle); Console.WriteLine("Vehicle added to the garage successfully!"); } this.printBackToMenuPause(); }