Example #1
0
        public ActionResult Index(int page = 1, int plate = 0)
        {
            List <Topicforum> topicforums = new List <Topicforum>();
            List <Plateforum> plateforums = new List <Plateforum>();

            plateforums         = bllSession.IPlateforumBLL.GetList("").ToList();
            ViewBag.plateforums = plateforums;

            if (!Request.IsAuthenticated)
            {
                log.Info(new LogContent("游客访问了论坛", LogType.记录.ToString(), HttpHelper.GetIPAddress()));
            }
            else
            {
                string userName = CurrentUser.Username;
                log.Info(new LogContent("游客访问了论坛", LogType.记录.ToString(), HttpHelper.GetIPAddress()));
            }
            int totalCount = 0;
            var query      = bllSession.ITopicforumBLL.GetList("");

            if (plate != 0)
            {
                query = bllSession.ITopicforumBLL.GetList("PlateforumId = " + plate);
            }
            PagerHelper.DoPage(ref query, page, 20, ref totalCount);
            foreach (var item in query)
            {
                topicforums.Add(item);
            }
            var plateforumsAsPageList = new StaticPagedList <Topicforum>(topicforums, page, 20, totalCount);

            return(View(plateforumsAsPageList));
        }
Example #2
0
        public ActionResult Index(int page = 1, int State = 3)
        {
            List <Demand>  demands  = new List <Demand>();
            List <vDemand> vdemands = new List <vDemand>();
            string         whereStr = "";

            if (State == 0 || State == 1 || State == 2)
            {
                whereStr = "State=" + State;
            }
            var query       = bllSession.IDemandBLL.GetList(whereStr);
            int state_num_1 = bllSession.IDemandBLL.GetList("State=0").Count();
            int state_num_2 = bllSession.IDemandBLL.GetList("State=1").Count();
            int state_num_3 = bllSession.IDemandBLL.GetList("State=2").Count();
            int totalCount  = 0;

            PagerHelper.DoPage(ref query, page, 20, ref totalCount);
            foreach (var item in query)
            {
                vdemands.Add(new vDemand(item));
            }
            ViewBag.StateNum  = state_num_1 + state_num_2 + state_num_3;
            ViewBag.StateNum1 = state_num_1;
            ViewBag.StateNum2 = state_num_2;
            ViewBag.StateNum3 = state_num_3;
            var demandAsIPagedList = new StaticPagedList <vDemand>(vdemands, page, 20, totalCount);

            return(View(demandAsIPagedList));
        }
Example #3
0
        // GET: Blog
        public ActionResult Index(int page = 1, string Category = "", string Date = "")
        {
            bool            result    = false;
            string          attachUrl = "";
            List <vArticle> articles  = new List <vArticle>();
            string          whereStr  = "";

            if (!string.IsNullOrEmpty(Category))
            {
                attachUrl = "Category = " + Category;
                whereStr  = whereStr + "Category = '" + Category + "'";
            }
            if (!string.IsNullOrEmpty(Date))
            {
                attachUrl = "Date = " + Date;
                whereStr  = whereStr + " DATE_FORMAT(a.Time,'%Y-%m') = '" + Date + "'";
            }
            var query      = bllSession.IArticleBLL.GetList(whereStr);
            int totalCount = 0;

            PagerHelper.DoPage(ref query, page, 5, ref totalCount);
            foreach (var item in query.ToTextFilter(out result))
            {
                articles.Add(new vArticle(item));
            }
            var articleAsIPagedList = new StaticPagedList <vArticle>(articles, page, 5, totalCount);//.ToTextFilter(out result);

            object Categories = CacheHelper.GetCacheValue("ArticleCategories");
            object Calendars  = CacheHelper.GetCacheValue("ArticleCalendars");

            ViewBag.Categories = Categories;
            ViewBag.Calendars  = Calendars;
            ViewBag.AttachUrl  = attachUrl;
            return(View(articleAsIPagedList));
        }