Esempio n. 1
0
        public static void DisplayChosenVehicles(Garage i_Garage, VehicleRecord.eVehicleStatus i_ChosenType)
        {
            Console.WriteLine(string.Format("Vehicles with status - {0}", i_ChosenType));
            short vehicleIndex = 1;

            foreach (KeyValuePair <int, Vehicle> item in i_Garage.AllGarageVehicles)
            {
                if (item.Value.VehicleInGarageRecord.CurrentVehicleStatus == i_ChosenType)
                {
                    Console.WriteLine(string.Format("{0}   {1}", vehicleIndex, item.Value.LicenceNumber));
                    vehicleIndex++;
                }
            }

            PressAnyKeyToContinue();
        }
Esempio n. 2
0
        public static void ShowAllVehicales(Garage i_Garage)
        {
            int viewVehicles = 0;

            VehicleRecord.eVehicleStatus chosenType = 0;
            try
            {
                Console.WriteLine(@"Pick how you want to see the vehicles - 
1. All           2. Under Repairs
3. Fixed         4. Paid for
5. Exit");
                bool isParsed = int.TryParse(Console.ReadLine().ToString(), out viewVehicles);
                if (isParsed == false)
                {
                    Console.WriteLine(string.Format("Not a valid option"));
                }

                do
                {
                    switch (viewVehicles)
                    {
                    case 1:
                        PrintAllLicenceNumbers(i_Garage);
                        break;

                    case 2:
                        chosenType = VehicleRecord.eVehicleStatus.UnderRepairs;
                        break;

                    case 3:
                        chosenType = VehicleRecord.eVehicleStatus.Fixed;
                        break;

                    case 4:
                        chosenType = VehicleRecord.eVehicleStatus.PaidFor;
                        break;

                    case 5:
                        Console.WriteLine("Exit succeeded.");
                        return;

                    default:
                        Console.WriteLine("Not Valid... Please insert again");
                        isParsed = int.TryParse(Console.ReadLine().ToString(), out viewVehicles);
                        if (isParsed == false)
                        {
                            Console.WriteLine(string.Format("Not a valid option"));
                        }

                        break;
                    }

                    if (chosenType != 0)
                    {
                        DisplayChosenVehicles(i_Garage, chosenType);
                    }

                    break;
                }while (viewVehicles != 5);
            }
            catch (FormatException i_FormatException)
            {
                Console.WriteLine("Value must be a number!");
                PressAnyKeyToContinue();
            }
        }
Esempio n. 3
0
 public void UpdateStatusOfCar(Vehicle i_CurrentVehicle, string i_VehicleLicenceNumber, VehicleRecord.eVehicleStatus i_UpdatedVehicleStatus)
 {
     i_CurrentVehicle.VehicleInGarageRecord.CurrentVehicleStatus = i_UpdatedVehicleStatus;
 }