private Model_Switch _Switch; //连接的交换机 public Model_DataComputer() { _Id = ""; _Name = ""; _PropertyName = "DataComputer"; _DataSourceType = ""; _IpAddress = ""; _NetworkStatus = false; _NodeSoftwareStatus = false; //数据采集软件 _Switch = new Model_Switch(); }
public static List <Service.SystemStatus.Model_Switch> GetSwitchInfo(DataTable myDataCollectionNetInfoTable, int myIndex, string myNodeId, string myOrganizationId) { List <Service.SystemStatus.Model_Switch> m_SubSwitchInfoList = new List <Model_Switch>(); DataRow[] m_DataRow = myDataCollectionNetInfoTable.Select(string.Format("OrganizationID = '{0}' and ParentNodeId = '{1}' and NodeType = '{2}'", myOrganizationId, myNodeId, "Switch")); for (int i = 0; i < m_DataRow.Length; i++) { Service.SystemStatus.Model_Switch m_Switch = new Model_Switch(); m_Switch.Id = myOrganizationId + "_" + m_DataRow[0]["NodeId"].ToString(); m_Switch.Name = m_DataRow[i]["NodeName"].ToString(); m_Switch.DepthIndex = myIndex + 1; m_Switch.Switch = GetSwitchInfo(myDataCollectionNetInfoTable, m_Switch.DepthIndex, m_DataRow[i]["NodeId"].ToString(), myOrganizationId); //查找下级交换机 m_Switch.Collector = GetDeviceInfo(myDataCollectionNetInfoTable, m_Switch.DepthIndex, m_DataRow[i]["NodeId"].ToString(), myOrganizationId); if (m_Switch.Switch != null) { int m_MaxDepthIndex = 0; //找出子节点最深的深度数 int m_CollectorCount = 0; //汇总所有的采集器的数量 for (int j = 0; j < m_Switch.Switch.Count; j++) { if (m_Switch.Switch[j].MaxDepth > m_MaxDepthIndex) { m_MaxDepthIndex = m_Switch.Switch[j].MaxDepth; } m_CollectorCount = m_Switch.Switch[j].CollectorCount + m_CollectorCount; } m_Switch.MaxDepth = m_MaxDepthIndex + 1; m_Switch.CollectorCount = m_Switch.Collector.Count + m_CollectorCount; } else { m_Switch.MaxDepth = 1; m_Switch.CollectorCount = m_Switch.Collector.Count; } m_SubSwitchInfoList.Add(m_Switch); } return(m_SubSwitchInfoList); }