Ejemplo n.º 1
0
        // Print a list of vehicles in the garage by filter of vehicle status
        internal void GetVehicleList(GarageLogic.Garage i_Garage)
        {
            int option = 0;

            Console.WriteLine("To Filter by status pick a number of option below: ");

            // iterate through car statuses available and print them
            foreach (GarageLogic.Garage.eCarStatus status in Enum.GetValues(typeof(GarageLogic.Garage.eCarStatus)))
            {
                Console.WriteLine(option + ". " + status.ToString());
                option++;
            }

            Console.WriteLine("For default view press 3");

            // sets and validate a car status to change to
            string optionUserPicked = Console.ReadLine();

            while (!ValidtysUI.CheckMainPickValidity(optionUserPicked, 0, option))
            {
                Console.WriteLine("Illegal input, Please pick a number between 0 to " + option);
                optionUserPicked = Console.ReadLine();
            }

            // printing customers list with according filtering
            List <string> customersList = i_Garage.GetCustomersList(optionUserPicked);

            if (customersList.Count() == 0)
            {
                Console.WriteLine("No customers with required status are in the Garage, or no customers at all");
            }
            else
            {
                foreach (string customer in customersList)
                {
                    Console.WriteLine(customer);
                }
            }

            // show success message and takes back to main menu
            SuccessFinishOperation();
        }