示例#1
0
        /// <summary>
        /// 更新皮肤
        /// </summary>
        /// <param name="ownerId">拥有者Id(如:用户Id、群组Id)</param>
        /// <param name="isUseCustomStyle">是否使用自定义皮肤</param>
        /// <param name="themeAppearance">themeKey与appearanceKey用逗号关联</param>
        public void ChangeThemeAppearance(long ownerId, bool isUseCustomStyle, string themeAppearance)
        {
            ISiteSettingsManager siteSettingsManager = DIContainer.Resolve <ISiteSettingsManager>();
            SiteSettings         siteSettings        = siteSettingsManager.Get();
            string themeKey      = null;
            string appearanceKey = null;

            string[] themeAppearanceArray = themeAppearance.Split(',');
            if (themeAppearanceArray.Count() == 2)
            {
                themeKey      = themeAppearanceArray[0];
                appearanceKey = themeAppearanceArray[1];
            }
            else
            {
                PresentArea pa = new PresentAreaService().Get(PresentAreaKeysOfBuiltIn.Channel);
                if (pa != null)
                {
                    themeKey      = pa.DefaultThemeKey;
                    appearanceKey = pa.DefaultAppearanceKey;
                }
            }
            siteSettings.SiteTheme           = themeKey;
            siteSettings.SiteThemeAppearance = appearanceKey;
            siteSettingsManager.Save(siteSettings);
        }
示例#2
0
        /// <summary>
        /// 保存统计帐号
        /// <param name="account">被保存的统计帐号</param>
        /// </summary>
        public void SaveStatisticsAccount(StatisticsAccount account)
        {
            if (account == null || string.IsNullOrEmpty(account.Password) || string.IsNullOrEmpty(account.UserName))
            {
                return;
            }

            SystemDataService systemDataService = new SystemDataService();
            long siteId   = systemDataService.GetLong("CNZZStatisticsSiteId");
            long password = systemDataService.GetLong("CNZZStatisticsPassword");

            long accountSiteId = 0;

            if (!long.TryParse(account.UserName, out accountSiteId))
            {
                return;
            }

            long accountPassword = 0;

            if (!long.TryParse(account.Password, out accountPassword))
            {
                return;
            }

            if (accountSiteId != siteId)
            {
                systemDataService.Change("CNZZStatisticsSiteId", accountSiteId - siteId);
            }
            if (accountPassword != password)
            {
                systemDataService.Change("CNZZStatisticsPassword", accountPassword - password);
            }

            Enable = true;

            ISiteSettingsManager siteSettingsManager = DIContainer.Resolve <ISiteSettingsManager>();
            SiteSettings         siteSettings        = siteSettingsManager.Get();

            siteSettings.StatScript = GetStatisticsCode();

            siteSettingsManager.Save(siteSettings);
        }