Exemplo n.º 1
0
        /// <summary>
        /// 获取缓存名片配置信息
        /// </summary>
        /// <returns></returns>
        public static List<CardConfigInfo> GetCardConfigCacheList()
        {
            SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
            List<CardConfigInfo> cardconfiglist = cache.RetrieveObject("/SAS/CardConfigList") as List<CardConfigInfo>;

            if (cardconfiglist == null)
            {
                cardconfiglist = SAS.Data.DataProvider.CardConfigs.GetCardConfigList();
                SAS.Cache.ICacheStrategy ica = new SASCacheStrategy();
                ica.TimeOut = 300;
                cache.LoadCacheStrategy(ica);
                cache.AddObject("/SAS/CardConfigList", cardconfiglist);
                cache.LoadDefaultCacheStrategy();
            }
            return cardconfiglist;
        }
Exemplo n.º 2
0
 /// <summary>
 /// 缓存有效活动信息
 /// </summary>
 public static DataTable GetActivitiesCache()
 {
     SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
     string cachekey = CacheKeys.SAS_ACTIVITY;
     DataTable activelist = cache.RetrieveObject(cachekey) as DataTable;
     if (activelist == null)
     {
         activelist = GetEnableActivities();
         SAS.Cache.ICacheStrategy ica = new SASCacheStrategy();
         ica.TimeOut = 1440;
         cache.LoadCacheStrategy(ica);
         cache.AddObject(cachekey, activelist);
         cache.LoadDefaultCacheStrategy();
     }
     return activelist;
 }
