示例#1
0
        // Gets a vehicle to add, if the vehicle is already in the list then print a suitable message and change the status of vehicle to “InProgress”.
        public Dictionary <string, Dictionary <Dictionary <string, string>, string[]> > AddVehicle(string i_VehicleType, string i_EngineType, string i_LicensePlate)
        {
            Dictionary <string, Dictionary <Dictionary <string, string>, string[]> > nextInformation = null;

            if (IsExists(i_LicensePlate))
            {
                ChangeStatus(i_LicensePlate, eVehicleStatus.InProgress.ToString());
            }
            else
            {
                GarageVehicle garageVehicle = new GarageVehicle(i_VehicleType, i_EngineType, i_LicensePlate);
                nextInformation = garageVehicle.PropertiesToDictionary();

                r_GarageVehicles.Add(garageVehicle);
            }

            return(nextInformation);
        }
示例#2
0
        public Dictionary <string, Dictionary <Dictionary <string, string>, string[]> > GetInformation(string i_LicensePlate)
        {
            GarageVehicle garageVehicle = FindVehicle(i_LicensePlate);

            Dictionary <string, Dictionary <Dictionary <string, string>, string[]> > vehicle_information = garageVehicle.PropertiesToDictionary();

            Dictionary <string, string> vehicleType = new Dictionary <string, string>();

            vehicleType.Add("Type", $"{garageVehicle.Vehicle.Engine.EngineType} {garageVehicle.Vehicle.GetVehicleType()}");

            Dictionary <string, string> vehicleLicensePlate = new Dictionary <string, string>();

            vehicleLicensePlate.Add("License Plate", garageVehicle.Vehicle.LicensePlate);

            Dictionary <string, string> vehicleStatus = new Dictionary <string, string>();

            vehicleType.Add("Status", garageVehicle.Status.ToString());

            vehicle_information["Vehicle"].Add(vehicleType, null);
            vehicle_information["Vehicle"].Add(vehicleLicensePlate, null);
            vehicle_information["Vehicle"].Add(vehicleStatus, null);

            Dictionary <Dictionary <string, string>, string[]> properties_owner = new Dictionary <Dictionary <string, string>, string[]>();

            Dictionary <string, string> ownerName = new Dictionary <string, string>();

            ownerName.Add("Name", garageVehicle.OwnerName);

            Dictionary <string, string> ownerPhoneNumber = new Dictionary <string, string>();

            ownerPhoneNumber.Add("Phone Number", garageVehicle.OwnerPhoneNumber);

            properties_owner.Add(ownerName, Enum.GetNames(typeof(eCarColor)));
            properties_owner.Add(ownerPhoneNumber, Enum.GetNames(typeof(eCarNumOfDoors)));

            vehicle_information.Add("Owner", properties_owner);

            return(vehicle_information);
        }