private TreeNode CreateNewTreeNode(string folder, int? parentId, int libraryId, BXCModelEntities context) { var nodeRepo = new TreeNodeRepository(context); var libraryRepo = new LibraryRepository(context); var newNode = new TreeNode { Name = folder, TreeNode1 = parentId == null ? null : nodeRepo.GetByID(parentId.Value), Library = libraryRepo.GetByID(libraryId) }; nodeRepo.AddTreeNode(newNode); return newNode; }
public bool RemoveAllTreeNodesForLibrary(string library, string owner, BXCModelEntities context = null) { context = context ?? new BXCModelEntities(); var nodeRepo = new TreeNodeRepository(context); var treenodes = nodeRepo.GetAllByLibrary(library, owner); foreach (var treenode in treenodes) { nodeRepo.DeleteNode(treenode); } nodeRepo.SaveGroupChanges(); return true; }
public TreeNode GetTreeNode(int value, BXCModelEntities context = null) { context = context ?? new BXCModelEntities(); var nodeRepo = new TreeNodeRepository(context); return nodeRepo.GetByID(value); }
public TreeNode GetTreeNodeForLibary(string folder, int? parentId, int libraryId, BXCModelEntities context = null) { context = context ?? new BXCModelEntities(); var nodeRepo = new TreeNodeRepository(context); return nodeRepo.GetByNameAndParentId(folder, parentId) ?? CreateNewTreeNode(folder, parentId, libraryId, context); }
public TreeNode AddTreeNode(TreeNode nextNode, BXCModelEntities context = null) { context = context ?? new BXCModelEntities(); try { var nodeRepo = new TreeNodeRepository(context); return nodeRepo.AddTreeNode(nextNode); } catch (Exception ex) { Log.Error("CreateNode Failed", ex); return null; } }