Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            List <CDepartment> Departments = CSQL.GetDepartments();

            SetNodes(treeView1, Departments,
                     CBranch.GetDepartmentsByParentDepartmentID(Departments, "").ToList()[0] as CDepartment);
            treeView1.SelectedNode = treeView1.Nodes[0];
            UpdListEmployee(CSQL.GetEmployeesByDepartmentID(treeView1.SelectedNode.Tag.ToString()), 0);
        }
Esempio n. 2
0
        private void SetNodes(TreeView treeView, List <CDepartment> Departments, CDepartment DepartmentRoot)
        {
            List <CDepartment> SubDepartments = CBranch.GetDepartmentsByParentDepartmentID(Departments, DepartmentRoot.ID).ToList();
            TreeNode           node           = new TreeNode(DepartmentRoot.Name);

            node.Tag = DepartmentRoot.ID;
            treeView.BeginUpdate();
            treeView.Nodes.Add(node);
            FillNode(node, Departments, DepartmentRoot);
            treeView.EndUpdate();
        }
Esempio n. 3
0
        private void FillNode(TreeNode parentNode, List <CDepartment> Departments, CDepartment DepartmentRoot)
        {
            List <CDepartment> SubDepartments = CBranch.GetDepartmentsByParentDepartmentID(Departments, DepartmentRoot.ID).ToList();

            foreach (CDepartment D in SubDepartments)
            {
                TreeNode treeNodeSub = new TreeNode(D.Name);
                treeNodeSub.Tag = D.ID;
                parentNode.Nodes.Add(treeNodeSub);
                FillNode(treeNodeSub, Departments, D);
            }
        }