Exemplo n.º 1
0
        /// <summary>
        /// 获取文档列表
        /// </summary>
        /// <param name="res_type"></param>
        /// <param name="userId"></param>
        /// <param name="pagecurrent"></param>
        /// <param name="orderBy"></param>
        /// <returns></returns>
        public List <AppendixByLike_Result> getList(string res_type, string like, string userId, string pagecurrent, string orderBy, int pageSize)
        {
            string linkpage  = "";// 分页标签
            int    listcount = 0;
            List <AppendixByLike_Result> resourcelist = null;

            ResourceList rslist = new ResourceList();

            using (JSZX_ResourceEntities db = new JSZX_ResourceEntities())
            {
                listcount = rslist.GetAppendListCount(res_type, like, userId, db);

                // 初期化时当前页是否为空、若为空默认第一页
                if (string.IsNullOrEmpty(pagecurrent))
                {
                    pagecurrent = "1";
                }
                // 分页
                Pages page = new Pages();
                page.subeachnums    = pageSize;               // 每页显示的条目数
                page.subnums        = listcount;              // 总条目数
                page.subcurrentpage = int.Parse(pagecurrent); // 当前被选中的页
                page.subeachpages   = 10;                     // 每次显示的页数
                page.subpagetype    = 2;                      // 分页样式1:普通模式、2:经典模式
                page.subformname    = "ActionForm";           // 表单名
                linkpage            = page.SubPages();        // 生成分页标签

                resourcelist = rslist.GetAppendList(res_type, like, userId, orderBy, page.subeachnums, int.Parse(pagecurrent), db);
            }

            ViewData["pagecurrent"] = pagecurrent; // 当前页
            ViewData["linkpage"]    = linkpage;    // 分页标签

            return(resourcelist);
        }