/// <summary> /// /// </summary> /// <param name="tbl"></param> /// <returns></returns> static private StationCollection CreateStationCollection(DataTable tbl) { StationCollection stations = new StationCollection(); foreach (DataRow row in tbl.Rows) { StationClass s = CreateStation(row); stations.Add(s); } return(stations); }
/// <summary> /// 获取某些类型的设备的站点的集合 /// </summary> /// <param name="deviceTypes"></param> /// <returns></returns> public StationCollection GetStationCollection(params string[] deviceTypes) { StationCollection t = new StationCollection(); foreach (StationClass s in this) { if (s.DeviceCollection.Include(deviceTypes)) { t.Add(s); } } return(t); }
/// <summary> /// /// </summary> /// <param name="stationID"></param> public void AddByStationID(int stationID) { DataTable tbl = StationDBI.GetStationDataTable(stationID); StationCollection stations = new StationCollection(); foreach (DataRow r in tbl.Rows) { string n = r["Name"].ToString(); int id = Convert.ToInt32(r["StationID"]); StationClass newStation = new StationClass(); newStation.StationName = n; newStation.StationID = id; stations.Add(newStation); } this.Add(stations); }
/// <summary> /// /// </summary> /// <returns></returns> static public StationCollection CreateStationCollection(int channelID) { StationCollection stations = new StationCollection(); DataTable channelStationMapTbl = ChannelStationMapDBI.GetChannelStationMapDataTable(channelID); //int[] stationIDs = ChannelStationMapDBI.GetStationIDs(channelID); int[] stationIDs = DataTableHelper.GetIDs(channelStationMapTbl, "stationid"); DataTable tbl = StationDBI.GetStationDataTable(stationIDs); foreach (DataRow row in tbl.Rows) { StationClass c = CreateStation(row); c.StationOrdinal = GetStationOrdinal(channelStationMapTbl, c.StationID); stations.Add(c); } stations.SortByStationOrdinal(); return(stations); }