Esempio n. 1
0
        /// <summary>
        /// 资讯列表
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult list(string id = "100")
        {
            //记录总数
            int recordCount = 0;

            //页总数
            int pageCount = 0;

            //页大小
            int pageSize = 12;

            //当前页
            int pageIndex = 1;

            if (!string.IsNullOrEmpty(Request["pageindex"]))
            {
                pageIndex = int.Parse(Request["pageindex"]);
            }
            ViewBag.id = id;
            var       bll = new SOSOshop.BLL.Db();
            DataTable key = bll.ExecuteTableForCache("SELECT Name,Description,MeteKey,MeteDescription FROM dbo.yxs_articlechannel where id=" + Library.Lang.Input.Filter(id));

            if (key.Rows.Count > 0)
            {
                ViewBag.Name            = key.Rows[0]["Name"];
                ViewBag.MeteKey         = key.Rows[0]["MeteKey"];
                ViewBag.MeteDescription = key.Rows[0]["MeteDescription"];
            }
            string where = string.Format(" AND Channel LIKE('{0}%')", Library.Lang.Input.Filter(id));
            DataTable dt = bll.GetListByPage("yxs_article", "id,Title,CreateTime", pageSize, pageIndex, " id desc ", where, out recordCount, out pageCount);
            //定义页面
            PagedList <DataRow> pl = new PagedList <DataRow>(dt.Select(), pageIndex, pageSize, recordCount);

            return(View(pl));
        }