예제 #1
0
        public ActionResult List(string search_h, byte rank_type_h = 2, int row_page_h = 10, int pageNumber = 1, byte search_type_h = 1)
        {
            //List<up_submit_selectList_Result> model = new List<up_submit_selectList_Result>().ToList();
            TB_SUBMIT_LIST  model        = new TB_SUBMIT_LIST();
            ObjectParameter totalRecords = new ObjectParameter("TotalRecords", typeof(int));

            model.submit_list = DB.up_submit_selectList(
                row_page_h,
                pageNumber,
                search_type_h,
                search_h,
                rank_type_h,
                totalRecords).ToList();

            int totalblock = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(totalRecords.Value) / row_page_h));
            int firstpage  = Convert.ToInt32(Math.Ceiling(Convert.ToDouble((pageNumber - 1) / row_page_h) * row_page_h + 1));
            int lastpage   = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(pageNumber) / row_page_h) * row_page_h);

            if (lastpage > totalblock)
            {
                lastpage = totalblock;
            }
            ViewBag.total       = totalRecords.Value;
            ViewBag.lastpage    = lastpage;
            ViewBag.firstpage   = firstpage;
            ViewBag.totalblock  = totalblock;
            ViewBag.nowpage     = pageNumber;
            ViewBag.rowsPerPage = row_page_h;
            ViewBag.search      = search_h;
            ViewBag.searchtype  = search_type_h;
            ViewBag.ranktype    = rank_type_h;


            return(View(model));
        }