コード例 #1
0
        public string GetAllDetailsOfVehicle(string i_LicenseNum)
        {
            string details = null;
            Dictionary <string, Vehicle> collectionWhereVehicleStored = DetectCollectionInWhichTheVehicleStored(i_LicenseNum);

            if (collectionWhereVehicleStored == null)
            {
                throw new ArgumentException();
            }
            else
            {
                Vehicle theVehicle = collectionWhereVehicleStored[i_LicenseNum];
                details  = theVehicle.GetSpecificDetails();
                details += theVehicle.GetDetailsOfCommonThings();

                /* details += Environment.NewLine + m_VehiclesOwnersDetails[i_LicenseNum].OwnerName + Environment.NewLine + m_VehiclesOwnersDetails[i_LicenseNum].OwnerPhoneNum + Environment.NewLine;
                 *
                 */
                details = string.Format(
                    @"There are the details of current vehicle:
==========================================
{0}
{1}
{2}
Owner name: {3}
Owner phone: {4}",
                    theVehicle.GetSpecificDetails(),
                    theVehicle.GetDetailsOfCommonThings(),
                    getStatusAccordingToCollection(collectionWhereVehicleStored),
                    m_VehiclesOwnersDetails[i_LicenseNum].OwnerName,
                    m_VehiclesOwnersDetails[i_LicenseNum].OwnerPhoneNum);
            }

            return(details);
        }
コード例 #2
0
        public string GetVehicleDetails(string i_LicenseNumber)
        {
            string       vehicleDetails, wheelsDetails, engineDetails, vehicleSpecificDetails;
            Vehicle      vehicle      = this[i_LicenseNumber];
            OwnerDetails ownerDetails = r_VehiclesInGarage[vehicle];

            wheelsDetails          = vehicle.GetWheelsDetails();
            engineDetails          = vehicle.GetEngineDetails();
            vehicleSpecificDetails = vehicle.GetSpecificDetails();
            vehicleDetails         = string.Format(
                @"License Number: {0}
Model: {1}
Owner's name: {2}
Owner's phone number: {3}
Status: {4}
The Current Energy Percent is: {5} %
{6}
{7}
{8}",
                vehicle.LicenseNumber,
                vehicle.Model,
                ownerDetails.OwnerName,
                ownerDetails.OwnerPhoneNumber,
                ownerDetails.VehicleStatus.ToString(),
                vehicle.CurrentEnergyPercent.ToString(),
                wheelsDetails,
                engineDetails,
                vehicleSpecificDetails);

            return(vehicleDetails);
        }