Exemplo n.º 1
0
        public ISNMPDeviceSettingDTO EditSNMPSetting(string oldID, string ID, string initialIPAndMask, string finalIPAndMask, string SNMPUser)
        {
            ISNMPDeviceSettingDTO setting;

            //Validation
            if (DeviceSettings == null || !DeviceSettings.ContainsKey(oldID))
            {
                return(null);
            }

            //Changing values of reference does not interfere on process targets. They keep the track of objects
            setting = DeviceSettings[oldID];
            setting.EditDeviceSetting(ID, initialIPAndMask, finalIPAndMask, SNMPUser);

            if (oldID != ID)
            {
                DeviceSettings.Remove(oldID);
                DeviceSettings.Add(ID, setting);
            }

            return(setting);
        }
Exemplo n.º 2
0
        public void DeleteSNMPSetting(string ID)
        {
            ISNMPDeviceSettingDTO setting;

            //Validation
            if (DeviceSettings == null || !DeviceSettings.ContainsKey(ID))
            {
                return;
            }

            setting = DeviceSettings[ID];

            //Drop references on process if exists
            if (Processes?.Values != null)
            {
                foreach (ISNMPProcessStrategy process in Processes.Values)
                {
                    process.TargetDeviceSettings.Remove(setting);
                }
            }

            //Drop main container
            DeviceSettings.Remove(ID);
        }