Esempio n. 1
0
 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;
 }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
 public TreeNode GetTreeNode(int value, BXCModelEntities context = null)
 {
     context = context ?? new BXCModelEntities();
     var nodeRepo = new TreeNodeRepository(context);
     return nodeRepo.GetByID(value);
 }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
        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;
            }
        }