public void Execute() { UserAccount user = null; if (_httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name) { user = (UserAccount)_httpContext.Session[SessionHelper.UserData]; } else { user = UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name); } if (user == null) { throw new InvalidOperationException("User is null"); } /* parameter processing */ Int32 contactId = 0; if (InputParameters.ContainsKey("ContactId")) { int.TryParse(InputParameters["ContactId"].ToString(), out contactId); } Guid loanId = Guid.Empty; if (InputParameters.ContainsKey("LoanId")) { Guid.TryParse(InputParameters["LoanId"].ToString(), out loanId); } var tempDetails = LoanServiceFacade.RetrieveWorkQueueItemDetails(loanId, contactId, -1); LoanDetailsViewModel loanDetails = new LoanDetailsViewModel(); string emptyField = "-"; if (tempDetails == null) { tempDetails = new WorkQueueItemDetails(); } else { CommonHelper.RetreiveLoanDetailsFromWorkQueueItemDetails(tempDetails, loanDetails, user, emptyField); } if (loanDetails != null) { _viewName = "_loanpurposeoncontact"; _viewModel = loanDetails; } else { _viewName = string.Empty; _viewModel = null; } }
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; }
public static void RetreiveContactDetailsFromWorkQueueItemDetails(WorkQueueItemDetails workQueueItemDetails, LoanDetailsViewModel loanDetails, UserAccount user, string emptyField) { loanDetails.BorrowerFirstName = !workQueueItemDetails.BorrowerFirstName.IsNullOrEmpty() ? StringHelper.ReduceTextSize(workQueueItemDetails.BorrowerFirstName, 10) : emptyField; loanDetails.BorrowerLastName = !workQueueItemDetails.BorrowerLastName.IsNullOrEmpty() ? StringHelper.ReduceTextSize(workQueueItemDetails.BorrowerLastName, 10) : emptyField; loanDetails.BorrowerMiddleName = !workQueueItemDetails.BorrowerMiddleName.IsNullOrEmpty() ? StringHelper.ReduceTextSize(workQueueItemDetails.BorrowerMiddleName, 10) : emptyField; loanDetails.BorrowerPreferredPhone = !workQueueItemDetails.BorrowerPreferredPhone.IsNullOrEmpty() ? StringHelper.FormatPhoneNumber(workQueueItemDetails.BorrowerPreferredPhone) : emptyField; loanDetails.BorrowerAlternatePhone = !workQueueItemDetails.BorrowerAlternatePhone.IsNullOrEmpty() ? StringHelper.FormatPhoneNumber(workQueueItemDetails.BorrowerAlternatePhone) : emptyField; loanDetails.CoBorrowerFirstName = !workQueueItemDetails.CoBorrowerFirstName.IsNullOrEmpty() ? StringHelper.ReduceTextSize(workQueueItemDetails.CoBorrowerFirstName, 10) : emptyField; loanDetails.CoBorrowerLastName = !workQueueItemDetails.CoBorrowerLastName.IsNullOrEmpty() ? StringHelper.ReduceTextSize(workQueueItemDetails.CoBorrowerLastName, 10) : emptyField; loanDetails.CoBorrowerMiddleName = !workQueueItemDetails.CoBorrowerMiddleName.IsNullOrEmpty() ? StringHelper.ReduceTextSize(workQueueItemDetails.CoBorrowerMiddleName, 10) : emptyField; loanDetails.CoBorrowerPreferredPhone = !workQueueItemDetails.CoBorrowerPreferredPhone.IsNullOrEmpty() ? StringHelper.FormatPhoneNumber(workQueueItemDetails.CoBorrowerPreferredPhone) : emptyField; loanDetails.CoBorrowerAlternatePhone = !workQueueItemDetails.CoBorrowerAlternatePhone.IsNullOrEmpty() ? StringHelper.FormatPhoneNumber(workQueueItemDetails.CoBorrowerAlternatePhone) : emptyField; if (!workQueueItemDetails.BorrowerPreferredPhone.IsNullOrEmpty()) { var borrowerPreferredPhoneNoType = LookupServiceFacade.LookupName(Convert.ToInt32(workQueueItemDetails.BorrowerPreferredPhoneType), LookupKeywords.PhoneType, user.UserAccountId); string borrowerPreferredPhoneType = !string.IsNullOrEmpty(borrowerPreferredPhoneNoType) ? borrowerPreferredPhoneNoType : emptyField; loanDetails.BorrowerPreferredPhoneType = " (" + StringHelper.ReduceTextSize(borrowerPreferredPhoneType, 10) + ") "; } else { loanDetails.BorrowerPreferredPhoneType = emptyField; } if (!workQueueItemDetails.BorrowerAlternatePhone.IsNullOrEmpty()) { var borrowerAlternatePhoneNoType = LookupServiceFacade.LookupName(Convert.ToInt32(workQueueItemDetails.BorrowerAlternatePhoneType), LookupKeywords.PhoneType, user.UserAccountId); string borrowerAlternatePhoneType = !string.IsNullOrEmpty(borrowerAlternatePhoneNoType) ? borrowerAlternatePhoneNoType : emptyField; loanDetails.BorrowerAlternatePhoneType = " (" + StringHelper.ReduceTextSize(borrowerAlternatePhoneType, 10) + ") "; } else { loanDetails.BorrowerAlternatePhoneType = emptyField; } if (!workQueueItemDetails.CoBorrowerPreferredPhone.IsNullOrEmpty()) { var coborrowerPreferredPhoneNoType = LookupServiceFacade.LookupName(Convert.ToInt32(workQueueItemDetails.CoBorrowerPreferredPhoneType), LookupKeywords.PhoneType, user.UserAccountId); string coborrowerPreferredPhoneType = !string.IsNullOrEmpty(coborrowerPreferredPhoneNoType) ? coborrowerPreferredPhoneNoType : emptyField; loanDetails.CoBorrowerPreferredPhoneType = " (" + StringHelper.ReduceTextSize( coborrowerPreferredPhoneType, 10) + ") "; } else { workQueueItemDetails.CoBorrowerPreferredPhoneType = emptyField; } if (!workQueueItemDetails.CoBorrowerAlternatePhone.IsNullOrEmpty()) { var coborrowerAlternatePhoneNoType = LookupServiceFacade.LookupName(Convert.ToInt32(workQueueItemDetails.CoBorrowerAlternatePhoneType), LookupKeywords.PhoneType, user.UserAccountId); string coborrowerAlternatePhoneType = !string.IsNullOrEmpty(coborrowerAlternatePhoneNoType) ? coborrowerAlternatePhoneNoType : emptyField; loanDetails.CoBorrowerAlternatePhoneType = " (" + StringHelper.ReduceTextSize(coborrowerAlternatePhoneType, 10) + ") "; } else { loanDetails.CoBorrowerAlternatePhoneType = emptyField; } loanDetails.BorrowerESignNotSigned = workQueueItemDetails.BorrowerESign == "N"; loanDetails.CoBorrowerESignNotSigned = workQueueItemDetails.CoBorrowerESign == "N"; // Is Borrower online user if (workQueueItemDetails.IsBorrowerOnlineUser.HasValue) { loanDetails.IsBorrowerOnlineUser = workQueueItemDetails.IsBorrowerOnlineUser.Value ? "Online User" : "Offline User"; } else { loanDetails.IsBorrowerOnlineUser = String.Empty; } // Is CoBorrower online user if (workQueueItemDetails.IsCoBorrowerOnlineUser.HasValue) { loanDetails.IsCoBorrowerOnlineUser = workQueueItemDetails.IsCoBorrowerOnlineUser.Value ? "Online User" : "Offline User"; } else { loanDetails.IsCoBorrowerOnlineUser = String.Empty; } }
public void Execute() { UserAccount user = null; if (_httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name) { user = (UserAccount)_httpContext.Session[SessionHelper.UserData]; } else { user = UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name); } if (user == null) { throw new InvalidOperationException("User is null"); } /* parameter processing */ Int32 contactId = 0; if (!InputParameters.ContainsKey("ContactId")) { throw new ArgumentException("ContactId was expected!"); } else { contactId = Convert.ToInt32(InputParameters["ContactId"]); } Guid loanId = Guid.Empty; if (InputParameters.ContainsKey("LoanId")) { Guid.TryParse(InputParameters["LoanId"].ToString(), out loanId); } WorkQueueItemDetails result = LoanServiceFacade.RetrieveWorkQueueItemDetails(loanId, contactId, -1); if (result == null) { result = new WorkQueueItemDetails(); } else { PhoneNumberType borrowerPreferredPhoneType; if (!Enum.TryParse(result.BorrowerPreferredPhoneType, out borrowerPreferredPhoneType)) { borrowerPreferredPhoneType = PhoneNumberType.Home; } PhoneNumberType borrowerAlternatePhoneType; if (!Enum.TryParse(result.BorrowerAlternatePhoneType, out borrowerAlternatePhoneType)) { borrowerAlternatePhoneType = PhoneNumberType.Home; } PhoneNumberType coBorrowerPreferredPhoneType; if (!Enum.TryParse(result.CoBorrowerPreferredPhoneType, out coBorrowerPreferredPhoneType)) { coBorrowerPreferredPhoneType = PhoneNumberType.Home; } PhoneNumberType coBorrowerAlternatePhoneType; if (!Enum.TryParse(result.CoBorrowerAlternatePhoneType, out coBorrowerAlternatePhoneType)) { coBorrowerAlternatePhoneType = PhoneNumberType.Home; } result.BorrowerPreferredPhoneType = borrowerPreferredPhoneType.ToString(); result.BorrowerAlternatePhoneType = borrowerAlternatePhoneType.ToString(); result.CoBorrowerPreferredPhoneType = coBorrowerPreferredPhoneType.ToString(); result.CoBorrowerAlternatePhoneType = coBorrowerAlternatePhoneType.ToString(); } if (result != null) { _viewName = "_contacttooltiponcontact"; _viewModel = result; } else { _viewName = string.Empty; _viewModel = null; } }