public static void ProcessPagingOptions(OrderDeliveredForReviewListState orderDeliveredForReviewListState, OrderDeliveredForReviewViewModel orderDeliveredForReviewViewModel)
        {
            if (orderDeliveredForReviewViewModel.PageCount % 10 == 0)
            {
                orderDeliveredForReviewViewModel.PageGroups = (orderDeliveredForReviewViewModel.PageCount / 10);
            }
            else
            {
                orderDeliveredForReviewViewModel.PageGroups = (orderDeliveredForReviewViewModel.PageCount / 10) + 1;
            }

            orderDeliveredForReviewViewModel.PageGroups = ( int )orderDeliveredForReviewViewModel.PageGroups;
            if (orderDeliveredForReviewViewModel.PageCount % 10 != 0)
            {
                orderDeliveredForReviewViewModel.LastPageItems = orderDeliveredForReviewViewModel.PageCount % 10;
            }
            else
            {
                orderDeliveredForReviewViewModel.LastPageItems = 10;
            }

            orderDeliveredForReviewViewModel.CurrentPage = orderDeliveredForReviewListState.CurrentPage;

            if (orderDeliveredForReviewViewModel.CurrentPage % 10 != 0)
            {
                orderDeliveredForReviewViewModel.StartPage = ( int )(orderDeliveredForReviewViewModel.CurrentPage / 10) * 10 + 1;
                if ((( int )((orderDeliveredForReviewViewModel.CurrentPage) / 10) + 1) == orderDeliveredForReviewViewModel.PageGroups)
                {
                    orderDeliveredForReviewViewModel.EndPage      = ( int )(orderDeliveredForReviewViewModel.CurrentPage / 10) * 10 + orderDeliveredForReviewViewModel.LastPageItems;
                    orderDeliveredForReviewViewModel.LastPageDots = true;
                }
                else
                {
                    orderDeliveredForReviewViewModel.EndPage      = ( int )(orderDeliveredForReviewViewModel.CurrentPage / 10) * 10 + 10;
                    orderDeliveredForReviewViewModel.LastPageDots = false;
                }
            }
            else
            {
                orderDeliveredForReviewViewModel.StartPage = ( int )((orderDeliveredForReviewViewModel.CurrentPage - 1) / 10) * 10 + 1;
                if ((( int )((orderDeliveredForReviewViewModel.CurrentPage - 1) / 10) + 1) == orderDeliveredForReviewViewModel.PageGroups)
                {
                    orderDeliveredForReviewViewModel.EndPage      = ( int )(orderDeliveredForReviewViewModel.CurrentPage / 10) * 10;
                    orderDeliveredForReviewViewModel.LastPageDots = true;
                }
                else
                {
                    orderDeliveredForReviewViewModel.EndPage      = ( int )((orderDeliveredForReviewViewModel.CurrentPage - 1) / 10) * 10 + 10;
                    orderDeliveredForReviewViewModel.LastPageDots = false;
                }
            }
        }
        public static OrderDeliveredForReviewViewModel RetrieveOrderDeliveredForReviewViewModel(OrderDeliveredForReviewListState orderDeliveredForReviewListState, List <int> userAccountIds, int userAccountId, Guid companyId, int channelId, int divisionId, Guid branchId, string searchTerm = null)
        {
            if (orderDeliveredForReviewListState == null)
            {
                orderDeliveredForReviewListState = new OrderDeliveredForReviewListState();
            }

            if (userAccountIds == null)
            {
                userAccountIds = new List <Int32>();
            }

            DeliveredForReviewViewData deliveredForReviewViewData = LoanServiceFacade.RetrieveOrderDeliveredForReviewLoans(userAccountIds,
                                                                                                                           orderDeliveredForReviewListState.CurrentPage,
                                                                                                                           orderDeliveredForReviewListState.SortColumn.GetStringValue(),
                                                                                                                           orderDeliveredForReviewListState.SortDirection,
                                                                                                                           orderDeliveredForReviewListState.BoundDate,
                                                                                                                           orderDeliveredForReviewListState.AppraisalOrderStatus,
                                                                                                                           userAccountId,
                                                                                                                           searchTerm, companyId, channelId, divisionId, branchId);

            if (deliveredForReviewViewData == null)
            {
                deliveredForReviewViewData = new DeliveredForReviewViewData {
                    DeliveredForReviewOrders = new List <DeliveredForReviewView>(), TotalItems = 0, TotalPages = 0
                };
            }

            OrderDeliveredForReviewViewModel orderDeliveredForReviewViewModel = new OrderDeliveredForReviewViewModel
            {
                DeliveredForReviewOrders = deliveredForReviewViewData.DeliveredForReviewOrders,
                PageCount  = deliveredForReviewViewData.TotalPages,
                TotalItems = deliveredForReviewViewData.TotalItems
            };

            OrderDeliveredForReviewGridHelper.ProcessPagingOptions(orderDeliveredForReviewListState, orderDeliveredForReviewViewModel);
            OrderDeliveredForReviewGridHelper.ApplyClassCollection(orderDeliveredForReviewViewModel);

            return(orderDeliveredForReviewViewModel);
        }