Пример #1
0
        /// <summary>
        /// Gets the categories> from leaf to root
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="skipSelf">if set to <c>true</c> [skip self].</param>
        /// <param name="allowRootDocument">if set to <c>true</c> [allow root document].</param>
        /// <returns></returns>
        public static List <reportDocument> GetCategories(this reportDocument document, Boolean skipSelf = true, Boolean allowRootDocument = true)
        {
            reportDocument head = document.GetCategory(skipSelf, allowRootDocument);

            List <reportDocument> output = new List <reportDocument>();

            while (head != null)
            {
                output.Add(head);
                var new_head = head.GetCategory(true, allowRootDocument);
                if (new_head == head)
                {
                    break;
                }
                head = new_head;
            }
            return(output);
        }
Пример #2
0
        public static String GetCategoryPath(this reportDocument document, Boolean skipSelf = true, Boolean allowRootDocument = true)
        {
            List <reportDocument> categories = document.GetCategories(skipSelf, allowRootDocument);

            String output = "";

            foreach (var cat in categories)
            {
                if (output == "")
                {
                    output = cat.Title;
                }
                else
                {
                    output = cat.Title + Path.DirectorySeparatorChar + output;
                }
            }

            return(output);
        }
Пример #3
0
        public void TakeContent(reportDocument document = null)
        {
            if (document == null)
            {
                document = report;
            }

            var builder = GetBuilder(document);

            if (document.content.isNullOrEmpty())
            {
                document.content = builder.GetContent();
            }
            else
            {
            }

            foreach (reportDocument doc in document.Children)
            {
                TakeContent(doc);
            }
        }
Пример #4
0
        /// <summary>
        /// Gets the category.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="skipSelf">in case <c>document</c> is a category, if set to <c>true</c> it will not include it into consideration</param>
        /// <param name="allowRootDocument">if set to <c>true</c> [allow root document].</param>
        /// <returns></returns>
        public static reportDocument GetCategory(this reportDocument document, Boolean skipSelf = true, Boolean allowRootDocument = true)
        {
            reportDocument head = document;

            if (document.PostType == reportDocumentType.category)
            {
                if (skipSelf)
                {
                    head = head.parent;
                }
            }

            while (true)
            {
                if (head == null)
                {
                    break;
                }
                if (head.PostType == reportDocumentType.category)
                {
                    return(head);
                }
                if (head.parent == null)
                {
                    if (allowRootDocument)
                    {
                        return(head);
                    }
                    else
                    {
                        return(null);
                    }
                }
                head = head.parent;
            }

            return(null);
        }
Пример #5
0
        //public static void TakeContent(this IReportDocument document)
        //{

        //    base.TakeContent();

        //    foreach (reportDocument doc in posts)
        //    {
        //        doc.TakeContent();
        //    }
        //}
        public static reportDocument AddChild(this IReportDocument parent, reportDocumentType postType, String title, ITextRender logger = null, String _bid = "")
        {
            reportDocument output = new reportDocument(postType)
            {
                Title = title,
                BID   = _bid.or(parent.BID),
            };

            if (parent is reportDocument parentReportDocument)
            {
                output.parent = parentReportDocument;
                if (logger != null)
                {
                    logger.AppendLine("New [" + postType.ToString() + "] [" + title + "] created under [" + parentReportDocument.Title + "]");
                }
            }


            parent.Children.Add(output);



            return(output);
        }