예제 #1
0
        /// <summary>
        /// 获取列表页面的页数
        /// </summary>
        /// <param name="id"></param>
        protected void GetClassPageCount(int id)
        {
            Class c = ClassView.GetModelByID(id.ToS());
            TemplateList t = TemplateListView.Find(string.Format("SysModel={0}", c.ModelID.ToS()));

            int pagecount = 0;
            switch (c.ModelID)
            {
                case 1:
                    //新闻
                    pagecount = NewsView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                case 2:
                    //图片
                    pagecount = ImageAlbumView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                case 3:
                    //问答
                    pagecount = QuestionView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                case 4:
                    //小说
                    pagecount = BookView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                case 5:
                    //分类
                    pagecount = InfoView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                case 6:
                    //影视
                    pagecount = MovieInfoView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                default:
                    pagecount = 0;
                    break;
            }

            Response.Clear();
            Response.Write(pagecount);
        }