Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        internal StringBuilder GetCard()
        {
            StringBuilder toDisplay = new StringBuilder();
            Type          type      = GetType();

            toDisplay.Append(type.Name + " :\r\n");

            foreach (FieldInfo f in type.GetFields(BindingFlags.Instance | BindingFlags.NonPublic))
            {
                if (f.FieldType == typeof(Vehicle))
                {
                    toDisplay.Append(m_Vehicle.GetDetails());
                }
                else
                {
                    int    idx        = f.ToString().IndexOf("_");
                    string memberName = f.ToString().Substring(idx + 1);
                    toDisplay.Append("\r\n " + memberName + " = " + f.GetValue(this));
                }
            }

            return(toDisplay);
        }