示例#1
0
        static public StationClass CreateStationByStationID(int stationID)
        {
            DataTable tbl = StationDBI.GetStationDataTable(stationID);

            if (tbl.Rows.Count > 0)
            {
                return(CreateStation(tbl.Rows[0]));
            }
            return(null);
        }
示例#2
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);
        }
示例#3
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);
        }