//查询群组的子组和子用户 private void queryMember(TreeListNode parentNode) { parentNode.Nodes.Clear(); DataSet inBlock = new DataSet(); inBlock.Tables.Add(); inBlock.Tables[0].Columns.Add("groupid"); inBlock.Tables[0].Rows.Add(((List <string>)parentNode.Tag)[1]); //调用SERVICE DataSet outBlock = DbUserInfo.QueryGroupChild(inBlock, CConstString.ConnectName); //返回子组 string groupName = ""; string groupDesc = ""; string groupID = ""; for (int i = 0; i < outBlock.Tables[0].Rows.Count; i++) { groupName = outBlock.Tables[0].Rows[i]["name"].ToString(); groupDesc = outBlock.Tables[0].Rows[i]["groupdescription"].ToString(); groupID = outBlock.Tables[0].Rows[i]["id"].ToString(); TreeListNode treeNode = this.treeListMain.AppendNode(new object[] { groupName + "(" + groupDesc + ")", " " }, parentNode); treeNode.Tag = new List <string>(); ((List <string>)treeNode.Tag).Add(groupName); ((List <string>)treeNode.Tag).Add(groupID); treeNode.SelectImageIndex = treeNode.ImageIndex = GROUPICON; } ////返回子用户 string ename = ""; string cname = ""; string userid = ""; string dept = ""; for (int i = 0; i < outBlock.Tables[1].Rows.Count; i++) { ename = outBlock.Tables[1].Rows[i]["ename"].ToString(); cname = outBlock.Tables[1].Rows[i]["cname"].ToString(); userid = outBlock.Tables[1].Rows[i]["id"].ToString(); TreeListNode treeNode = this.treeListMain.AppendNode(new object[] { ename + "(" + cname + ")", dept }, parentNode); treeNode.Tag = new List <string>(); ((List <string>)treeNode.Tag).Add(ename); ((List <string>)treeNode.Tag).Add(userid); treeNode.SelectImageIndex = treeNode.ImageIndex = USERICON; } }
//查询群组的子组和子用户 private void queryMember(TreeListNode parentNode) { parentNode.Nodes.Clear(); DataSet inBlock = new DataSet(); inBlock.Tables.Add(); inBlock.Tables[0].Columns.Add("groupname"); inBlock.Tables[0].Rows.Add(((List <string>)parentNode.Tag)[0]); //调用SERVICE DataSet outBlock = DbUserInfo.QueryGroupChild(inBlock, CConstString.ConnectName); }
private void treeListGroup_DoubleClick(object sender, EventArgs e) { TreeListNode node = treeListGroup.FocusedNode; if (node == null || node.ImageIndex == USERICON) { return; } node.Nodes.Clear(); treeListGroup.ClearSorting(); DataSet inBlock = new DataSet(); inBlock.Tables.Add(); inBlock.Tables[0].Columns.Add("groupid"); inBlock.Tables[0].Rows.Add(node.GetValue("ID")); //调用SERVICE DataSet outBlock = DbUserInfo.QueryGroupChild(inBlock, CConstString.ConnectName); string groupName = ""; string groupDesc = ""; string groupId = ""; int i = 0; for (i = 0; i < outBlock.Tables[0].Rows.Count; i++) { groupId = outBlock.Tables[0].Rows[i]["id"].ToString(); groupName = outBlock.Tables[0].Rows[i]["name"].ToString(); groupDesc = outBlock.Tables[0].Rows[i]["groupdescription"].ToString(); TreeListNode treeNode; treeNode = this.treeListGroup.AppendNode(new object[3], node, CheckState.Checked); node.Nodes[i].SetValue(0, groupId); node.Nodes[i].SetValue(1, groupName); node.Nodes[i].SetValue(2, groupDesc); treeNode.Tag = groupId; treeNode.ImageIndex = treeNode.SelectImageIndex = GROUPICON; } string ename = ""; string cname = ""; string id = ""; for (int j = 0; j < outBlock.Tables[1].Rows.Count; j++) { id = outBlock.Tables[1].Rows[j]["id"].ToString(); ename = outBlock.Tables[1].Rows[j]["ename"].ToString(); cname = outBlock.Tables[1].Rows[j]["cname"].ToString(); TreeListNode treeNode = this.treeListGroup.AppendNode(new object[3], node, CheckState.Indeterminate); node.Nodes[i + j].SetValue(0, id); node.Nodes[i + j].SetValue(1, ename); node.Nodes[i + j].SetValue(2, cname); treeNode.Tag = id; treeNode.SelectImageIndex = treeNode.ImageIndex = USERICON; } treeListGroup.FocusedNode.ExpandAll(); }