private void AddDepartmentAndUser(TreeViewNode company, DataTable dt) { BusiDepartMent department = new BusiDepartMent(); foreach (DataRow drDepartment in dt.Rows) { string departmentCode = drDepartment["DEPTCODE"].ToString(); string departmentName = drDepartment["DEPTNAME"].ToString(); TreeViewNode departmentNode = BuildNode(departmentCode, string.Empty, departmentName, false, true); AddUserNode(departmentNode, departmentCode); AddNode(company, departmentNode); } }
private void AddNode(TreeViewNode parent, TreeViewNode child) { if (child != null) { parent.ChildNodes.Add(child); } }
private void AddUserNode(TreeViewNode departmentNode, string departmentCode) { TreeViewOperation treeViewOperation = new TreeViewOperation(); BusiUserService user = new BusiUserService(); DataTable dtUser = user.GetUserByDeptCode(departmentCode); for (int j = 0; j < dtUser.Rows.Count; j++) { string provinceUserCompanyCode = dtUser.Rows[j]["CCODE"].ToString(); string provinceUserId = dtUser.Rows[j]["USERID"].ToString(); string provinceUserName = dtUser.Rows[j]["REALNAME"].ToString(); TreeViewNode userNode = treeViewOperation.BuildNode(Guid.NewGuid().ToString(), provinceUserId, provinceUserName, false, false); userNode.ServerXzdm = CommonHelper.GetSHICode(provinceUserCompanyCode); treeViewOperation.AddNode(departmentNode, userNode); } }