Ejemplo n.º 1
0
        public void SearchByPropertyMenu()
        {
            bool returnToLastMenu = false;
            char nav = ' ';

            string brand, model, regNo, color, fuelType;
            int    noOfWheels, fuelCapacity;

            Console.WriteLine("\nGive in values to the Properties you want to search for a Vehicle with?\n");
            brand        = Util.AskForString("Enter a Brand to search for:");
            model        = Util.AskForString("Enter a Model to search for:");
            color        = Util.AskForString("Enter a Color to search for:");
            noOfWheels   = Util.AskForInt("Enter no of Wheels to search for:");
            fuelType     = Util.AskForString("Enter the Fuel Type to search for:");
            fuelCapacity = Util.AskForInt("Enter the Fuel Capacity to search for:");

            Console.Write("Input > ");
            string input = Console.ReadLine();


            do
            {
                Console.WriteLine("\nPlease choose a Vehicle to Park by entering the number \n(1, 2, 3 , 4, 5, 6, 7 or Q) of your choice"
                                  + "\n1. Search for a Vehicle by Properties."
                                  + "\n\nQ. Exit this menu.\n");
                try
                {
                    nav = input[0];
                }
                catch (IndexOutOfRangeException)
                {
                    Console.Clear();
                    Console.WriteLine("\nPlease enter some input!");
                }

                input = garageHandler.GetVehicleCommonProperties(input, out brand, out model, out regNo, out color, out noOfWheels, out fuelType, out fuelCapacity);

                switch (nav)
                {
                case '1':
                    garageHandler.SearchVehicleByProperties(brand, model, regNo, color, noOfWheels, fuelType, fuelCapacity);
                    break;

                case 'Q':                         // Exit Menu.
                case 'q':
                    returnToLastMenu = true;
                    break;

                default:
                    break;
                }
            } while (!returnToLastMenu);
        }