Exemplo n.º 1
0
        public List <TreeViewModel> BuildTreeHierarchy(SubDirectory root)
        {
            var treeHirarchy = new List <TreeViewModel>();

            if (root == null)
            {
                return(null);
            }

            foreach (var dir in root.SubDirectories)
            {
            }
            return(treeHirarchy);
        }
Exemplo n.º 2
0
        public static TreeViewModel BuildTreeViewModel(SubDirectory root, int showMode)
        {
            if (root == null)
            {
                return(null);
            }
            var treeNode = new TreeViewModel();

            treeNode.Type       = TreeNodeType.DirectoryItem;
            treeNode.Id         = root.Id;
            treeNode.Title      = root.Name;
            treeNode.ImageUrl   = "~/Content/oceania/images/folder.png";
            treeNode.LastUpdate = root.LastUpdate;
            treeNode.SubNodes   = new List <TreeViewModel>();

            foreach (var dir in root.SubDirectories.OrderBy(s => s.Number))
            {
                var dirNode = BuildTreeViewModel(dir, showMode);
                if (dirNode != null)
                {
                    treeNode.SubNodes.Add(dirNode);
                    dirNode.TopNode = treeNode;
                }
            }

            foreach (var article in root.Articles.OrderBy(a => a.Number))
            {
                var articleNode = BuildTreeViewModel(article, showMode);
                if (articleNode != null)
                {
                    treeNode.SubNodes.Add(articleNode);
                    articleNode.TopNode = treeNode;
                }
            }
            return(treeNode);
        }