예제 #1
0
        /// <summary>
        /// 关键字检索
        /// </summary>
        /// <param name="af_keyword">关键字</param>
        /// <param name="pagecurrent">跳转页</param>
        /// <param name="orderBy">排序</param>
        /// <returns></returns>
        public ActionResult SearchList(string af_keyword, string fileType, string orderBy, string pagecurrent)
        {
            List <AppendixByLike_Result> list = new List <AppendixByLike_Result>();

            string linkpage = "";// 分页标签

            using (JSZX_ResourceEntities db = new JSZX_ResourceEntities())
            {
                ResourceList relist = new ResourceList();

                // 初期化时当前页是否为空、若为空默认第一页
                if (string.IsNullOrEmpty(pagecurrent))
                {
                    pagecurrent = "1";
                }

                int appSize = relist.GetAppendixSizeByKeyword(af_keyword, fileType, db);

                // 分页
                Pages page = new Pages();
                page.subeachnums    = Constant.FOREGROUND_SEARCH_NUM; // 每页显示的条目数
                page.subnums        = appSize;                        // 总条目数
                page.subcurrentpage = int.Parse(pagecurrent);         // 当前被选中的页
                page.subeachpages   = 10;                             // 每次显示的页数
                page.subpagetype    = 2;                              // 分页样式1:普通模式、2:经典模式
                page.subformname    = "ActionForm";                   // 表单名
                linkpage            = page.SubPages();

                list = relist.GetAppendixListByKeyword(af_keyword, fileType, orderBy, page.subeachnums, Convert.ToInt32(pagecurrent), db);
            }

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

            return(View());
        }