Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        private static DeviceAlarm Create(DataRow row)
        {
            DeviceAlarm a = new DeviceAlarm();

            a.DeviceID = Convert.ToInt32(row["DeviceID"]);
            object highObject = row["HighLimit"];

            if (highObject == DBNull.Value)
            {
                a.HasHighLimit = false;
            }
            else
            {
                a.HasHighLimit = true;
                a.HighLimit    = Convert.ToInt32(highObject);
            }

            object lowObject = row["LowLimit"];

            if (lowObject == DBNull.Value)
            {
                a.HasLowLimit = false;
            }
            else
            {
                a.HasLowLimit = true;
                a.LowLimit    = Convert.ToInt32(lowObject);
            }
            return(a);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="deviceid"></param>
        /// <returns></returns>
        static public DeviceAlarm Create(int deviceid)
        {
            DeviceAlarm a   = null;
            DataTable   tbl = DeviceAlarmDBI.GetDataTable(deviceid);

            if (tbl.Rows.Count > 0)
            {
                DataRow row = tbl.Rows[0];
                a = Create(row);
            }
            else
            {
                a              = new DeviceAlarm();
                a.DeviceID     = deviceid;
                a.HasLowLimit  = false;
                a.HasHighLimit = false;
            }

            return(a);
        }