Exemplo n.º 3
0
        /// <summary>
        /// 获取帮助信息(缓存)
        /// </summary>
        public static List<HelpInfo> GetAllHelpList()
        {
            SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
            List<HelpInfo> helplist = cache.RetrieveObject("/SAS/helplist") as List<HelpInfo>;

            if (helplist == null || helplist.Count == 0)
            {
                helplist = SAS.Data.DataProvider.Help.GetHelpList();
                SAS.Cache.ICacheStrategy ica = new SASCacheStrategy();
                ica.TimeOut = 1440;
                cache.LoadCacheStrategy(ica);
                cache.AddObject("/SAS/helplist", helplist);
                cache.LoadDefaultCacheStrategy();
            }

            return helplist;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 根据栏目获取资讯信息
        /// </summary>
        public static List<NewsContent> GetNewsByClass(string classid)
        {
            SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
            string cachekey = "SAS_News_" + classid;
            List<NewsContent> newslist = cache.RetrieveObject(cachekey) as List<NewsContent>;

            if (newslist == null)
            {
                newslist = NETCMSPluginProvider.GetInstance().GetNewsList(classid, 8, "id", "desc");
                SAS.Cache.ICacheStrategy ica = new SASCacheStrategy();
                ica.TimeOut = 60;
                cache.LoadCacheStrategy(ica);
                cache.AddObject(cachekey, newslist);
                cache.LoadDefaultCacheStrategy();
            }

            return newslist == null ? new List<NewsContent>() : newslist;
        }
Exemplo n.º 5
0
 /// <summary>
 /// 获取首页活动
 /// </summary>
 public static List<ActivityInfo> GetIndexActivities()
 {
     SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
     string cachekey = "/SAS/IndexAct";
     List<ActivityInfo> activelist = new List<ActivityInfo>();
     activelist = cache.RetrieveObject(cachekey) as List<ActivityInfo>;
     if (activelist == null)
     {
         activelist = Data.DataProvider.Activities.GetActvitiesByType(9, ActivityType.IndexActivity);
         SAS.Cache.ICacheStrategy ica = new SASCacheStrategy();
         ica.TimeOut = 300;
         cache.LoadCacheStrategy(ica);
         cache.AddObject(cachekey, activelist);
         cache.LoadDefaultCacheStrategy();
     }
     return activelist;
 }
Exemplo n.º 6
0
        /// <summary>
        /// 获取商记频道新闻资讯信息
        /// </summary>
        /// <returns></returns>
        public static List<NewsContent> GetShangJiNews()
        {
            SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
            string cachekey = "SAS_ShangjiNews";
            List<NewsContent> newslist = cache.RetrieveObject(cachekey) as List<NewsContent>;

            if (newslist == null)
            {
                newslist = NETCMSPluginProvider.GetInstance().GetNewsList("", 9, "id", "desc");
                List<NewsContent> picnewslist = new List<NewsContent>();
                picnewslist = NETCMSPluginProvider.GetInstance().GetPicNewList("", 1, "id", "desc");

                foreach (NewsContent ninfo in picnewslist)
                {
                    newslist.Insert(0, ninfo);
                }

                SAS.Cache.ICacheStrategy ica = new SASCacheStrategy();
                ica.TimeOut = 60;
                cache.LoadCacheStrategy(ica);
                cache.AddObject(cachekey, newslist);
                cache.LoadDefaultCacheStrategy();
            }

            return newslist == null ? new List<NewsContent>() : newslist;
        }
Exemplo n.º 7
0
 /// <summary>
 /// 获得游客缓存
 /// </summary>
 /// <param name="pagename"></param>
 /// <returns></returns>
 private int GetCachePage(string pagename)
 {
     SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
     SAS.Cache.ICacheStrategy ics = new SASCacheStrategy();
     ics.TimeOut = config.Guestcachepagetimeout;
     cache.LoadCacheStrategy(ics);
     string str = cache.RetrieveObject("/SAS/GuestCachePage/" + pagename) as string;
     cache.LoadDefaultCacheStrategy();
     if (str != null && str.Length > 1)
     {
         System.Web.HttpContext.Current.Response.Write(str);
         System.Web.HttpContext.Current.Response.End();
         return 2;
     }
     return 1;
 }
Exemplo n.º 8
0
 /// <summary>
 /// 获取企业信息统计数量
 /// </summary>
 public static DataTable GetCompanyCount()
 {
     SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
         string cachekey = "/SAS/ENCount";
         DataTable companylist = cache.RetrieveObject(cachekey) as DataTable;
         if (companylist == null || companylist.Rows.Count == 0)
         {
             companylist = SAS.Data.DataProvider.Companies.GetCompanyCountSum();
             SAS.Cache.ICacheStrategy ica = new SASCacheStrategy();
             ica.TimeOut = 30;
             cache.LoadCacheStrategy(ica);
             cache.AddObject(cachekey, companylist);
             cache.LoadDefaultCacheStrategy();
         }
         return companylist;
 }
Exemplo n.º 9
0
 /// <summary>
 /// 根据评分获取企业信息
 /// </summary>
 public static List<Companys> GetScoredCompanyList()
 {
     SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
         string cachekey = "/SAS/ENScored";
         List<Companys> companylist = cache.RetrieveObject(cachekey) as List<Companys>;
         if (companylist == null)
         {
             companylist = SAS.Data.DataProvider.Companies.GetCompanyByScored();
             SAS.Cache.ICacheStrategy ica = new SASCacheStrategy();
             ica.TimeOut = 30;
             cache.LoadCacheStrategy(ica);
             cache.AddObject(cachekey, companylist);
             cache.LoadDefaultCacheStrategy();
         }
         return companylist;
 }
Exemplo n.º 10
0
        /// <summary>
        /// 返回全部版块列表并缓存
        /// </summary>
        /// <returns>板块信息数组</returns>
        public static List<ForumInfo> GetForumList()
        {
            SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
            List<ForumInfo> forumList = cache.RetrieveObject("/SAS/ForumList") as List<ForumInfo>;

            if (forumList == null)
            {
                forumList = SAS.Data.DataProvider.Forums.GetForumList();
                //声明新的缓存策略接口
                SAS.Cache.ICacheStrategy ics = new SASCacheStrategy();
                ics.TimeOut = 5;
                cache.LoadCacheStrategy(ics);
                cache.AddObject("/SAS/ForumList", forumList);
                cache.LoadDefaultCacheStrategy();
            }
            return forumList;
        }
Exemplo n.º 11
0
 /// <summary>
 /// 根据市级信息获取企业信息
 /// </summary>
 /// <param name="cityid"></param>
 /// <returns></returns>
 public static List<Companys> GetCompanyListByCity(int cityid)
 {
     SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
         string cachekey = CacheKeys.SAS_COMPANY_INDEX_CITY + cityid;
         List<Companys> companylist = cache.RetrieveObject(cachekey) as List<Companys>;
         if (companylist == null)
         {
             companylist = GetCompanyListWithCity(cityid, 4);
             SAS.Cache.ICacheStrategy ica = new SASCacheStrategy();
             ica.TimeOut = 300;
             cache.LoadCacheStrategy(ica);
             cache.AddObject(cachekey, companylist);
             cache.LoadDefaultCacheStrategy();
         }
         return companylist;
 }
Exemplo n.º 12
0
 /// <summary>
 /// 获得企业墙企业
 /// </summary>
 /// <returns></returns>
 public static List<Companys> GetCompanyListWall()
 {
     SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
         string cachekey = "ZSWall_Company";
         List<Companys> companylist = cache.RetrieveObject(cachekey) as List<Companys>;
         if (companylist == null)
         {
             companylist = SAS.Data.DataProvider.Companies.GetCompanyListByOrder(40, "en_credits", true);
             SAS.Cache.ICacheStrategy ica = new SASCacheStrategy();
             ica.TimeOut = 1440;
             cache.LoadCacheStrategy(ica);
             cache.AddObject(cachekey, companylist);
             cache.LoadDefaultCacheStrategy();
         }
         return companylist;
 }
Exemplo n.º 13
0
 /// <summary>
 /// 根据信誉度排序,并返回信息列表
 /// </summary>
 /// <returns></returns>
 public static List<Companys> GetCompanyListCredits()
 {
     SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
         string cachekey = CacheKeys.SAS_COMPANY_INDEX_CREDITS;
         List<Companys> companylist = cache.RetrieveObject(cachekey) as List<Companys>;
         if (companylist == null)
         {
             companylist = SAS.Data.DataProvider.Companies.GetCompanyListByOrder(10, "en_credits", true);
             SAS.Cache.ICacheStrategy ica = new SASCacheStrategy();
             ica.TimeOut = 300;
             cache.LoadCacheStrategy(ica);
             cache.AddObject(cachekey, companylist);
             cache.LoadDefaultCacheStrategy();
         }
         return companylist;
 }
Exemplo n.º 14
0
 /// <summary>
 /// 根据企业类型获取企业信息
 /// </summary>
 /// <param name="ete">企业类型</param>
 /// <returns></returns>
 public static List<Companys> GetCompanyListByType(EnTypeEnum ete)
 {
     SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
         string cachekey = CacheKeys.SAS_COMPANY_INDEX_ENTYPE + Convert.ToInt16(ete);
         List<Companys> companylist = cache.RetrieveObject(cachekey) as List<Companys>;
         if (companylist == null)
         {
             companylist = new List<Companys>();
             List<Companys> tempcompanylist = SAS.Data.DataProvider.Companies.GetCompanyListByType(Convert.ToInt16(ete), 10);
             foreach (Companys compinfo in tempcompanylist)
             {
                 if (compinfo.En_cataloglist.Length > 0)
                 {
                     compinfo.TempCatalogID = TypeConverter.StrToInt(compinfo.En_cataloglist.Split(',')[0]);
                     CatalogInfo _catalog = Catalogs.GetCatalogCacheInfo(compinfo.TempCatalogID);
                     if (_catalog != null) compinfo.CatalogName = _catalog.name;
                 }
                 companylist.Add(compinfo);
             }
             SAS.Cache.ICacheStrategy ica = new SASCacheStrategy();
             ica.TimeOut = 300;
             cache.LoadCacheStrategy(ica);
             cache.AddObject(cachekey, companylist);
             cache.LoadDefaultCacheStrategy();
         }
         return companylist;
 }
Exemplo n.º 15
0
 /// <summary>
 /// 根据行业ID获取Table型企业信息集合(缓存)
 /// </summary>
 /// <param name="catalogid"></param>
 /// <returns></returns>
 public static DataTable GetCompanyTableListByCatalog(int catalogid)
 {
     SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
         string cachekey = CacheKeys.SAS_COMPANY_Table_SUB + catalogid;
         DataTable companylist = cache.RetrieveObject(cachekey) as DataTable;
         if (companylist == null)
         {
             companylist = SAS.Data.DataProvider.Companies.GetCompanyListByCatalog(catalogid);
             SAS.Cache.ICacheStrategy ica = new SASCacheStrategy();
             ica.TimeOut = 1440;
             cache.LoadCacheStrategy(ica);
             cache.AddObject(cachekey, companylist);
             cache.LoadDefaultCacheStrategy();
         }
         return companylist;
 }
Exemplo n.º 16
0
        /// <summary>
        /// OnUnload事件处理
        /// </summary>
        /// <param name="e"></param>
        protected override void OnUnload(EventArgs e)
        {
            if (isguestcachepage == 1)
            {
                switch (pagename)
                {
                    case "index.aspx":
                        SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
                        SAS.Cache.ICacheStrategy ics = new SASCacheStrategy();
                        ics.TimeOut = config.Guestcachepagetimeout;
                        cache.LoadCacheStrategy(ics);
                        string str = cache.RetrieveObject("/SAS/GuestCachePage/" + pagename) as string;
                        if (str == null && templateBuilder.Length > 1 && templateid == config.Templateid)
                        {
                            templateBuilder.Append("\r\n\r\n<!-- Sirius studio CachedPage (Created: " + Utils.GetDateTime() + ") -->");
                            cache.AddObject("/SAS/GuestCachePage/" + pagename, templateBuilder.ToString());
                        }
                        cache.LoadDefaultCacheStrategy();

                        break;

                    case "showtopic.aspx":
                        int topicid = SASRequest.GetQueryInt("topicid", 0);
                        int pageid = SASRequest.GetQueryInt("page", 1);
                        if (pageid == 1 && SASRequest.GetParamCount() == 2 && topicid > 0 && templateid == config.Templateid)
                        {
                            templateBuilder.Append("\r\n\r\n<!-- Discuz!NT CachedPage (Created: " + Utils.GetDateTime() + ") -->");
                            LogicUtils.CreateTopicCacheFile(topicid, templateBuilder.ToString());
                        }
                        break;
                    default:
                        //
                        break;
                }
            }
            #if DEBUG
            else
            {
                System.Web.HttpContext.Current.Response.Clear();
                System.Web.HttpContext.Current.Response.Write(templateBuilder.Replace("</body>", "<div>注意: 以下为数据查询分析工具,正式站点使用请使用官方发布版本或自行Release编译。</div>" + querydetail + "</body>").ToString());
                System.Web.HttpContext.Current.Response.End();
            }
            #endif
            base.OnUnload(e);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 首页公告
        /// </summary>
        /// <param name="nums"></param>
        /// <returns></returns>
        public static List<AnnouncementInfo> GetAnnouncementIndex()
        {
            SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
            List<AnnouncementInfo> dt = cache.RetrieveObject("/SAS/AnnouncementIndex") as List<AnnouncementInfo>;

            if (dt == null)
            {
                dt = Data.DataProvider.Announcements.GetAnnouncementIndex(9);
                SAS.Cache.ICacheStrategy ica = new SASCacheStrategy();
                ica.TimeOut = 30;
                cache.LoadCacheStrategy(ica);
                cache.AddObject("/SAS/AnnouncementIndex", dt);
                cache.LoadDefaultCacheStrategy();
            }
            return dt;
        }
Exemplo n.º 18
0
 /// <summary>
 /// 黄页根据市级信息、行业类别获取企业信息
 /// </summary>
 public static List<Companys> GetCompanyListByCityAndCatalog(int cityid, int cid, int nums)
 {
     SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
         string cachekey = "/SAS/HYCompanylist/City_" + cityid + "_Catalog_" + cid;
         List<Companys> companylist = cache.RetrieveObject(cachekey) as List<Companys>;
         if (companylist == null)
         {
             companylist = GetCompanyListByCatalogWithCity(cityid, cid, nums);
             SAS.Cache.ICacheStrategy ica = new SASCacheStrategy();
             ica.TimeOut = 1440;
             cache.LoadCacheStrategy(ica);
             cache.AddObject(cachekey, companylist);
             cache.LoadDefaultCacheStrategy();
         }
         return companylist;
 }