Ejemplo n.º 1
0
        /// <summary>
        /// 历史报警信息
        /// </summary>
        /// <param name="historyAlarmInfo"></param>
        /// <returns></returns>
        private AlarmInfo CreateAlarmInfo(HistoryAlarmInfo historyAlarmInfo)
        {
            AlarmInfo alarmInfo = AlarmInfo.Load(historyAlarmInfo.AlarmSource, historyAlarmInfo.AlarmCode, historyAlarmInfo.AlarmDescription
                                                 , Convert.ToDateTime(historyAlarmInfo.AlarmFirstTime), Convert.ToDateTime(historyAlarmInfo.AlarmUpdateTime), Convert.ToDateTime(historyAlarmInfo.AlarmRemoveTime));

            return(alarmInfo);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存报警
        /// </summary>
        /// <param name="alarmInfo"></param>
        public void SaveAlarm(AlarmInfo alarmInfo)
        {
            HistoryAlarmInfo historyAlarmInfo = new HistoryAlarmInfo(alarmInfo);

            if (this.historyAlarmInfos.Count >= HISTORYALARMINFOMAXCOUNT && this.historyAlarmInfos.Count > 0)
            {
                this.historyAlarmInfos.RemoveAt(0);
            }
            this.historyAlarmInfos.Add(historyAlarmInfo);
            this.Save();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 报警信息比较器
 /// </summary>
 /// <param name="cp1"></param>
 /// <param name="cp2"></param>
 /// <returns></returns>
 private int CompareHistoryAlarmInfo(HistoryAlarmInfo leftAlarmInfo, HistoryAlarmInfo rightAlarmInfo)
 {
     return(-leftAlarmInfo.AlarmUpdateTime.CompareTo(rightAlarmInfo.AlarmUpdateTime));
 }