private void tvArch_AfterSelect(object sender, TreeViewEventArgs e) { if (tvArch.SelectedNode != null) { BaseTemplateTreeNode tmpNode = (BaseTemplateTreeNode)tvArch.SelectedNode; btnSave.Enabled = (fmState == tmpNode.NodeType); } }
/// <summary> /// 递归装载全部组织结构 /// </summary> /// <param name="key"></param> /// <param name="startNodes"></param> public static void LoadArchitecture(string key, TreeNodeCollection startNodes) { try { if (key == null || key == "") { key = "0"; } // DataTable table = ArchitectureData.GetChildArchitecture(key); DataTable table = RDIFrameworkService.Instance.OrganizeService.GetChildrensById(SystemInfo.UserInfo, key); startNodes.Clear(); foreach (DataRow row in table.Rows) { BaseTemplateTreeNode tmpNode = new BaseTemplateTreeNode(); tmpNode.NodeId = row["ArchitectureId"].ToString(); tmpNode.NodeType = row["TypeName"].ToString(); tmpNode.Text = row["Caption"].ToString(); if (row["TypeName"].ToString() == WorkConst.ARCHITECTURE_ARCH) { tmpNode.ImageIndex = 0; tmpNode.SelectedImageIndex = 0; tmpNode.ForeColor = Color.Black; } else if (row["TypeName"].ToString() == WorkConst.ARCHITECTURE_DUTY) { tmpNode.ImageIndex = 1; tmpNode.SelectedImageIndex = 1; tmpNode.ForeColor = Color.Red; } startNodes.Add(tmpNode); LoadArchitecture(tmpNode.NodeId, tmpNode.Nodes); } } catch (Exception ex) { throw ex; } }