Esempio n. 1
0
        public ISNMPDeviceSettingDTO BuildSNMPSetting(string ID, string initialIPAndMask, string finalIPAndMask, string SNMPUser)
        {
            ISNMPDeviceSettingDTO setting = new SNMPDeviceSettingDTO(ID, initialIPAndMask, finalIPAndMask, SNMPUser, ChangeTrackerHandler);

            DeviceSettings.Add(ID, setting);

            return(setting);
        }
Esempio n. 2
0
        /// <summary>
        /// Reads the XML into the Device Setting List. The Parent node would probably
        /// be a good candidate for recursion but currently have it solved with some well
        /// placed Booleans.
        /// </summary>
        /// <param name="reader">XmlTextReader</param>
        public void ReadXML(XmlTextReader reader)
        {
            EndPoint endPoint = null;

            while (reader.Read())
            {
                string nodeName = reader.Name;
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:     // The node is an element.

                    switch (nodeName)
                    {
                    case "DeviceSettings": _xmlSetting = XML_TYPES.DeviceSettings;
                        break;

                    case "EndPoint": _xmlSetting = XML_TYPES.EndPoint;
                        endPoint = new EndPoint();
                        break;

                    case "ResourceURI": _xmlSetting = XML_TYPES.ResourceUri;
                        break;

                    case "Parent": _xmlSetting = XML_TYPES.Parent;
                        ProcessParent(reader, endPoint.ListParents);
                        break;

                    default: _xmlSetting = XML_TYPES.Unknown;
                        break;
                    }
                    break;

                case XmlNodeType.Text:     //Display the text in each element.

                    string xValue = reader.Value.Trim();

                    switch (_xmlSetting)
                    {
                    case XML_TYPES.EndPoint: endPoint.EndPointName = xValue;
                        break;

                    case XML_TYPES.ResourceUri: endPoint.ResourceURI = xValue;
                        break;
                    }
                    break;

                case XmlNodeType.EndElement:     //Display the end of the element.

                    switch (nodeName)
                    {
                    case "EndPoint": ListDeviceEndPoints.Add(endPoint);
                        endPoint = null;
                        break;
                    }
                    break;
                }
            }
        }
Esempio n. 3
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);
        }