示例#1
0
        /// <summary>
        ///
        /// </summary>
        static public StationCollection CreateRainStationCollection()
        {
            StationCollection rainStations     = new StationCollection();
            DataTable         rainStationTable = StationDBI.GetRainStationDataTable();

            return(CreateStationCollection(rainStationTable));
        }
示例#2
0
        static public StationClass CreateStationByStationID(int stationID)
        {
            DataTable tbl = StationDBI.GetStationDataTable(stationID);

            if (tbl.Rows.Count > 0)
            {
                return(CreateStation(tbl.Rows[0]));
            }
            return(null);
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        internal static StationClass CreateStation(int deviceID)
        {
            DataTable tbl = StationDBI.GetStationDataTableByDeviceID(deviceID);

            if (tbl.Rows.Count > 0)
            {
                DataRow row = tbl.Rows[0];
                return(CreateStation(row));
            }
            else
            {
                string err = string.Format("not find station by device id '{0}'", deviceID);
                log.Error(err);
                return(null);
            }
        }
示例#4
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);
        }
示例#5
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);
        }