public string ToConfig()
        {
            XmlDocument configXml = new XmlDocument();

            configXml.LoadXml(Properties.Resources.SqlDatabaseNotifierDefaultConfig);
            XmlElement root           = configXml.DocumentElement;
            XmlNode    connectionNode = root.SelectSingleNode("connection");

            connectionNode.SetAttributeValue("sqlServer", SqlServer);
            connectionNode.SetAttributeValue("database", Database);
            connectionNode.SetAttributeValue("integratedSec", IntegratedSec.ToString());
            connectionNode.SetAttributeValue("userName", UserName);
            connectionNode.SetAttributeValue("password", Password);
            XmlNode cmndNode = connectionNode.SelectSingleNode("command");

            cmndNode.SetAttributeValue("cmndTimeOut", CmndTimeOut.ToString());
            cmndNode.SetAttributeValue("useSP", UseSP.ToString());
            cmndNode.SetAttributeValue("value", CmndValue);
            cmndNode.SetAttributeValue("alertFieldName", AlertFieldName);
            cmndNode.SetAttributeValue("collectorTypeFieldName", CollectorTypeFieldName);
            cmndNode.SetAttributeValue("categoryFieldName", CategoryFieldName);
            cmndNode.SetAttributeValue("previousStateFieldName", PreviousStateFieldName);
            cmndNode.SetAttributeValue("currentStateFieldName", CurrentStateFieldName);
            cmndNode.SetAttributeValue("detailsFieldName", DetailsFieldName);
            cmndNode.SetAttributeValue("useSPForViewer", UseSPForViewer.ToString());
            cmndNode.SetAttributeValue("viewer", ViewerName);
            cmndNode.SetAttributeValue("dateTimeFieldName", DateTimeFieldName);
            return(configXml.OuterXml);
        }
Beispiel #2
0
        public string ToXml()
        {
            XmlDocument configXml = new XmlDocument();

            configXml.LoadXml(GetDefaultOrEmptyXml());
            XmlElement root           = configXml.DocumentElement;
            XmlNode    connectionNode = root.SelectSingleNode("connection");

            connectionNode.SetAttributeValue("sqlServer", SqlServer);
            connectionNode.SetAttributeValue("database", Database);
            connectionNode.SetAttributeValue("integratedSec", IntegratedSec.ToString());
            connectionNode.SetAttributeValue("userName", UserName);
            connectionNode.SetAttributeValue("password", Password);
            XmlNode cmndNode = connectionNode.SelectSingleNode("command");

            cmndNode.SetAttributeValue("cmndTimeOut", CmndTimeOut.ToString());
            cmndNode.SetAttributeValue("useSP", UseSP.ToString());
            cmndNode.SetAttributeValue("value", CmndValue);
            cmndNode.SetAttributeValue("alertFieldName", AlertFieldName);
            //cmndNode.SetAttributeValue("collectorAgentsDetail", CollectorAgentsDetailFieldName);
            cmndNode.SetAttributeValue("collectorFieldName", CollectorFieldName);
            cmndNode.SetAttributeValue("previousStateFieldName", PreviousStateFieldName);
            cmndNode.SetAttributeValue("currentStateFieldName", CurrentStateFieldName);
            cmndNode.SetAttributeValue("detailsFieldName", DetailsFieldName);
            cmndNode.SetAttributeValue("useSPForViewer", UseSPForViewer.ToString());
            cmndNode.SetAttributeValue("viewer", ViewerName);
            cmndNode.SetAttributeValue("dateTimeFieldName", DateTimeFieldName);
            return(configXml.OuterXml);
        }