Пример #1
0
        public void BuildTree(TreeInterface treeImplementation)
        {
            // set up a simple configuration that logs on the console.
            XmlConfigurator.Configure();
            // initialize
            treeImplementation.Initialize();

            // check database file
            if (!System.IO.File.Exists(Pic.DAL.ApplicationConfiguration.CustomSection.DatabasePath))
                _log.Error(string.Format("Failed to load database with path {0}", Pic.DAL.ApplicationConfiguration.CustomSection.DatabasePath));
            else
                _log.Info(string.Format("Database found:{0}", Pic.DAL.ApplicationConfiguration.CustomSection.DatabasePath)); 

            // root nodes
            PPDataContext db = new PPDataContext();
            List<TreeNode> rootNodes = TreeNode.GetRootNodes(db);
            if (0 == rootNodes.Count)
            {
                treeImplementation.AskRootNode();
                rootNodes = TreeNode.GetRootNodes(db);
            }
            foreach (TreeNode node in rootNodes)
            {
                Object parentNodeObject = treeImplementation.InsertTreeNode(null, node);
                treeImplementation.InsertDummyNode(parentNodeObject);
            }
    
            db.Dispose();
            // finalize
            treeImplementation.Finish();
        }
        private void InsertChildNodes(PPDataContext db, TreeInterface treeImplementation, object parentNode, TreeNode node)
        {
            // node itself
            Object object1 = treeImplementation.InsertTreeNode(parentNode, node);
            // child nodes
            List <TreeNode> childNodes = node.Childrens(db);

            foreach (TreeNode tn in childNodes)
            {
                InsertChildNodes(db, treeImplementation, object1, tn);
            }
        }
        public void PopulateChildren(TreeInterface treeImplementation, object parentNode, int parentNodeID)
        {
            PPDataContext db           = new PPDataContext();
            TreeNode      parentNodeDB = TreeNode.GetById(db, parentNodeID);

            foreach (TreeNode node in parentNodeDB.Childrens(db))
            {
                if (node.IsDocument)
                {
                    treeImplementation.InsertTreeNode(parentNode, node);
                }
                else
                {
                    Object          object1    = treeImplementation.InsertTreeNode(parentNode, node);
                    List <TreeNode> childNodes = node.Childrens(db);
                    // insert _DUMMY_ node
                    if (childNodes.Count > 0)
                    {
                        treeImplementation.InsertDummyNode(object1);
                    }
                }
            }
        }
        public void BuildTree(TreeInterface treeImplementation)
        {
            // set up a simple configuration that logs on the console.
            XmlConfigurator.Configure();
            // initialize
            treeImplementation.Initialize();

            // check database file
            if (!System.IO.File.Exists(Pic.DAL.ApplicationConfiguration.CustomSection.DatabasePath))
            {
                _log.Error(string.Format("Failed to load database with path {0}", Pic.DAL.ApplicationConfiguration.CustomSection.DatabasePath));
            }
            else
            {
                _log.Info(string.Format("Database found:{0}", Pic.DAL.ApplicationConfiguration.CustomSection.DatabasePath));
            }

            // root nodes
            PPDataContext   db        = new PPDataContext();
            List <TreeNode> rootNodes = TreeNode.GetRootNodes(db);

            if (0 == rootNodes.Count)
            {
                treeImplementation.AskRootNode();
                rootNodes = TreeNode.GetRootNodes(db);
            }
            foreach (TreeNode node in rootNodes)
            {
                Object parentNodeObject = treeImplementation.InsertTreeNode(null, node);
                treeImplementation.InsertDummyNode(parentNodeObject);
            }

            db.Dispose();
            // finalize
            treeImplementation.Finish();
        }
Пример #5
0
        public void PopulateChildren(TreeInterface treeImplementation, object parentNode, int parentNodeID)
        {
            PPDataContext db = new PPDataContext();
            TreeNode parentNodeDB = TreeNode.GetById(db, parentNodeID);

            foreach (TreeNode node in parentNodeDB.Childrens(db))
            {
                if (node.IsDocument)
                   treeImplementation.InsertTreeNode(parentNode, node);
                else
                {
                    Object object1 = treeImplementation.InsertTreeNode(parentNode, node);
                    List<TreeNode> childNodes = node.Childrens(db);
                    // insert _DUMMY_ node
                    if (childNodes.Count > 0)
                        treeImplementation.InsertDummyNode(object1);
                }
            }
        }
Пример #6
0
 private void InsertChildNodes(PPDataContext db, TreeInterface treeImplementation, object parentNode, TreeNode node)
 {
     // node itself
     Object object1 = treeImplementation.InsertTreeNode(parentNode, node);
     // child nodes
     List<TreeNode> childNodes = node.Childrens(db);
     foreach (TreeNode tn in childNodes)
         InsertChildNodes(db, treeImplementation, object1, tn);
 }