public string GetFolderDetails() { StringBuilder folderDetails = new StringBuilder(); folderDetails.AppendFormat("Vehicle type: {0}{1}", m_Vehicle.GetType().Name, Environment.NewLine); folderDetails.AppendFormat("Owner name: {0}{1}", m_VehicleOwnerName, Environment.NewLine); folderDetails.AppendFormat("Owner phone number: {0}{1}", m_PhoneNumber.ToString(), Environment.NewLine); folderDetails.AppendFormat("Vehicle status: {0}{1}", m_VehicleStatus.ToString(), Environment.NewLine); folderDetails.AppendFormat("{0}", m_Vehicle.GetDetails()); return(folderDetails.ToString()); }
public override string ToString() { StringBuilder garageToString = new StringBuilder(); garageToString.Append(string.Format( @"Name of owner : {0} Number of owner : {1} Status in garage : {2}", m_OwnerName, m_OwnerNumber, m_Status)); m_Vehicle.GetType().GetMethod("ToString").Invoke(m_Vehicle, null); garageToString.Append(m_Vehicle.ToString()); return(garageToString.ToString()); }
private string CreateDescriptionOfVehicle(Vehicle i_Vehicle) { StringBuilder vehiclesDescription = new StringBuilder(); PropertyInfo[] vehicleProperties = i_Vehicle.GetType().GetProperties(BindingFlags.Instance | BindingFlags.GetProperty | BindingFlags.Public); foreach (PropertyInfo property in vehicleProperties) { if (property.CanRead && property.GetValue(i_Vehicle, null) != null) { vehiclesDescription.Append(string.Format("{0}: {1}{2}", property.Name, property.GetValue(i_Vehicle, null), Environment.NewLine)); } } return(vehiclesDescription.ToString()); }
public string GetVehicleData(string i_LicenseNumber) { Vehicle vehicle = getVehicle(i_LicenseNumber); return(string.Format("type: {0}, \n {1}", vehicle.GetType().Name, vehicle.ToString())); }