Beispiel #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);
        }
Beispiel #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="s"></param>
        public void Bind(StationClass s)
        {
            this.txtStationName.Text = s.StationName;
            this.txtDeviceType.Text = s.DeviceCollection[0].DeviceType;

            DeviceClass device = s.DeviceCollection[0];
            BindAlarm(device);
            //AddTestFormula(device);
            BindFormula(device);
            SaveDeviceID(device.DeviceID);
        }
Beispiel #3
0
            public int Compare(object x, object y)
            {
                StationClass s1 = x as StationClass;
                StationClass s2 = y as StationClass;

                if (s1 == null || s2 == null)
                {
                    return(0);
                }

                return(s1.StationOrdinal - s2.StationOrdinal);
            }
Beispiel #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);
        }
Beispiel #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        private static StationClass CreateStation(DataRow row)
        {
            StationClass s = new StationClass();

            s.StationID = Convert.ToInt32(row["StationID"]);
            //s.StationName = row["Name"].ToString();
            s.StationName = GetStationName(row);

            object colorObject = row["Color"];

            if (colorObject != null && colorObject != DBNull.Value)
            {
                string colorString = colorObject.ToString();
                int    argb        = 0;
                bool   r           = int.TryParse(colorString, out argb);
                if (r)
                {
                    System.Drawing.Color color = System.Drawing.Color.FromArgb(argb);
                    s.Color = color;
                }
            }
            return(s);
        }
Beispiel #6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="channelID"></param>
 private StationCollection GetStationList(int channelID)
 {
     StationCollection list = new StationCollection();
     DataTable stationTbl = ChannelDBI.GetStationDataTable(channelID);
     foreach (DataRow row in stationTbl.Rows)
     {
         StationClass sc = new StationClass();
         sc.StationID = Convert.ToInt32(row["StationID"]);
         sc.StationName = row["Name"].ToString();
         //this.StationCollection.Add(sc);
         list.Add(sc);
     }
     return list;
 }
Beispiel #7
0
 /// <summary>
 /// 获取候选站点列表
 /// </summary>
 /// <returns></returns>
 public StationCollection GetCandidateStationList()
 {
     StationCollection list = new StationCollection();
     DataTable tbl =  StationDBI.GetNotAssociateStationDataTable();
     foreach (DataRow row in tbl.Rows)
     {
         int stationID = Convert.ToInt32(row["StationID"]);
         string name = row["Name"].ToString();
         StationClass n = new StationClass();
         n.StationID = stationID;
         n.StationName = name;
         list.Add(n);
     }
     list.Remove(this.StationCollection);
     list.Add(GetDeletedStationCollection());
     return list;
 }
Beispiel #8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        private static StationClass CreateStation(DataRow row)
        {
            StationClass s = new StationClass();
            s.StationID = Convert.ToInt32 (row["StationID"]);
            //s.StationName = row["Name"].ToString();
            s.StationName = GetStationName(row);

            object colorObject = row["Color"];
            if (colorObject != null && colorObject != DBNull.Value)
            {
                string colorString = colorObject.ToString();
                int argb = 0;
                bool r = int.TryParse(colorString, out argb);
                if (r)
                {
                    System.Drawing.Color color = System.Drawing.Color.FromArgb(argb);
                    s.Color = color;
                }
            }
            return s;
        }
Beispiel #9
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 private TreeNode CreateStationTreeNode(StationClass s)
 {
     string stationValue = "s" + s.StationID;
     TreeNode n = new TreeNode(s.StationName);
     n.Value = stationValue;
     return n;
 }