Exemplo n.º 1
0
        private bool CheckIfDeletedGroupIsNeverUsed(int recipientsGroupIdentity)
        {
            _logger.Info($"Checking if SMS recipients group can be deleted due to the fact that is never used.");
            AlarmS7Reader reader = new AlarmS7Reader(_realmProvider);

            return(reader.CheckIfRecipientsGroupIsNeverUsed(recipientsGroupIdentity));
        }
Exemplo n.º 2
0
        private void UpdateAlarmsMemoryIfNotComplete(int connectionID)
        {
            //read alarms for specific connection
            AlarmS7Reader            reader            = new AlarmS7Reader(_realmProvider);
            List <S7AlarmDefinition> currentAlarmsList = reader.GetAllActiveAlarmsOfS7plcConnection(connectionID);

            //add alarms read from DB to current alarms list
            try
            {
                _currentAlarmsList.Add(connectionID, currentAlarmsList);
            }
            catch (Exception ex)
            {
                var logger = NLog.LogManager.GetCurrentClassLogger();
                logger.Error($"Error while trying to add current alarm list to dictionary. Error: {ex.Message}.");
            }


            //check if dictionary already has this ConnectionID
            if (!_alarmsData.ContainsKey(connectionID))
            {
                AddAllAlarmsToDictionary(connectionID, currentAlarmsList);
            }
            else
            {
                AddOnlyMissingAlarms(connectionID, currentAlarmsList);
            }
        }
Exemplo n.º 3
0
        private bool CheckIfAlarmProfileIsNeverUsed(int alarmProfileID)
        {
            _logger.Info($"Checking if deleted alarm profile is never used.");
            AlarmS7Reader reader = new AlarmS7Reader(_realmProvider);

            return(reader.CheckIfAlarmProfileIsNeverUsed(alarmProfileID));
        }
Exemplo n.º 4
0
        private void RefreshAlarmCount()
        {
            //create instance of reader
            AlarmS7Reader reader = new AlarmS7Reader(_realmProvider);

            _runtimeData.SetNumberOfDefinedAlarms(reader.GetAmountOfS7AllAlarms());
            NumberOfDefinedAlarms = _runtimeData.NumberOfDefinedAlarms;
        }
Exemplo n.º 5
0
        private string ObtainAlarmProperText(int langID)
        {
            //create instance of alarms reader
            AlarmS7Reader reader = new AlarmS7Reader(_realmProvider);

            //get alarm definition with texts
            AlarmS7UImodel alarmWithTexts = reader.GetSingleAlarmOfS7plcConnectionWithTexts(_alarm.PLCconnectionID, _alarm.Identity);

            //return proper text
            return(GetAlarmProperText(alarmWithTexts, langID));
        }
Exemplo n.º 6
0
        private void GetAlarmsWithTexts()
        {
            AlarmS7Reader reader = new AlarmS7Reader(_realmProvider);

            _plcConnectionIDList = new List <int>();
            foreach (var item in _alarmsIDList)
            {
                _plcConnectionIDList.Add(_plcConnectionID);
            }

            _alarmsData = reader.GetAlarmsOffS7plcConnectionWithTexsts(_plcConnectionIDList, _alarmsIDList);
        }
Exemplo n.º 7
0
        private void ReadFullListOfS7Alarms()
        {
            AlarmS7Reader reader = new AlarmS7Reader(_realmProvider);

            _alarmsForCurrentConnection = reader.GetAllAlarmsOffS7plcConnection(_currentS7PLCconnection.PLCconnectionID);

            if (_alarmsForCurrentConnection.Count() > 0)
            {
                ExportButtonsEnabled = true;
            }
            else
            {
                ExportButtonsEnabled = false;
            }
        }
Exemplo n.º 8
0
        private void GetAlarmsForS7Connection(int connnectionID)
        {
            _logger.Info($"Algorithm of rreading all alarms for St connection with PLC connection ID: {connnectionID}, started.");

            //read values with texts
            AlarmS7Reader reader = new AlarmS7Reader(_realmProvider);

            _originalS7AlarmWithTexts = reader.GetAllAlarmsOffS7plcConnectionWithTexts(connnectionID);

            //assign names of alarm urgency profiles and sms recipients groups
            AssignSMSgroupAndAlarmProfile(ref _originalS7AlarmWithTexts);

            //clear current list
            AlarmsForSelectedS7Connection.Clear();

            //add all alarms to the list view control
            ApplyFIlters();

            //modify amount of alarms
            AlarmsAmount = _originalS7AlarmWithTexts.Count();
        }