예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        /// <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);
        }
예제 #4
0
        /// <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);
        }