コード例 #1
0
        public static void ProcessPagingOptions(CompletedLoansListState completedLoansListState, CompletedLoansViewModel completedLoansViewModel)
        {
            if (completedLoansViewModel.PageCount % 10 == 0)
            {
                completedLoansViewModel.PageGroups = (completedLoansViewModel.PageCount / 10);
            }
            else
            {
                completedLoansViewModel.PageGroups = (completedLoansViewModel.PageCount / 10) + 1;
            }

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

            completedLoansViewModel.CurrentPage = completedLoansListState.CurrentPage;

            if (completedLoansViewModel.CurrentPage % 10 != 0)
            {
                completedLoansViewModel.StartPage = ( int )(completedLoansViewModel.CurrentPage / 10) * 10 + 1;
                if ((( int )((completedLoansViewModel.CurrentPage) / 10) + 1) == completedLoansViewModel.PageGroups)
                {
                    completedLoansViewModel.EndPage      = ( int )(completedLoansViewModel.CurrentPage / 10) * 10 + completedLoansViewModel.LastPageItems;
                    completedLoansViewModel.LastPageDots = true;
                }
                else
                {
                    completedLoansViewModel.EndPage      = ( int )(completedLoansViewModel.CurrentPage / 10) * 10 + 10;
                    completedLoansViewModel.LastPageDots = false;
                }
            }
            else
            {
                completedLoansViewModel.StartPage = ( int )((completedLoansViewModel.CurrentPage - 1) / 10) * 10 + 1;
                if ((( int )((completedLoansViewModel.CurrentPage - 1) / 10) + 1) == completedLoansViewModel.PageGroups)
                {
                    completedLoansViewModel.EndPage      = ( int )(completedLoansViewModel.CurrentPage / 10) * 10;
                    completedLoansViewModel.LastPageDots = true;
                }
                else
                {
                    completedLoansViewModel.EndPage      = ( int )((completedLoansViewModel.CurrentPage - 1) / 10) * 10 + 10;
                    completedLoansViewModel.LastPageDots = false;
                }
            }
        }
コード例 #2
0
        public static CompletedLoansViewModel RetrieveCompletedLoansViewModel(CompletedLoansListState completedLoansListState, List <int> userAccountIds, int userAccountId, string searchTerm, Guid companyId, int channelId, int divisionId, Guid branchId)
        {
            if (completedLoansListState == null)
            {
                completedLoansListState = new CompletedLoansListState();
            }

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

            string isOnLineUser = completedLoansListState.BorrowerStatusFilter == null ? null :
                                  completedLoansListState.BorrowerStatusFilter == BorrowerStatusType.Offline.GetStringValue() ? "0" : "1";

            CompletedLoansViewData completedLoansViewData = LoanServiceFacade.RetrieveCompletedLoansItemsView(userAccountIds,
                                                                                                              completedLoansListState.CurrentPage,
                                                                                                              completedLoansListState.SortColumn.GetStringValue(),
                                                                                                              completedLoansListState.SortDirection,
                                                                                                              completedLoansListState.BoundDate,
                                                                                                              userAccountId,
                                                                                                              searchTerm,
                                                                                                              isOnLineUser,
                                                                                                              companyId, channelId, divisionId, branchId
                                                                                                              );

            if (completedLoansViewData == null)
            {
                completedLoansViewData = new CompletedLoansViewData {
                    CompletedLoansItems = new List <CompletedLoansViewItem>(), TotalItems = 0, TotalPages = 0
                }
            }
            ;

            for (int i = 0; i < completedLoansViewData.CompletedLoansItems.Count; i++)
            {
                for (int j = 0; j < completedLoansViewData.CompletedLoansItems[i].CompletedLoansViewItems.Count; j++)
                {
                    DataForShortProductDescription data =
                        LoanServiceFacade.RetrieveDataForShortProductDescription(completedLoansViewData.CompletedLoansItems[i].CompletedLoansViewItems[j].LoanId);

                    completedLoansViewData.CompletedLoansItems[i].CompletedLoansViewItems[j].ProgramName = LoanHelper.FormatShortProductDescription(completedLoansViewData.CompletedLoansItems[i].CompletedLoansViewItems[j].IsHarp,
                                                                                                                                                    EnumHelper.GetStringValue((AmortizationType)data.AmortizationType),
                                                                                                                                                    data.LoanTerm,
                                                                                                                                                    data.FixedRateTerm,
                                                                                                                                                    EnumHelper.GetStringValue((MortgageType)data.MortgageType));
                }
            }

            var completedLoansViewModel = new CompletedLoansViewModel
            {
                BorrowerStatusList  = new List <BorrowerStatusType>(Enum.GetValues(typeof(BorrowerStatusType)).Cast <BorrowerStatusType>().Skip(1)),
                ActivityTypeList    = new List <ActivityType>(Enum.GetValues(typeof(ActivityType)).Cast <ActivityType>()),
                CompletedLoansItems = completedLoansViewData.CompletedLoansItems,
                PageCount           = completedLoansViewData.TotalPages,
                TotalItems          = completedLoansViewData.TotalItems
            };

            CompletedLoansGridHelper.ProcessPagingOptions(completedLoansListState, completedLoansViewModel);
            CompletedLoansGridHelper.ApplyClassCollection(completedLoansViewModel);

            return(completedLoansViewModel);
        }
    }