示例#1
0
        private bool MatchComponentTypeFailed(CmsEntities cee, OldCmsEntities old, Alarm oldAlarm, out ControlSystemComponentType matchedComponentType)
        {
            matchedComponentType = null;

            var element = (from x in old.Elements.Include("ElementTypical") where x.Id == oldAlarm.ElementId select x).FirstOrDefault();

            if (element == null)
            {
                Logger.Out(string.Format("MatchComponentTypeFailed on Alarm ID {0}:- failed to match 'Element' on ID '{1}'.", oldAlarm.Id, oldAlarm.ElementId));
                return true;
            }

            matchedComponentType = (from x in cee.ControlSystemComponentTypes
                                    where x.Name.Equals(element.ElementTypical.Name, StringComparison.CurrentCultureIgnoreCase)
                                    select x).FirstOrDefault();

            if (matchedComponentType == null)
            {
                Logger.Out(string.Format("MatchComponentTypeFailed on Alarm ID {0}:- failed to match new CMS 'ControlSystemComponentType' on Name '{1}'.", oldAlarm.Id, oldAlarm.AlarmType));
                return true;
            }

            return false;
        }
示例#2
0
        private static bool MatchResponseFailed(List<ControlSystemAlarmResponse> newResponseListNames, Alarm oldAlarm, out ControlSystemAlarmResponse matchResponse)
        {
            matchResponse = null;

            if (oldAlarm.AlarmResponse == null)
            {
                return false;
            }

            matchResponse = (from x in newResponseListNames where x.Name.Equals(oldAlarm.AlarmResponse.Description, StringComparison.CurrentCultureIgnoreCase) select x).FirstOrDefault();
            if (matchResponse == null)
            {
                Logger.Out(string.Format("MatchResponseFailed on Alarm ID {0}:- could not match Alarm Response using Name '{1}'.", oldAlarm.Id, oldAlarm.AlarmResponse.Description));
                return true;
            }
            return false;
        }
示例#3
0
        private static bool MatchTestebByUserFailed(CmsEntities cee, OldCmsEntities old, Alarm oldAlarm, out User matchedTestedUser)
        {
            matchedTestedUser = null;

            if (oldAlarm.TestedUserId.HasValue)
            {
                matchedTestedUser = (from x in cee.Users
                                     where x.Id == oldAlarm.TestedUserId.Value
                                     select x).FirstOrDefault();

                if (matchedTestedUser == null)
                {
                    Logger.Out(string.Format("MatchTestebByUserFailed on Alarm ID {0}:- failed to match 'TestedUserId' in NEW CMS by id '{1}'. ", oldAlarm.Id, oldAlarm.TestedUserId.Value));
                    return true;
                }
            }
            return false;
        }
示例#4
0
 private static bool MatchPriorityNameFailed(List<ControlSystemAlarmPriority> newPriorityListNames, AlarmTable matchedAlarmTable, Alarm oldAlarm, out ControlSystemAlarmPriority matchedPriority)
 {
     matchedPriority = (from x in newPriorityListNames where x.Name.Equals(matchedAlarmTable.AlarmPriority.Priority, StringComparison.CurrentCultureIgnoreCase) select x).FirstOrDefault();
     if (matchedPriority == null)
     {
         //Logger.Out(string.Format("MatchPriorityNameFailed on Alarm ID {0}:- could not match Alarm Priority using name '{1}'. Step 3 in trying to detemine 'Priority' property.", oldAlarm.Id, matchedAlarmTable.AlarmPriority.Priority));
         return true;
     }
     return false;
 }
示例#5
0
        private static bool MatchNewComponentFailed(CmsEntities cee, Alarm oldAlarm, out ControlSystemComponent matchedNewCmsComponent)
        {
            matchedNewCmsComponent = (from x in cee.ControlSystemComponents
                                      where x.Name.Equals(oldAlarm.Element.Name, StringComparison.CurrentCultureIgnoreCase)
                                      select x).FirstOrDefault();

            if (matchedNewCmsComponent == null)
            {
                Logger.Out(string.Format("MatchNewComponentFailed on Alarm ID {0}:- could not match Component.Name = Element.Name '{1}'.", oldAlarm.Id, oldAlarm.Element.Name));
                return true;
            }
            return false;
        }
示例#6
0
        private static bool MatchEngParamFailed(OldCmsEntities old, Alarm oldAlarm, out EngParameter matchedEngParam)
        {
            matchedEngParam = (from x in old.EngParameters where x.ElementId == oldAlarm.ElementId select x).FirstOrDefault();

            if (matchedEngParam == null)
            {
                //Logger.Out(string.Format("MatchEngParamFailed on Alarm ID {0}:- could not match EngParameter using ElementId '{1}'. Step 1 in trying to determine 'Priority' property.", oldAlarm.Id, oldAlarm.ElementId));
                return true;
            }
            return false;
        }
示例#7
0
 private static bool MatchAlarmTableRecordFailed(OldCmsEntities old, Alarm oldAlarm, EngParameter matchedEngParam, out AlarmTable matchedAlarmTable)
 {
     matchedAlarmTable = (from x in old.AlarmTables.Include("AlarmPriority")
                          where x.AlarmTypeId == oldAlarm.AlarmTypeId
                                && x.AlarmLevel == matchedEngParam.AlarmLevel
                          select x).FirstOrDefault();
     if (matchedAlarmTable == null)
     {
         //Logger.Out(string.Format("MatchAlarmTableRecordFailed on Alarm ID {0}:- could not match AlarmTable using AlarmTypeId '{1}' and Alarm Level {2}.  Step 2 in trying to detemine 'Priority' property.", oldAlarm.Id, oldAlarm.ElementId, matchedEngParam.AlarmLevel));
         return true;
     }
     return false;
 }
示例#8
0
        private static bool MatchAlarmPropertyFailed(List<ControlSystemAlarmProperty> alarmProperties, Alarm oldAlarm, out ControlSystemAlarmProperty matchedProperty)
        {
            matchedProperty = (from x in alarmProperties
                               where x.Name.Equals(oldAlarm.AlarmType.Name, StringComparison.CurrentCultureIgnoreCase)
                               select x).FirstOrDefault();

            if (matchedProperty == null)
            {
                Logger.Out(string.Format("MatchAlarmPropertyFailed on Alarm ID {0}:- could not match Alarm Property using Name '{1}'.", oldAlarm.Id, oldAlarm.AlarmType.Name));
                return true;
            }
            return false;
        }