Ejemplo n.º 1
0
        //This creates an empty backend.xml file with
        public static void CreateBackEndXmlFileInRolloutDirectory()
        {
            //Creates the back end XML file that users will access. It is mostly empty except with some basic structure
            //and the current version number is set to 0.
            XmlDocument    doc            = new XmlDocument();
            XmlDeclaration xmlDeclaration = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
            XmlElement     root           = doc.DocumentElement;

            doc.InsertBefore(xmlDeclaration, root);

            XmlElement BackEnd = doc.CreateElement("BackEnd");

            doc.AppendChild(BackEnd);

            XmlElement currentVersionsElement = doc.CreateElement("CurrentVersions");

            foreach (string name in Enum.GetNames(typeof(DTO.Enums.UserTypeEnum)))
            {
                currentVersionsElement.SetAttribute(name, "0");;
            }
            currentVersionsElement.SetAttribute("LatestDate", "");
            BackEnd.AppendChild(currentVersionsElement);

            XmlElement lockoutElement = doc.CreateElement("Lockout");

            lockoutElement.InnerText = false.ToString();
            BackEnd.AppendChild(lockoutElement);

            XmlElement rolloutsElement = doc.CreateElement("RollOuts");

            BackEnd.AppendChild(rolloutsElement);
            string connectionString = GetData.GetCurrentConnectionString(DTO.Enums.BackEndOrFrontEndEnum.BackEnd);

            XmlElement connectionInfoElement = doc.CreateElement("ConnectionInfo");

            connectionInfoElement.SetAttribute("ConnectionString", connectionString);
            connectionInfoElement.SetAttribute("ConnectionDateSet", DateTime.Now.ToString());
            BackEnd.AppendChild(connectionInfoElement);

            SaveXmlDoc.saveBackEndDoc(doc);
        }