예제 #1
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;

            SiteSettings siteSettings = siteSettingsManager.Get();

            siteSettings.StatScript = GetStatisticsCode();

            siteSettingsManager.Save(siteSettings);
        }
예제 #2
0
        /// <summary>
        /// 获取展示统计页面的连接
        /// </summary>
        /// <returns></returns>
        public string GetCNZZStatisticsPageLink()
        {
            SystemDataService service = new SystemDataService();
            long siteId = service.GetLong("CNZZStatisticsSiteId");
            long password = service.GetLong("CNZZStatisticsPassword");

            SiteSettings siteSettings = siteSettingsManager.Get();

            if (siteId <= 0 || password <= 0)
                return string.Empty;

            return string.Format("http://wss.cnzz.com/user/companion/spacebuilder_login.php?site_id={0}&password={1}", siteId, password);
        }
예제 #3
0
        /// <summary>
        /// 获取统计代码
        /// </summary>
        /// <returns></returns>
        public string GetStatisticsCode()
        {
            SystemDataService service = new SystemDataService();
            long siteId = service.GetLong("CNZZStatisticsSiteId");
            if (siteId > 0)
                return string.Format("<script src='http://pw.cnzz.com/c.php?id={0}&l=2' language='JavaScript' charset='gb2312'></script>", siteId);

            return string.Empty;
        }
예제 #4
0
        /// <summary>
        /// 获取统计账户信息
        /// </summary>
        /// <returns></returns>
        public StatisticsAccount GetAccount()
        {
            SystemDataService systemDataService = new SystemDataService();
            StatisticsAccount account = new StatisticsAccount();
            long siteId = systemDataService.GetLong("CNZZStatisticsSiteId");
            long password = systemDataService.GetLong("CNZZStatisticsPassword");

            if (siteId <= 0 || password <= 0)
                return null;

            account.UserName = siteId.ToString();
            account.Password = password.ToString();
            return account;
        }