Exemplo n.º 1
0
        private string ExtractTagItems()
        {
            IEnumerable <PropertyInfo> lProperties = CurrenType.GetRuntimeProperties();
            List <object> lItemsList = new List <object>();

            foreach (PropertyInfo lProperty in lProperties)
            {
                IEnumerable <Attribute> lAttributes = lProperty.GetCustomAttributes();
                foreach (Attribute lAttribute in lAttributes)
                {
                    if (lAttribute is HtmlItemsAttribute)
                    {
                        if (IsListOfObject(lProperty.GetValue(CurrentObject)))
                        {
                            lItemsList.Add(lProperty.GetValue(CurrentObject));
                            break;
                        }
                    }
                }
            }
            string lHtml = "";

            foreach (object lItems in lItemsList)
            {
                HtmlStringGenerator lGenerator = new HtmlStringGenerator();
                Array lArray = (Array)lItems.GetType().GetRuntimeMethod("ToArray", new Type[0]).Invoke(lItems, new Type[0]);
                foreach (object lItem in lArray)
                {
                    lHtml += lGenerator.ToHtmlString(lItem);
                }
            }
            return(lHtml);
        }
Exemplo n.º 2
0
 private string ExtractHtmlFromTagedObject(object pObject)
 {
     if (pObject != null)
     {
         HtmlStringGenerator lGenerator = new HtmlStringGenerator();
         return(lGenerator.ToHtmlString(pObject));
     }
     else
     {
         return("");
     }
 }