Beispiel #1
0
        /// <summary>
        /// 是否異常
        /// </summary>
        /// <param name="monitor">監控訊息</param>
        /// <param name="target">監控項目資訊</param>
        /// <returns></returns>
        public string IsException(Monitor monitor, Target target)
        {
            var type          = (AlarmOperatorType)Enum.Parse(typeof(AlarmOperatorType), target.OPERATOR_TYPE);
            var alarmOperator = OperatorFactory.CreateInstance(type);
            var conditions    = target.ALARM_CONDITIONS.Select(x => x.TARGET_VALUE).ToList();

            var falseResult = target.IS_EXCEPTION == "Y" ? "N" : "Y";

            return(alarmOperator.Check(monitor.TARGET_VALUE, conditions) ? target.IS_EXCEPTION : falseResult);
        }