Exemple #1
0
        public static void RetreiveLoanDetailsFromWorkQueueItemDetails(WorkQueueItemDetails workQueueItemDetails, LoanDetailsViewModel loanDetails, UserAccount user, string emptyField)
        {
            if (workQueueItemDetails == null || loanDetails == null || user == null)
            {
                return;
            }

            loanDetails.LoanProgram     = workQueueItemDetails.LoanProgram;
            loanDetails.StreetName      = workQueueItemDetails.StreetName ?? emptyField;
            loanDetails.PropertyAddress = workQueueItemDetails.PropertyAddress ?? emptyField;
            loanDetails.EstimatedValue  = workQueueItemDetails.EstimatedValue != null
                                            ? String.Format(GlobalizationHelper.GetDefaultCulture(),
                                                            StringHelper.CurrencyFormatNoDecimals, workQueueItemDetails.EstimatedValue)
                                            : emptyField;

            loanDetails.PropertyType = workQueueItemDetails.PropertyType != 0
                                        ? LookupServiceFacade.LookupName(( int )workQueueItemDetails.PropertyType, LookupKeywords.PropertyTypeSubjectProperty, user.UserAccountId)
                                        : emptyField;
            loanDetails.OccupancyType = workQueueItemDetails.OccupancyType != 0
                                            ? LookupServiceFacade.LookupName(( int )workQueueItemDetails.OccupancyType,
                                                                             LookupKeywords.OccupancyType, user.UserAccountId)
                                            : emptyField;
            loanDetails.LoanType = workQueueItemDetails.LoanType.GetStringValue();
            loanDetails.Rate     = String.Format(GlobalizationHelper.GetDefaultCulture(), StringHelper.InterestRateFormat,
                                                 workQueueItemDetails.Rate);
            loanDetails.Apr = workQueueItemDetails.Apr != null
                                ? String.Format(GlobalizationHelper.GetDefaultCulture(), StringHelper.InterestRateFormat,
                                                workQueueItemDetails.Apr)
                                : emptyField;

            loanDetails.Points = workQueueItemDetails.Points != null?workQueueItemDetails.Points.ToString() : emptyField;

            loanDetails.LockDate = workQueueItemDetails.LockDate != null?workQueueItemDetails.LockDate.Value.ToString("MM/dd/yyyy") : emptyField;

            loanDetails.LockDays   = workQueueItemDetails.LockDays.ToString();
            loanDetails.LoanAmount =
                workQueueItemDetails.LoanAmount != null
                    ? String.Format(GlobalizationHelper.GetDefaultCulture(), StringHelper.CurrencyFormatNoDecimals, workQueueItemDetails.LoanAmount)
                    : emptyField;

            loanDetails.LoanNumber = !string.IsNullOrEmpty(workQueueItemDetails.LoanNumber) ? workQueueItemDetails.LoanNumber : emptyField;
            loanDetails.Price      = workQueueItemDetails.Price != null?workQueueItemDetails.Price.ToString() : emptyField;

            loanDetails.TotalPriceAdjustment = workQueueItemDetails.TotalPriceAdjustment != null?workQueueItemDetails.TotalPriceAdjustment.ToString() : emptyField;

            loanDetails.MonthlyPayment = workQueueItemDetails.MonthlyPayment != null
                                             ? String.Format(GlobalizationHelper.GetDefaultCulture(),
                                                             StringHelper.CurrencyFormat,
                                                             workQueueItemDetails.MonthlyPayment)
                                             : emptyField;

            loanDetails.NMLSNumber = workQueueItemDetails.ConciergeId.HasValue ? UserAccountServiceFacade.RetrieveNMLSNumber(( int )workQueueItemDetails.ConciergeId) : emptyField;

            string conciergeName = !string.IsNullOrEmpty(workQueueItemDetails.ConciergeFullName) ? workQueueItemDetails.ConciergeFullName : emptyField;

            loanDetails.ConciergeFullName = StringHelper.ReduceTextSize(conciergeName, 10);

            loanDetails.LoanPointsAmount = workQueueItemDetails.LoanPointsAmount.HasValue ?
                                           String.Format(GlobalizationHelper.GetDefaultCulture(), StringHelper.CurrencyFormat, workQueueItemDetails.LoanPointsAmount) : emptyField;

            loanDetails.LoanPointsPercentage = workQueueItemDetails.LoanPointsPercentage.HasValue && workQueueItemDetails.LoanPointsPercentage.Value > 0 ?
                                               String.Format(GlobalizationHelper.GetDefaultCulture(), StringHelper.InterestRateFormat, workQueueItemDetails.LoanPointsPercentage) : emptyField;

            if (workQueueItemDetails.LoanAmount.HasValue && workQueueItemDetails.EstimatedValue.HasValue)
            {
                loanDetails.LTV  = Calculator.Calculator.CalculateLtv(( Decimal )workQueueItemDetails.LoanAmount, workQueueItemDetails.EstimatedValue.Value);
                loanDetails.CLTV = Calculator.Calculator.CalculateCombinedLtv(( Decimal )workQueueItemDetails.LoanAmount, 0, workQueueItemDetails.EstimatedValue.Value);
            }

            loanDetails.IndexType  = workQueueItemDetails.IndexType ?? emptyField;
            loanDetails.IndexValue = workQueueItemDetails.IndexValue;
            loanDetails.Margin     = workQueueItemDetails.Margin;
            loanDetails.RateAdjustmentFirstChangeCapRate   = workQueueItemDetails.RateAdjustmentFirstChangeCapRate;
            loanDetails.RateAdjustmentLifetimeCapPercent   = workQueueItemDetails.RateAdjustmentLifetimeCapPercent;
            loanDetails.RateAdjustmentSubsequentCapPercent = workQueueItemDetails.RateAdjustmentSubsequentCapPercent;
        }