Exemplo n.º 1
0
        private void changeStatus(string i_ClientLicenseNumber)
        {
            eVehicleRepairStatus newStatus = eVehicleRepairStatus.COMPLETE; // initial value

            Console.WriteLine("Please enter the new status from the menu below:");

            printEnumList(newStatus);

            if (Enum.TryParse(Console.ReadLine(), out newStatus) && Enum.IsDefined(typeof(eVehicleRepairStatus), newStatus))
            {
                m_GarageManager.SetNewStatus(i_ClientLicenseNumber, newStatus);
            }
            else
            {
                Console.WriteLine("The status you've entered is invalid.");
                return;
            }
        }
Exemplo n.º 2
0
        private void printGarageVehiclesLicense()
        {
            eVehicleRepairStatus enumToPrint = eVehicleRepairStatus.COMPLETE;

            Console.WriteLine("Please decide which status of vehicle you want to see:");
            printEnumList(enumToPrint);
            Console.SetCursorPosition(0, Console.CursorTop - 1);
            Console.WriteLine("{0}. All", 4);

            string input = Console.ReadLine();

            try
            {
                StringUtils.CheckStringConsistsOnlyNumbers(input);
            }
            catch (FormatException ex)
            {
                Console.WriteLine(ex.Message);
                return;
            }

            if (int.Parse(input) == k_PrintAllOption)
            {
                printAllVehicles();
            }
            else
            {
                eVehicleRepairStatus status;
                if (Enum.TryParse(input, out status) && Enum.IsDefined(typeof(eVehicleRepairStatus), status))
                {
                    printByStatus(status);
                }
                else
                {
                    Console.WriteLine("Invalid decision, please try again");
                    return;
                }
            }
        }
Exemplo n.º 3
0
 private void printByStatus(eVehicleRepairStatus i_Status)
 {
     string[] licensesToPrint = m_GarageManager.GetLicensesByStatus(i_Status);
     printLicenses(licensesToPrint, "There are no vehicles of this status in the garage");
 }