Пример #1
0
        internal static LanguageInfo[] List(string path)
        {
            List<LanguageInfo> list = new List<LanguageInfo>();

            XmlDocument doc = new XmlDocument();
            doc.Load(path);

            foreach (XmlNode node in doc.SelectNodes("/dictionaries/dictionary[@name='LANGUAGES']/item"))
            {
                LanguageInfo item = new LanguageInfo();
                item.Load(node);
                list.Add(item);
            }

            return list.ToArray();
        }
Пример #2
0
        internal static LanguageInfo[] List(string path)
        {
            List <LanguageInfo> list = new List <LanguageInfo>();

            XmlDocument doc = new XmlDocument();

            doc.Load(path);

            foreach (XmlNode node in doc.SelectNodes("/dictionaries/dictionary[@name='LANGUAGES']/item"))
            {
                LanguageInfo item = new LanguageInfo();
                item.Load(node);
                list.Add(item);
            }

            return(list.ToArray());
        }
Пример #3
0
        public string CreateCompanyForDatabase(string database, DateTime created, bool isActive, string host, string iisIPAddress, int iisPort, string iisApplicationPool, bool createClientScripts)
        {
            using (SafeXmlDocument serverConfig = new SafeXmlDocument(_serverConfigPath, FileAccess.ReadWrite))
            {
                XmlDocument serverConfigDocument = serverConfig.LoadDocument();

                ValidatePortalsCount(serverConfigDocument);
                ValidateHostName(serverConfigDocument, host, null, true);
                host = host.ToLowerInvariant();

                string defaultLocale;
                try
                {
                    _dbHelper.Database = database;
                    LanguageInfo language = new LanguageInfo();
                    language.Load(_dbHelper);
                    defaultLocale = language.Locale;
                }
                finally
                {
                    _dbHelper.Database = null;
                }

                string port = (iisPort != 80 ? iisPort.ToString(CultureInfo.InvariantCulture) : string.Empty);

                CompanyInfo company;

                using (DBTransaction transaction = _dbHelper.BeginTransaction())
                {
                    // Update database
                    _dbHelper.Database = database;
                    Portal.SetPortalParameterValue(_dbHelper, "system.isactive", isActive.ToString());
                    Portal.SetPortalParameterValue(_dbHelper, "system.scheme", "http");
                    Portal.SetPortalParameterValue(_dbHelper, "system.host", host);
                    Portal.SetPortalParameterValue(_dbHelper, "system.port", port);

                    company = CreateCompanyForDatabase(serverConfigDocument, database, defaultLocale, created, isActive, host, iisIPAddress, iisPort, iisApplicationPool, createClientScripts);

                    transaction.Commit();
                }

                serverConfig.SaveDocument(serverConfigDocument);

                return company.Id;
            }
        }