private List <dtoNodeItem> CreateItemsNodes(dtoNodeItem father, dtoDisplayRepositoryItem item, List <ItemType> types, List <FolderType> folderTypes, dtoDisplayRepositoryItem currentFolder, RepositoryType type, Int32 idCommunity = -1, Boolean onlyAvailable = true, Boolean alsoTagChildren = false, Boolean removeDeleted = true) { List <dtoNodeItem> results = new List <dtoNodeItem>(); dtoNodeItem cNode = CreateItemNode(father, item, currentFolder, type, idCommunity); dtoNodeItem openNode = CreateOpenNode(cNode, item.Children.Any()); results.Add(openNode); results.Add(cNode); if (item.Children.Any(c => IsItemAvailable(c, types, onlyAvailable, folderTypes, removeDeleted))) { results.Add(new dtoNodeItem() { Type = NodeType.OpenChildren }); item.Children.Where(c => IsItemAvailable(c, types, onlyAvailable, folderTypes, removeDeleted)).ToList().ForEach(n => results.AddRange(CreateItemsNodes(openNode, n, types, folderTypes, currentFolder, type, idCommunity, onlyAvailable, alsoTagChildren, removeDeleted))); results.Add(new dtoNodeItem() { Type = NodeType.CloseChildren }); } else { results.Add(new dtoNodeItem() { Type = NodeType.NoChildren }); } results.Add(new dtoNodeItem() { Type = NodeType.CloseNode }); return(results); }
private dtoNodeItem CreateOpenNode(dtoNodeItem owner, Boolean hasChildren) { dtoNodeItem node = new dtoNodeItem() { Type = NodeType.OpenItemNode }; node.Id = owner.Id; node.IdCommunity = owner.IdCommunity; node.IdFolder = owner.IdFolder; node.FolderType = owner.FolderType; node.IsCurrent = owner.IsCurrent; node.IsEmpty = !hasChildren; node.HasCurrent = owner.HasCurrent; node.Selectable = owner.Selectable; node.IdentifierPath = owner.IdentifierPath; return(node); }
private dtoNodeItem CreateItemNode(dtoNodeItem father, dtoDisplayRepositoryItem item, dtoDisplayRepositoryItem currentFolder, RepositoryType type, Int32 idCommunity = -1) { dtoNodeItem node = new dtoNodeItem() { Type = NodeType.Item, IsCurrent = (currentFolder != null && currentFolder.Id == item.Id && currentFolder.FolderType == item.FolderType && currentFolder.IdentifierPath == item.IdentifierPath) }; node.Id = item.Id; node.IdFolder = item.IdFolder; node.FolderType = item.FolderType; node.IdCommunity = item.IdCommunity; node.ItemType = item.Type; node.Name = item.DisplayName; node.IdentifierPath = item.IdentifierPath; if (father != null) { node.Fathers.Add(father); node.Fathers.AddRange(father.Fathers); } node.HasCurrent = (currentFolder != null && (currentFolder.GetIdFathers().Where(f => f > 0).Contains(item.Id) || item.ContainsFolder(currentFolder.Id, currentFolder.FolderType, currentFolder.IdentifierPath))); switch (item.Type) { case ItemType.Folder: switch (item.FolderType) { case Domain.FolderType.standard: node.TemplateNavigateUrl = RootObject.FolderUrlTemplate(item.Id, item.FolderType, type, idCommunity); break; default: node.TemplateNavigateUrl = RootObject.FolderUrlTemplate(item.Id, item.FolderType, item.IdentifierPath, type, idCommunity); break; } break; } return(node); }