コード例 #1
0
ファイル: StationFactory.cs プロジェクト: wwkkww1983/yh
        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
ファイル: StationCollection.cs プロジェクト: wwkkww1983/yh
        /// <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
ファイル: StationFactory.cs プロジェクト: wwkkww1983/yh
        /// <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);
        }