예제 #1
0
        public ActionResult DCW003Paging(CmnPagingModel cmnPagingModel)
        {
            DCW003ConditionModel         conditionModel     = base.GetCache <DCW003ConditionModel>(CacheKeys.DCW003_CONDITION);
            List <DCW003FuzokuhinMaster> lstFuzokuhinMaster = new List <DCW003FuzokuhinMaster>();
            string typeMsg  = string.Empty;
            string errorMsg = string.Empty;
            int    rowCount = 0;

            conditionModel.PageIndex = cmnPagingModel.PageIndex;
            conditionModel.PageSize  = cmnPagingModel.PageSize;
            conditionModel.PageBegin = cmnPagingModel.PageBegin;
            conditionModel.PageEnd   = cmnPagingModel.PageEnd;

            DCW003DetailModel    detailModel  = new DCW003DetailModel();
            List <DCW003Result>  resultModel  = new List <DCW003Result>();
            List <DCW003Uketori> uketoriModel = new List <DCW003Uketori>();

            using (DCW003Services services = new DCW003Services())
            {
                lstFuzokuhinMaster         = services.DCW003GetFuzokuhinMaster();
                ViewBag.DocFuzokuhinMaster = lstFuzokuhinMaster;

                services.DCW003Search(conditionModel, lstFuzokuhinMaster, out resultModel, out uketoriModel, out rowCount);
            }

            detailModel.ResultModel  = resultModel;
            detailModel.UketoriModel = uketoriModel;
            base.SaveCache(CacheKeys.DCW003_CONDITION, conditionModel);
            InitialDropDownList();
            ViewBag.SearchCondition = conditionModel;
            return(View("_DCW003Result", detailModel));
        }
예제 #2
0
        /// <summary>
        /// Render Paging Control
        /// </summary>
        /// <returns></returns>
        public ActionResult Paging(CmnPagingModel pagingModel)
        {
            //CmnPagingModel pagingModel = this.GetCache<CmnPagingModel>( CacheKeys.GLV_CMN_PAGING );

            var pageIndex = pagingModel.PageIndex;
            var pageSize  = pagingModel.PageSize;
            var totalRow  = pagingModel.TotalRow;
            int pageBegin = pagingModel.PageBegin;
            int pageEnd   = pagingModel.PageEnd;
            int startOffset;
            int endOffset;
            int numberOfPage = this.NumberOfPage(totalRow, pagingModel.PageSize);

            if (pageIndex == 1 || (pageBegin == 0 && pageEnd == 0))
            {
                pageBegin = 1;
                pageEnd   = 5;
            }
            else if ((pageIndex == pageEnd && pageIndex < numberOfPage && numberOfPage < pageEnd + 2))
            {
                pageBegin = pageIndex - 3;
                pageEnd   = pageIndex + 1;
            }
            else if ((pageIndex == pageEnd && pageIndex < numberOfPage) || (pageIndex == pageBegin && pageIndex > 2))
            {
                pageBegin = pageIndex - 2;
                pageEnd   = pageIndex + 2;
            }
            else if ((pageIndex == pageBegin && pageIndex <= 2))
            {
                pageBegin = 1;
                pageEnd   = 5;
            }

            if (numberOfPage <= 5)
            {
                pageBegin = 1;
                pageEnd   = numberOfPage;
            }

            pagingModel.PageBegin = pageBegin;
            pagingModel.PageEnd   = pageEnd;

            startOffset = (pageIndex - 1) * pageSize + 1;

            // check current page is the last page ?
            if (pageIndex != numberOfPage && numberOfPage > 1)
            {
                // case : current page is not the last page
                endOffset = startOffset + pageSize - 1;
            }
            else
            {
                // case : current page is the last page
                endOffset = totalRow;
            }

            ViewBag.PageSize      = pageSize;
            ViewBag.PageIndex     = pageIndex;
            ViewBag.Total         = totalRow;
            ViewBag.NumberOfPage  = numberOfPage;
            ViewBag.PageBegin     = pageBegin;
            ViewBag.PageEnd       = pageEnd;
            ViewBag.SortItem      = pagingModel.SortItem;
            ViewBag.SortDirection = pagingModel.SortDirection;
            ViewBag.StartOffset   = startOffset;
            ViewBag.EndOffset     = endOffset;

            //this.SaveCache( CacheKeys.GLV_CMN_PAGING, pagingModel );

            return(PartialView("_Paging"));
        }