Exemplo n.º 1
0
        public static void ProcessPagingOptions(PreApprovalListState preApprovalListState, PreApprovalViewModel preApprovalViewModel)
        {
            if (preApprovalViewModel.PageCount % 10 == 0)
            {
                preApprovalViewModel.PageGroups = (preApprovalViewModel.PageCount / 10);
            }
            else
            {
                preApprovalViewModel.PageGroups = (preApprovalViewModel.PageCount / 10) + 1;
            }

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

            preApprovalViewModel.CurrentPage = preApprovalListState.CurrentPage;

            if (preApprovalViewModel.CurrentPage % 10 != 0)
            {
                preApprovalViewModel.StartPage = ( int )(preApprovalViewModel.CurrentPage / 10) * 10 + 1;
                if ((( int )((preApprovalViewModel.CurrentPage) / 10) + 1) == preApprovalViewModel.PageGroups)
                {
                    preApprovalViewModel.EndPage      = ( int )(preApprovalViewModel.CurrentPage / 10) * 10 + preApprovalViewModel.LastPageItems;
                    preApprovalViewModel.LastPageDots = true;
                }
                else
                {
                    preApprovalViewModel.EndPage      = ( int )(preApprovalViewModel.CurrentPage / 10) * 10 + 10;
                    preApprovalViewModel.LastPageDots = false;
                }
            }
            else
            {
                preApprovalViewModel.StartPage = ( int )((preApprovalViewModel.CurrentPage - 1) / 10) * 10 + 1;
                if ((( int )((preApprovalViewModel.CurrentPage - 1) / 10) + 1) == preApprovalViewModel.PageGroups)
                {
                    preApprovalViewModel.EndPage      = ( int )(preApprovalViewModel.CurrentPage / 10) * 10;
                    preApprovalViewModel.LastPageDots = true;
                }
                else
                {
                    preApprovalViewModel.EndPage      = ( int )((preApprovalViewModel.CurrentPage - 1) / 10) * 10 + 10;
                    preApprovalViewModel.LastPageDots = false;
                }
            }
        }
Exemplo n.º 2
0
        public static PreApprovalViewModel RetrievePreApprovalViewModel(PreApprovalListState preApprovalListState, List <int> userAccountIds, int userAccountId, string searchTerm, Guid companyId, int channelId, int divisionId, Guid branchId)
        {
            if (preApprovalListState == null)
            {
                preApprovalListState = new PreApprovalListState();
            }

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

            PreApprovalViewData preApprovalViewData = LoanServiceFacade.RetrievePreApprovalItemsView(userAccountIds,
                                                                                                     preApprovalListState.CurrentPage,
                                                                                                     preApprovalListState.SortColumn.GetStringValue(),
                                                                                                     preApprovalListState.SortDirection,
                                                                                                     preApprovalListState.BoundDate,
                                                                                                     userAccountId,
                                                                                                     searchTerm,
                                                                                                     companyId,
                                                                                                     channelId,
                                                                                                     divisionId,
                                                                                                     branchId
                                                                                                     );

            if (preApprovalViewData == null)
            {
                preApprovalViewData = new PreApprovalViewData {
                    PreApprovalViewItem = new List <PreApprovalViewItem>(), TotalItems = 0, TotalPages = 0
                };
            }

            PreApprovalViewModel preApprovalViewModel = new PreApprovalViewModel
            {
                ActivityTypeList = new List <ActivityType>(Enum.GetValues(typeof(ActivityType)).Cast <ActivityType>()),
                PreApprovalItems = preApprovalViewData.PreApprovalViewItem,
                PageCount        = preApprovalViewData.TotalPages,
                TotalItems       = preApprovalViewData.TotalItems
            };

            PreApprovalGridHelper.ProcessPagingOptions(preApprovalListState, preApprovalViewModel);
            PreApprovalGridHelper.ApplyClassCollection(preApprovalViewModel);

            return(preApprovalViewModel);
        }