示例#1
0
        public void updateProject_Class_Attribute()
        {
            _mDB = new MongoDBCore();
            var projets = _mDB.getAll <Project>();

            projets[0].NameSpace = "updated";
            var filter = Builders <Project> .Filter.Eq(s => s._id, projets[0]._id);

            var result = _mDB.update(filter, projets[0]);

            Assert.AreEqual(true, result != null);
        }
示例#2
0
        public void addClassToProject()
        {
            _mDB = new MongoDBCore();
            var projets = _mDB.getAll <Project>();

            projets[0].ProjectClasses.Add(new ProjectClass {
                Name = "pussy"
            });
            var filter = Builders <Project> .Filter.Eq(s => s._id, projets[0]._id);

            var result = _mDB.update(filter, projets[0]);

            Assert.AreEqual(true, result != null);
        }
示例#3
0
        private void loadData()
        {
            Cursor.Current = Cursors.WaitCursor;
            List <TreeNode> nodesProjects = new List <TreeNode>();

            MongoDBCore mongoDBCore = new MongoDBCore();

            _ProjectsToTreeView = mongoDBCore.getAll <Project>();

            foreach (var project in _ProjectsToTreeView)
            {
                List <TreeNode> nodesClass = new List <TreeNode>();
                foreach (var projectClass in project.ProjectClasses)
                {
                    List <TreeNode> nodesAttr = new List <TreeNode>();
                    foreach (var attr in projectClass.Attributes)
                    {
                        TreeNode treeNodeAttr = new TreeNode(attr.Name);
                        treeNodeAttr.Tag = $"{attr.ObjectType};{project.NameSpace};{projectClass.Name};{attr.Name}";
                        nodesAttr.Add(treeNodeAttr);
                    }

                    TreeNode treeNodeClass = new TreeNode(projectClass.Name, nodesAttr.ToArray());
                    treeNodeClass.Tag = $"{projectClass.ObjectType};{project.NameSpace};{projectClass.Name}";
                    nodesClass.Add(treeNodeClass);
                }

                TreeNode treeNodeProject = new TreeNode(project.NameSpace, nodesClass.ToArray());
                treeNodeProject.Tag  = $"{project.ObjectType};{project.NameSpace}";
                treeNodeProject.Name = project.NameSpace;
                nodesProjects.Add(treeNodeProject);
            }

            TreeNode treeNodeProjects = new TreeNode("Projects", nodesProjects.ToArray());

            treeNodeProjects.Tag = $"{(int)KDObjectType.ProjectHeader}";
            treeViewProjects.Nodes.Add(treeNodeProjects);
            Cursor.Current = Cursors.Default;
        }