Exemple #1
0
        public TagBuilder GetOrganChildrenSubMeun(int organId, string action, Dictionary <string, string> htmlAttributes = null)
        {
            OrganModel item;

            if (organId == 0)
            {
                return(GetOrganSubMeun(action, htmlAttributes));
            }
            else
            {
                item = new OrganBusiness().GetItem(organId);

                TagBuilder root = new TagBuilder("ul");
                root.AddCssClass("dropdown-menu");
                if (htmlAttributes != null)
                {
                    foreach (var attribute in htmlAttributes)
                    {
                        root.Attributes.Add(attribute);
                    }
                }
                if (item != null)
                {
                    var items = new OrganBusiness().GetChildren(organId);
                    if (items.Count() > 0 && item != null)
                    {
                        var children = items.Where(n => n.ParentId == item.ParentId);
                        foreach (var child in children)
                        {
                            root.InnerHtml.AppendHtml(GetOrganNode(child, items, action, htmlAttributes));
                        }
                    }
                }

                return(root);
            }
        }
Exemple #2
0
        public TagBuilder GetOrganSubMeun(string action, Dictionary <string, string> htmlAttributes = null)
        {
            TagBuilder root = new TagBuilder("ul");

            root.AddCssClass("dropdown-menu");
            if (htmlAttributes != null)
            {
                foreach (var attribute in htmlAttributes)
                {
                    root.Attributes.Add(attribute);
                }
            }
            var items = new OrganBusiness().GetAllItems();

            if (items.Count() > 0)
            {
                var children = items.Where(n => n.ParentId == 0);
                foreach (var child in children)
                {
                    root.InnerHtml.AppendHtml(GetOrganNode(child, items, action, htmlAttributes));
                }
            }
            return(root);
        }