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 IActionResult LoanDetails(string id) { var book = _bookRepository.GetBookByIdent(id); if (book == null) { return(NotFound()); } var loanViewModel = new LoanDetailsViewModel() { LocalBook = book }; return(View(loanViewModel)); }
public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var loan = Service.Find <Loan>(id); if (loan == null) { return(View()); } var viewModel = new LoanDetailsViewModel(loan) { Customer = UnitOfWork.Context.Set <Customer>().Find(loan.CustomerId), CanBeClosed = Service.CanLoanBeClosed(loan) }; return(View(viewModel)); }
public ActionResult Details(Guid?id) { if (id == null) { return(RedirectToAction("Index")); } var loan = Service.Find <Loan>(id); if (loan == null) { if (User.IsInRole("Customer")) { return(RedirectToAction("Index")); } if (User.IsInRole("Department head")) { //!!here is better Redirect to INDEX(with all neaded parametrs) return(RedirectToAction("All")); } //Старую проверка ещё вписал -> if (loan == null || loan.CustomerId != User.Identity.GetUserId()) } else if (User.IsInRole("Customer") && loan.CustomerId != User.Identity.GetUserId()) { return(RedirectToAction("Index")); } else { var viewModel = new LoanDetailsViewModel(loan) { Customer = UnitOfWork.Context.Set <Customer>().Find(loan.CustomerId) }; ViewBag.AdditionalSum = InterestCalculator.CalculateInterestForCustomerInformation(loan, Service.GetCurrentDate()); return(View(viewModel)); } return(null); }
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 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 async Task <Tuple <bool, string, LoanDetailsViewModel> > DownloadDocument(LoanDetailsViewModel loanDetailsViewModel) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); Tuple <bool, string, LoanDetailsViewModel> resultView = null; try { resultView = await _repoLoans.DownloadDocument(loanDetailsViewModel); } catch (Exception ex) { ErrorLog.Write(ex); } return(resultView); }
private LoanDetailsViewModel GetLoanDetails(Guid loanId, int prospectId, UserAccount user, bool collapseSection) { var tempDetails = LoanServiceFacade.RetrieveWorkQueueItemDetails(loanId, prospectId, -1); LoanDetailsViewModel loanDetails = new LoanDetailsViewModel(); string emptyField = "-"; if (tempDetails != null) { CommonHelper.RetreiveContactDetailsFromWorkQueueItemDetails(tempDetails, loanDetails, user, emptyField); CommonHelper.RetreiveLoanDetailsFromWorkQueueItemDetails(tempDetails, loanDetails, user, emptyField); } loanDetails.TitleInformation = ConciergeWorkQueueServiceFacade.ExecuteSPGetBorrowerData("GetBorrowerData", loanId, user.UserAccountId); // var leadSourceInformation = ContactServiceFacade.RetrieveLeadSourceByContactIdAndLoanId( prospectId, loanId, user.UserAccountId ); //if ( leadSourceInformation != null ) // loanDetails.LeadSourceInformation = leadSourceInformation.LeadSourceId + " " + leadSourceInformation.Description; LeadSource hearAboutUs = LoanServiceFacade.RetrieveHearAboutUs(loanId); if (hearAboutUs != null) { if (hearAboutUs.AffinityGroup == Contracts.Affiliate.AffinityGroup.PartnersProfiles) { if (hearAboutUs.HBMId != null && hearAboutUs.HBMId != Guid.Empty) { loanDetails.HearAboutUs = hearAboutUs.LeadSourceId + " Realtor-HBM"; } else { loanDetails.HearAboutUs = hearAboutUs.LeadSourceId + " Realtor"; } } else { loanDetails.HearAboutUs = hearAboutUs.LeadSourceId + " " + hearAboutUs.Description; } } //List<BusinessContact> contacts = BusinessContactServiceFacade.RetrieveBusinessContacts( loanId ); List <BusinessContact> contacts = BusinessContactServiceFacade.RetrieveBusinessContactsAppraisal(loanId); loanDetails.Contacts = GetDisplayInformation(contacts); loanDetails.LoanId = loanId; loanDetails.CollapseDetails = collapseSection; _httpContext.Session[SessionHelper.CurrentLoanIdForBusinessContact] = loanId; if (loanDetails.Contacts.FirstOrDefault(x => x.BusinessContactCategory == BusinessContactCategory.BuyerAgent) != null) { _httpContext.Session[SessionHelper.CurrentBusinessContactBuyerAgent] = loanDetails.Contacts.FirstOrDefault(x => x.BusinessContactCategory == BusinessContactCategory.BuyerAgent).CompanyName; } else { _httpContext.Session[SessionHelper.CurrentBusinessContactBuyerAgent] = String.Empty; } if (loanDetails.Contacts.FirstOrDefault(x => x.BusinessContactCategory == BusinessContactCategory.SellerAgent) != null) { _httpContext.Session[SessionHelper.CurrentBusinessContactSellerAgent] = loanDetails.Contacts.FirstOrDefault(x => x.BusinessContactCategory == BusinessContactCategory.SellerAgent).CompanyName; } else { _httpContext.Session[SessionHelper.CurrentBusinessContactSellerAgent] = String.Empty; } Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("contactType", "-1"); parameters.Add("activeInactive", "null"); parameters.Add("searchString", "Search"); parameters.Add("currentPage", "1"); parameters.Add("pageSize", "10"); parameters.Add("requestMultiplePages", "null"); parameters.Add("getNextPages", "null"); parameters.Add("hasChildren", "null"); parameters.Add("loanId", loanId.ToString()); loanDetails.LoanCompaniesAndContactsModel = ContactHelper.GetLoanCompaniesAndContacts(HttpContext, parameters); return(loanDetails); }
public async Task <IActionResult> CreateLoan(LoanDetailsViewModel model) { await _mediator.Send(new CreateLoanCommand { Amount = model.Amount, Duration = model.Duration, AccountId = model.AccountId }); return(RedirectToAction("Loans")); }
public async Task <IActionResult> Loans() { LoanDetailsViewModel model = await _mediator.Send(new GetLoanDetailsQuery()); return(View(model)); }