Esempio n. 1
0
        public void ChangeRepairState(string i_LicensePlate, Vehicle.eRepairState i_NewRepairState)
        {
            foreach (KeyValuePair <Vehicle, Owner> vehicle in m_VehiclesInGarage)
            {
                if (i_LicensePlate == vehicle.Key.LicensePlateNumber)
                {
                    vehicle.Key.RepairState = i_NewRepairState;
                    return;
                }
            }

            throw new ArgumentException(string.Format("Vehicle with this license plates does not exists in the Garage"));
        }
Esempio n. 2
0
        public StringBuilder AllLicenseNumbersWithStateOf(Vehicle.eRepairState repairState)
        {
            StringBuilder licensePlates = new StringBuilder();

            foreach (KeyValuePair <Vehicle, Owner> vehice in m_VehiclesInGarage)
            {
                if (vehice.Key.RepairState == repairState)
                {
                    licensePlates.AppendLine(vehice.Key.LicensePlateNumber);
                }
            }

            return(licensePlates);
        }
Esempio n. 3
0
        private void changeRepairState()
        {
            string licensePlates = getLicensePlateNumber();

            Vehicle.eRepairState newRepairState = getRepairState();
            try
            {
                r_Garage.ChangeRepairState(licensePlates, newRepairState);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Esempio n. 4
0
        private static Vehicle.eRepairState getRepairState()
        {
            string output = string.Format(
                @"Enter wanted repair state to display all vehicles.
0 for InRepair,
1 for Done,
2 for Paid");

            Console.WriteLine(output);

            int input = 0;

            int.TryParse(Console.ReadLine(), out input);
            Vehicle.eRepairState repairStateForFiltering = (Vehicle.eRepairState)input;

            return(repairStateForFiltering);
        }
Esempio n. 5
0
        private void displayAllLicenseNumbers()
        {
            Vehicle.eRepairState repairState = getRepairState();
            string output = string.Format(@"All License Plate Numbers With the State of {0}: ", repairState);

            Console.WriteLine(output);

            if (r_Garage.AllLicenseNumbersWithStateOf(repairState) != null)
            {
                output = r_Garage.AllLicenseNumbersWithStateOf(repairState).ToString();
                Console.WriteLine(output);
            }
            else
            {
                output = string.Format("None");
                Console.WriteLine(output);
            }
        }