示例#1
0
        private void showFullVehicleInfoMenu()
        {
            try
            {
                string  regNum  = getExistingRegistrationNumberFromUser();
                Vehicle vehicle = m_Garage.GetVehicleByRegNum(regNum);
                Dictionary <string, string> vehicleInfo = m_Garage.GetVehicleInfo(ref vehicle);

                foreach (KeyValuePair <string, string> pair in vehicleInfo)
                {
                    Console.WriteLine("{0}: {1}", pair.Key, pair.Value);
                }

                Console.WriteLine(string.Empty);
            }
            catch (ArgumentException i_ArgumentException)
            {
                if (i_ArgumentException.Message == "Vehicle_Not_Exist")
                {
                    Console.WriteLine("There is no vehicle in the garage with the entered registration number.");
                }
            }
            catch (Exception i_Ex)
            {
                if (i_Ex.Message == "Invalid data input")
                {
                    Console.WriteLine("Error: {0}.{1}", i_Ex.Message, Environment.NewLine);
                }
                else
                {
                    Console.WriteLine("Error: Unknown.{0}", Environment.NewLine);
                }
            }
        }