예제 #1
0
        /// <summary>
        /// 绑定树
        /// </summary>
        private void LoadDeptTree()
        {
            if (UCLevel != String.Empty)
            {
                iLevel = SysConvert.ToInt32(UCLevel);
            }
            hasDeptID       = SysString.GetStringToArrayList(UCShowDeptID, ',');
            m_dtbDepartment = OADept.GetDeptInfo(iLevel).DtTable;

            this.tvDeptList.Nodes.Clear();

            DataRow[] l_dtrTopRows = m_dtbDepartment.Select("FloorCode=0");//最顶层

            foreach (DataRow l_dtrDataRow in l_dtrTopRows)
            {
                TreeNode l_objNode = new TreeNode();
                l_objNode = this.SetTreeNode(l_objNode, l_dtrDataRow);

                this.tvDeptList.Nodes.Add(l_objNode);

                DataRow[] l_dtrChildRows = m_dtbDepartment.Select("ParentID=" + l_dtrDataRow["ID"].ToString());
                if (l_dtrChildRows.Length > 0)
                {
                    this.LoadSubDeptTree(l_objNode, l_dtrChildRows);
                }
            }
        }
 /// <summary>
 /// 绑定树
 /// </summary>
 private void BindDBTree()
 {
     if (!string.IsNullOrEmpty(UCLevel))
     {
         iLevel = SysConvert.ToInt32(UCLevel);
     }
     hasDeptID = SysString.GetStringToArrayList(UCShowDeptID, ',');
     dtDept    = OADept.GetDeptInfo(iLevel).DtTable;
     //this.ShowTitle();
     DataRow[] drs = dtDept.Select("FloorCode=0");//最顶层
     tvDB.Nodes.Clear();
     foreach (DataRow dr in drs)
     {
         TreeNode newNode = new TreeNode();
         newNode = SetTreeNode(newNode, dr); //设置节点上显示的东西
         tvDB.Nodes.Add(newNode);
         DataRow[] child = dtDept.Select("ParentID=" + dr["ID"].ToString());
         if (child.Length > 0)
         {
             BindDBTreeSub(newNode, child);
         }
     }
 }