Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DbHelper.ResetDbProvider();
            DbHelper.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Server.MapPath("~/App_Data/db.mdb");
            DbHelper.Dbtype = "Access";
            DataTable dt = DbHelper.ExecuteDataset(CommandType.Text, "SELECT * FROM  i_news").Tables[0];
            gvPreData.DataSource = dt;
            gvPreData.DataBind();

            TinyCache cache = new TinyCache();
            cache.AddObject("dt", dt, 0);
        }
Example #2
0
 protected override void Page_Show()
 {
     int pageid = 1;
     TinyCache cache = new TinyCache();
     mainarticlelist = cache.RetrieveObject("articlelist_indexmain") as List<ArticleInfo>;
     if (mainarticlelist == null)
     {
         mainarticlelist = Articles.GetRecommendArticles(15, 1);
         cache.AddObject("articlelist_indexmain", mainarticlelist, config.Globalcachetimeout);
     }
     TinyCache cache_pagecount = new TinyCache();
     object o_pagecount = cache_pagecount.RetrieveObject("pagecount_articlelist_indexmain");
     if (o_pagecount != null)
     {
         pagecount = Convert.ToInt32(o_pagecount);
     }
     else
     {
         pagecount = Articles.GetRecommendArticleCollectionPageCount(15);
         cache.AddObject("pagecount_articlelist_indexmain", pagecount, config.Globalcachetimeout);
     }
     pagecounthtml = config.Urlrewrite == 1 ? Utils.GetStaticPageNumbersHtml(pageid, pagecount, "showcolumn-recommend", ".aspx", 8) : Utils.GetPageNumbersHtml(pageid, pagecount, "showcolumn.aspx?type=recommend", 8, "pageid", "");
 }
Example #3
0
        /// <summary>
        /// ȡ����Ŀ�б�
        /// </summary>
        /// <returns></returns>
        public static List<ColumnInfo> GetColumnCollection()
        {
            List<ColumnInfo> coll;
            TinyCache cache = new TinyCache();
            coll = cache.RetrieveObject("ColumnList") as List<ColumnInfo>;
            if (coll == null)
            {
                coll = new List<ColumnInfo>();
                IDataReader reader = DatabaseProvider.GetInstance().GetArticleColumnList();

                while (reader.Read())
                {
                    coll.Add(DataReader2ColumnInfo(reader));
                }
                reader.Close();
                cache.AddObject("ColumnList", coll, MainConfigs.GetConfig().Globalcachetimeout);
            }
            return coll;
        }
Example #4
0
 void InitHotArticleList()
 {
     TinyCache cache = new TinyCache();
     hotarticlelist = cache.RetrieveObject("articlelist_hot") as List<ArticleInfo>;
     if (hotarticlelist == null)
     {
         hotarticlelist = Articles.GetHotArticles(6, 1);
         cache.AddObject("articlelist_hot", hotarticlelist, config.Globalcachetimeout);
     }
 }
Example #5
0
        void InitLatestCommentList()
        {
            TinyCache cache = new TinyCache();
            latestcommentlist = cache.RetrieveObject("commentlist_latest") as List<CommentInfo>;
            if (latestcommentlist == null)
            {
#if !DEBUG
                if (Natsuhime.Web.YRequest.GetUrl().IndexOf("92acg.cn") < 0 && Natsuhime.Web.YRequest.GetUrl().IndexOf("litecms.cn") < 0)
                {
                    currentcontext.Response.End();
                }
#endif
                latestcommentlist = Comments.GetCommentCollection(0, 6, 1);
                cache.AddObject("commentlist_latest", latestcommentlist, config.Globalcachetimeout);
            }
        }
Example #6
0
 void InitMostGradeCommentList()
 {
     TinyCache cache = new TinyCache();
     mostgradecommentlist = cache.RetrieveObject("commentlist_mostgrade") as List<CommentInfo>;
     if (mostgradecommentlist == null)
     {
         mostgradecommentlist = Comments.GetMostGradComments(6, 1);
         cache.AddObject("commentlist_mostgrade", mostgradecommentlist, config.Globalcachetimeout);
     }
 }
Example #7
0
        void InitAllColumnArticleListD()
        {
            TinyCache cache = new TinyCache();
            allcolumnarticlelistd = cache.RetrieveObject("articlelistdictionary_allcolumn") as Dictionary<ColumnInfo, List<ArticleInfo>>;
            if (allcolumnarticlelistd == null)
            {
                allcolumnarticlelistd = new Dictionary<ColumnInfo, List<ArticleInfo>>();
                //allcolumnarticlelist = new List<List<ArticleInfo>>();
                List<ColumnInfo> columnlist = Columns.GetColumnCollection();
                foreach (ColumnInfo info in columnlist)
                {

                    if (info.Parentid == 0)
                    {
                        allcolumnarticlelistd.Add(info, Articles.GetArticleCollection(info.Columnid, 6, 1));
                        //allcolumnarticlelist.Add(Articles.GetArticleCollection(info.Columnid, 6, 1));
                    }
                }

                //foreach (KeyValuePair<ColumnInfo, List<ArticleInfo>> b in a)
                //{
                //    System.Diagnostics.Debug.WriteLine(b.Key.Columnname + ":" + b.Value.Count);
                //}
                cache.AddObject("articlelistdictionary_allcolumn", allcolumnarticlelistd, config.Globalcachetimeout);
            }
        }