예제 #1
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", "");
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string tempurl = Utils.GetStaticPageNumbersHtml(2, 100, "showforum", ".aspx", 8);


            DbParameter[] prams =
            {
                DbHelper.MakeInParam("@name", DbType.String, 3, "aabbccdd")
            };
            DbHelper.ExecuteNonQuery(CommandType.Text, "INSERT INTO itca_test(name) VALUES (@name)", prams);
            DbDataReader dr = DbHelper.ExecuteReader(CommandType.Text, "SELECT * FROM wy_articles");

            while (dr.Read())
            {
                Response.Write(dr["title"].ToString() + "<br />" + dr["content"].ToString());
            }
            if (Request.QueryString["a"] != null)
            {
                Response.Write(Request.QueryString["a"].ToString());
            }

            TinyCache tc = new TinyCache();

            tc.AddObject("test", "bbbbb");


            Response.Write("TinyCache:" + tc.RetrieveObject("test") as string);



            System.Collections.Generic.SortedList <int, object> list = new System.Collections.Generic.SortedList <int, object>();
            list.Add(1, "协会公告");
            list.Add(2, "协会新闻");
            object aaaa = list[1];
        }
예제 #3
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);
            }
        }
예제 #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);
            }
        }
예제 #5
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);
            }
        }
예제 #6
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);
        }
예제 #7
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);
            }
        }
예제 #8
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);
        }