Exemple #1
0
        public static bool HasSubCondition(this IDataServer dserver, string sourceName, SubAlarmType alarmType)
        {
            IAlarmServer server = dserver as IAlarmServer;

            if (server == null)
            {
                return(false);
            }
            var conds = server.QueryConditions(sourceName);

            if (conds == null)
            {
                return(false);
            }
            foreach (ICondition cond in conds)
            {
                var subs = cond.SubConditions;
                if (subs != null && subs.Count > 0)
                {
                    foreach (var sub in subs)
                    {
                        if (sub.SubAlarmType == alarmType)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Exemple #2
0
        public static SubCondition FindSubConditon(this IAlarmServer server, string sourceName, SubAlarmType alarmType)
        {
            var conds = server.QueryConditions(sourceName);

            if (conds == null)
            {
                return(SubCondition.Empty);
            }
            foreach (ICondition cond in conds)
            {
                SubCondition sub = cond.FindSubConditon(alarmType);
                if (sub.SubAlarmType == alarmType)
                {
                    return(sub);
                }
            }
            return(SubCondition.Empty);
        }