Esempio n. 1
0
        //This function creates the BackEndSettings.xml file with the passed in RolloutDirectory.
        //This function is only called through the back end installation process.
        public static void CreateBackEndSettingsXMLFile(string rolloutDirectory, string connectionString)
        {
            string      currentDirectory = Directory.GetCurrentDirectory() + "\\";
            XmlDocument doc = new XmlDocument();

            XmlDeclaration xmlDeclaration = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
            XmlElement     root           = doc.DocumentElement;

            doc.InsertBefore(xmlDeclaration, root);

            XmlElement backEndSettings = doc.CreateElement("BackEndSettings");

            doc.AppendChild(backEndSettings);

            XmlElement installedDirectory = doc.CreateElement("InstalledDirectory");

            installedDirectory.AppendChild(doc.CreateTextNode(currentDirectory));
            backEndSettings.AppendChild(installedDirectory);

            XmlElement connectionStringElement = doc.CreateElement("ConnectionString");

            connectionStringElement.AppendChild(doc.CreateTextNode(connectionString));
            backEndSettings.AppendChild(connectionStringElement);

            XmlElement rolloutDirectoryElement = doc.CreateElement("RolloutDirectory");

            rolloutDirectoryElement.AppendChild(doc.CreateTextNode(rolloutDirectory));
            backEndSettings.AppendChild(rolloutDirectoryElement);

            SaveXmlDoc.saveBackEndSettingsDoc(doc);
        }
Esempio n. 2
0
        //This will set the current connection string in the backend.xml file.
        public static void UpdateConnectionString(string newConnectionString)
        {
            var backEndDoc         = GetXmlDoc.GetBackEndXmlDoc(DTO.Enums.BackEndOrFrontEndEnum.BackEnd);
            var backEndSettingsDoc = GetXmlDoc.GetSettingsDoc(DTO.Enums.BackEndOrFrontEndEnum.BackEnd);

            backEndDoc.SelectSingleNode("//ConnectionInfo").Attributes.GetNamedItem("ConnectionString").Value = newConnectionString;
            backEndSettingsDoc.SelectSingleNode("//ConnectionString").InnerText = newConnectionString;
            SaveXmlDoc.saveBackEndDoc(backEndDoc);
            SaveXmlDoc.saveBackEndSettingsDoc(backEndSettingsDoc);
        }