예제 #1
0
        public static void ProcessPagingOptions(OrderRequestedListState orderRequestedListState, OrderRequestedViewModel orderRequestedViewModel)
        {
            if (orderRequestedViewModel.PageCount % 10 == 0)
            {
                orderRequestedViewModel.PageGroups = (orderRequestedViewModel.PageCount / 10);
            }
            else
            {
                orderRequestedViewModel.PageGroups = (orderRequestedViewModel.PageCount / 10) + 1;
            }

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

            orderRequestedViewModel.CurrentPage = orderRequestedListState.CurrentPage;

            if (orderRequestedViewModel.CurrentPage % 10 != 0)
            {
                orderRequestedViewModel.StartPage = ( int )(orderRequestedViewModel.CurrentPage / 10) * 10 + 1;
                if ((( int )((orderRequestedViewModel.CurrentPage) / 10) + 1) == orderRequestedViewModel.PageGroups)
                {
                    orderRequestedViewModel.EndPage      = ( int )(orderRequestedViewModel.CurrentPage / 10) * 10 + orderRequestedViewModel.LastPageItems;
                    orderRequestedViewModel.LastPageDots = true;
                }
                else
                {
                    orderRequestedViewModel.EndPage      = ( int )(orderRequestedViewModel.CurrentPage / 10) * 10 + 10;
                    orderRequestedViewModel.LastPageDots = false;
                }
            }
            else
            {
                orderRequestedViewModel.StartPage = ( int )((orderRequestedViewModel.CurrentPage - 1) / 10) * 10 + 1;
                if ((( int )((orderRequestedViewModel.CurrentPage - 1) / 10) + 1) == orderRequestedViewModel.PageGroups)
                {
                    orderRequestedViewModel.EndPage      = ( int )(orderRequestedViewModel.CurrentPage / 10) * 10;
                    orderRequestedViewModel.LastPageDots = true;
                }
                else
                {
                    orderRequestedViewModel.EndPage      = ( int )((orderRequestedViewModel.CurrentPage - 1) / 10) * 10 + 10;
                    orderRequestedViewModel.LastPageDots = false;
                }
            }
        }
예제 #2
0
        public static OrderRequestedViewModel RetrieveOrderRequestedViewModel(OrderRequestedListState orderRequestedListState, List <int> userAccountIds, int userAccountId, Guid companyId, int channelId, int divisionId, Guid branchId, string searchTerm = null)
        {
            if (orderRequestedListState == null)
            {
                orderRequestedListState = new OrderRequestedListState();
            }

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

            OrderRequestedViewData orderRequestedViewData = LoanServiceFacade.RetrieveOrderRequestedLoans(userAccountIds,
                                                                                                          orderRequestedListState.CurrentPage,
                                                                                                          orderRequestedListState.SortColumn.GetStringValue(),
                                                                                                          orderRequestedListState.SortDirection,
                                                                                                          orderRequestedListState.BoundDate,
                                                                                                          orderRequestedListState.OrderType,
                                                                                                          orderRequestedListState.NonConforming,
                                                                                                          orderRequestedListState.Rush,
                                                                                                          orderRequestedListState.LoanPurposeFilter,
                                                                                                          orderRequestedListState.NonConformingFilter,
                                                                                                          orderRequestedListState.RushFilter,
                                                                                                          userAccountId,
                                                                                                          searchTerm,
                                                                                                          companyId, channelId, divisionId, branchId);

            if (orderRequestedViewData == null)
            {
                orderRequestedViewData = new OrderRequestedViewData {
                    RequestedOrders = new List <RequestedOrdersView>(), TotalItems = 0, TotalPages = 0
                };
            }

            OrderRequestedViewModel orderRequestedViewModel = new OrderRequestedViewModel
            {
                RequestedOrders = orderRequestedViewData.RequestedOrders,
                PageCount       = orderRequestedViewData.TotalPages,
                LoanPurposeList = new List <LoanTransactionType>(Enum.GetValues(typeof(LoanTransactionType)).Cast <LoanTransactionType>().Skip(1)),
                TotalItems      = orderRequestedViewData.TotalItems
            };

            OrderRequestedGridHelper.ProcessPagingOptions(orderRequestedListState, orderRequestedViewModel);
            OrderRequestedGridHelper.ApplyClassCollection(orderRequestedViewModel);

            return(orderRequestedViewModel);
        }