public void GetDepartments(DataTable pDT) { depDT = pDT.Copy(); foreach (DataRow feDR in depDT.Rows) { mcDepartment tmD = new mcDepartment(feDR); depDic.Add(tmD.Key.ToString(), tmD); } }
public void GetDepartments(DataTable pDT) { TreeNode rootTN = new TreeNode(); foreach (DataRow feDR in pDT.Rows) { mcDepartment tmD = new mcDepartment(feDR); TreeNode tTN = new TreeNode(tmD.Name); string dParent = tmD.DirParent; string sKey = tmD.Key.ToString(); TNDic.Add(sKey, tTN); tTN.Tag = sKey; if (tmD.DirParent == string.Empty) { rootTN = tTN; } else { TNDic[dParent].Nodes.Add(tTN); } } tvDep.Nodes.Add(rootTN); tvDep.ExpandAll(); }