public ActionResult CreateCoverLetter(string LoanId, string DocumentClassId, string UserAccountId) { String message = "Failure"; Guid loanId; if (Guid.TryParse(LoanId, out loanId)) { DocumentClass documentClass = DocumentClassId == "ReDisclosures" ? DocumentClass.ReDisclosuresMailingCoverLetter : DocumentClass.InitialDisclosuresMailingCoverLetter; if (!DocumentsServiceFacade.MailRoomCoverLetterExists(loanId, documentClass)) { var mailRoomCoverLetter = new MailRoomCoverLetter() { LoanId = loanId, DocumentClass = documentClass, //UserAccountId = userAccountId }; var response = LoanServiceFacade.MailingRoomCoverLetter(mailRoomCoverLetter); message = response != null && response.Saved ? "Success" : "Failure"; } } JsonResult jsonData = Json(new { Succes = message }, JsonRequestBehavior.AllowGet); return(jsonData); }
public static void PopulateComboBoxes(ManageFeesViewModel model) { var file = DocumentsServiceFacade.GetLatestFileByLoanIdAndDocumentClass(model.TitleAndEscrow.LoanId, DocumentClass.SmartGFEComplianceCertificate, model.TitleAndEscrow.UserAccountId); if (file != null && file.FileStoreItemId != Guid.Empty) { model.TitleAndEscrow.SmartGfeDocumentLink = HttpUtility.UrlEncode(EncryptionHelper.EncryptRijndael(file.FileStoreItemId.ToString(), EncriptionKeys.Default)); if (!model.TitleAndEscrow.SmartGFEEnabled.HasValue) { model.TitleAndEscrow.SmartGFEEnabled = model.TitleAndEscrow.SmartGFEEnabledOriginalValue = true; } } model.TitleAndEscrow.ListPaidBy = new List <string>(); var ddlValues = LookupServiceFacade.Lookup(LookupKeywords.CostPaidBy, model.TitleAndEscrow.UserAccountId); foreach (var c in ddlValues) { model.TitleAndEscrow.ListPaidBy.Add(c.StringValue); } model.TitleAndEscrow.ListPaidTo = new List <string>(); ddlValues = LookupServiceFacade.Lookup(LookupKeywords.CostPaidTo, model.TitleAndEscrow.UserAccountId); foreach (var c in ddlValues) { model.TitleAndEscrow.ListPaidTo.Add(c.StringValue); } model.TitleAndEscrow.ListWhen = new List <string>(); ddlValues = LookupServiceFacade.Lookup(LookupKeywords.CostPaidWhen, model.TitleAndEscrow.UserAccountId); foreach (var c in ddlValues) { model.TitleAndEscrow.ListWhen.Add(c.StringValue); } }
public JsonResult GetDefaultPendingApprovalCommand(Guid loanId) { String result = String.Empty; Int32 numberOfDocuments = DocumentsServiceFacade.RetrieveNumberOfUploadedOrFaxedDocuments(loanId, IdentityManager.GetUserAccountId()); String submittedActivityName = ActivitiesServiceFacade.RetrieveSubmittedActivityName(loanId, IdentityManager.GetUserAccountId()); try { if (numberOfDocuments > 0 && String.IsNullOrEmpty(submittedActivityName)) { result = "Manage Documents"; } else if (!String.IsNullOrEmpty(submittedActivityName)) { // evaluate command by submitted activity name switch (submittedActivityName) { case "Upload Documents": result = "Manage Documents"; break; case "Order Appraisal": result = "Manage Appraisal"; break; case "Review Disclosures": result = "Manage Disclosures"; break; default: result = "Manage Activities"; break; } } else // in case number of documents = 0 and submitted activity is blank { result = "Manage Activities"; } return(Json(new { success = true, action = result })); } catch (Exception ex) { return(Json(new { success = false, msg = ex.Message })); } }
//public static void ApplyClassCollection( MailRoomViewModel mailRoomViewModel ) //{ // if ( mailRoomViewModel.MailRoomItems != null ) // { // // Business rule // foreach ( var item in mailRoomViewModel.MailRoomItems ) // { // if ( item.LockExpiration < DateTime.Now && item.LockExpiration != DateTime.MinValue && ( item.LockStatus == -1 || (LockStatus)item.LockStatus != LockStatus.LockRequested )) // { // item.ClassCollection = "mailroomtablelistduedate"; // } // else // { // item.ClassCollection = "mailroomtablelist"; // } // if ( item.ExceptionItemMaxWeight != -1 ) // { // item.ExceptionClassCollection = item.ExceptionItemMaxWeight < 300 // ? "exceptionIcon exceptionIcon0" // : "exceptionIcon exceptionIcon1"; // } // } // } //} public static void ChangeStatusesForDocumentsToSent(Guid loanId, int userAccountId, DocumentClass documentClass) { DocumentsServiceFacade documentsServiceFacade = new DocumentsServiceFacade(); List <UploadedFile> listOfUploadedFiles = null; if (documentClass.Equals(DocumentClass.LoanDisclosuresPackage)) { listOfUploadedFiles = documentsServiceFacade.RetrieveUploadedFilesByDocumentClass(( int )DocumentClass.LoanDisclosuresPackage, loanId); listOfUploadedFiles.AddRange(documentsServiceFacade.RetrieveUploadedFilesByDocumentClass(( int )DocumentClass.InitialDisclosuresMailingCoverLetter, loanId)); listOfUploadedFiles.AddRange(documentsServiceFacade.RetrieveUploadedFilesByDocumentClass(( int )DocumentClass.AuthorizationsPackage, loanId)); } if (documentClass.Equals(DocumentClass.LoanReDisclosuresPackage)) { listOfUploadedFiles = documentsServiceFacade.RetrieveUploadedFilesByDocumentClass(( int )DocumentClass.LoanReDisclosuresPackage, loanId); listOfUploadedFiles.AddRange(documentsServiceFacade.RetrieveUploadedFilesByDocumentClass(( int )DocumentClass.ReDisclosuresMailingCoverLetter, loanId)); } if (listOfUploadedFiles != null && listOfUploadedFiles.Any()) { List <UploadedFile> listOfUploadedFilesForChangeStatus = new List <UploadedFile>(); if (listOfUploadedFiles.Any(f => f.CurrentStatus == UploadedFileStatus.Delivered)) { listOfUploadedFilesForChangeStatus = listOfUploadedFiles.Where(f => f.CurrentStatus == UploadedFileStatus.Delivered).ToList(); } for (int i = 0; i < listOfUploadedFilesForChangeStatus.Count; i++) { if (i == 0) { DocumentsServiceFacade.ChangeUploadedFileStatus(loanId, listOfUploadedFilesForChangeStatus[i].UploadedFileId, UploadedFileStatus.Sent, userAccountId, true); } else { DocumentsServiceFacade.ChangeUploadedFileStatus(loanId, listOfUploadedFilesForChangeStatus[i].UploadedFileId, UploadedFileStatus.Sent, userAccountId, false); } } } }
private void LoadDisclosureSummary(AppraisalViewModel userAppraisalViewModel, Guid loanId, UserAccount user) { DisclosuresSummaryInfo disclosuresSummaryInfo = DocumentsServiceFacade.RetrieveDisclosuresSummaryInfo(loanId, user.UserAccountId); userAppraisalViewModel.DisclosuresSummaryInfo = disclosuresSummaryInfo; var channel = CompanyProfileServiceFacade.GetChannelByChannelId(userAppraisalViewModel.Loan.ChannelId); var activateOrderAppraisal = false; if (channel != null && channel.ActivateOrderAppraisalSettings != null) { switch (channel.ActivateOrderAppraisalSettings.DisclosuresESignTriggerType) { case (int)OrderAppraisalTriggerEnum.FirstIntentToProceed: IntegrationsSettings integrationSettings = LoanServiceFacade.RetrieveIntegrationsSettings(user.UserAccountId); activateOrderAppraisal = (disclosuresSummaryInfo.IntentToProceedReceivedBorrower != null && disclosuresSummaryInfo.IntentToProceedReceivedCoBorrower != null) || (disclosuresSummaryInfo.IntentToProceedReceivedBorrower != null && integrationSettings != null && !integrationSettings.AllBorrowersMustESign); break; case (int)OrderAppraisalTriggerEnum.LastIntentToProceed: activateOrderAppraisal = DocumentsServiceFacade.CheckItpSetForAllLoanApplications(loanId, user.UserAccountId); break; case (int)OrderAppraisalTriggerEnum.GFEandDisclosureActivity: var activity = ActivitiesServiceFacade.RetrieveActivity(loanId, ActivityType.ReviewDisclosures, user.UserAccountId); activateOrderAppraisal = channel.ActivateOrderAppraisalSettings.DisclosuresESignStatus == (int)ActivityStatus.Completed || channel.ActivateOrderAppraisalSettings.DisclosuresESignStatus == (int)ActivityStatus.Submitted; if (((int)activity.Status == channel.ActivateOrderAppraisalSettings.DisclosuresESignStatus && channel.ActivateOrderAppraisalSettings.DisclosuresESignStatus == (int)ActivityStatus.Submitted) || activity.Status == ActivityStatus.Completed) { activateOrderAppraisal = true; } break; } } userAppraisalViewModel.IsAppraisalDisabled = !activateOrderAppraisal; }
public static TitleAndEscrow GetCostByLoanId(Guid loanId, UserAccount user, HttpContextBase httpContext) { if (user == null) { return(new TitleAndEscrow()); } int userAccountId = user.UserAccountId; List <Cost> costs = CostServiceFacade.GetManageFeesCosts(loanId, MortgageType.Conventional, LoanTransactionType.Refinance, Guid.Empty, Guid.Empty, -1); TitleAndEscrow titleAndEscrow = LoanServiceFacade.RetrieveTitleAndEscrowDetails(loanId, userAccountId); if (titleAndEscrow == null || titleAndEscrow.CostGroups == null || titleAndEscrow.CostGroups.Count == 0) { return(null); } if (costs != null && !titleAndEscrow.IncludeTaxesAndInsurances) { costs = costs.Where(c => c.HUDLineNumber != 1002 && c.HUDLineNumber != 1004).ToList(); } var file = DocumentsServiceFacade.GetLatestFileByLoanIdAndDocumentClass(loanId, DocumentClass.SmartGFEComplianceCertificate, userAccountId); if (file != null && file.FileStoreItemId != Guid.Empty) { titleAndEscrow.SmartGfeDocumentLink = HttpUtility.UrlEncode(EncryptionHelper.EncryptRijndael(file.FileStoreItemId.ToString(), EncriptionKeys.Default)); if (!titleAndEscrow.SmartGFEEnabled.HasValue) { titleAndEscrow.SmartGFEEnabled = titleAndEscrow.SmartGFEEnabledOriginalValue = true; } } if ((user.Privileges != null && user.Privileges.Any(p => p.Category.Equals(( int )ActionCategory.LockFee))) || (user.Roles != null && user.Roles.Any(r => r.Privileges.Any(p => p.Category.Equals(( int )ActionCategory.LockFee))))) { titleAndEscrow.IsAuthorizedToLockFee = true; } foreach (var costGroup in titleAndEscrow.CostGroups) { if (costGroup.Costs == null) { continue; } foreach (var cost in costGroup.Costs) { if (costs != null) { var loanCost = costs.FirstOrDefault(c => c.HUDLineNumber == cost.HUDLineNumber && (String.IsNullOrWhiteSpace(cost.SubHUDLineNumber) || (c.SubHUDLineNumber == cost.SubHUDLineNumber))); if (loanCost != null) { cost.CostId = loanCost.CostId; cost.Amount = loanCost.Amount; cost.FromBorrowerFunds = loanCost.Amount; if (loanCost.Amount != 0) { cost.IsAprCost = loanCost.IsAprCost; } cost.CostId = loanCost.CostId; cost.PaidBy = loanCost.PaidBy; cost.PaidTo = loanCost.PaidTo; cost.PocAmount = loanCost.PocAmount; cost.PtcAmount = loanCost.PtcAmount; cost.When = loanCost.PocAmount > 0 ? "O" : "T"; cost.Name = costGroup.CostGroupNumber != 12 ? loanCost.Name : RetrieveDisplayNameForGroup20(loanCost.Name); cost.SmartGfeRequestType = loanCost.SmartGfeRequestType; cost.Provider = loanCost.Provider; cost.IsLocked = loanCost.IsLocked; cost.Percent = loanCost.Percent; cost.Payee = loanCost.Payee; if (cost.HUDLineNumber == 901) { DateTime?closingDate = titleAndEscrow.ClosingDate; if (closingDate.HasValue) { int interestDays = Calculator.Calculator.CalculateInterestDays(closingDate.Value); cost.ClosingDate = closingDate.Value.ToString("MM/dd/yyyy"); cost.ClosingDateTo = closingDate.Value.AddDays(interestDays - 1).ToString("MM/dd/yyyy"); cost.InterestDays = interestDays; cost.InterestRate = loanCost.Amount / interestDays; } } // Set default MonthsToBePaid to 1, in case that stored DB value is -1 if (loanCost.MonthsToBePaid == -1 && loanCost.Amount > 0) { loanCost.MonthsToBePaid = 1; } if (loanCost.MonthsToBePaid > 0) { cost.MonthsToBePaid = loanCost.MonthsToBePaid; cost.YearsToBePaid = ( int )Math.Ceiling(( double )cost.MonthsToBePaid / 12); } } cost.OldAmount = cost.Amount; } } } if (httpContext.Session[SessionHelper.CurrentLoanIdForBusinessContact] is Guid && ( Guid )httpContext.Session[SessionHelper.CurrentLoanIdForBusinessContact] == loanId) { if (httpContext.Session[SessionHelper.CurrentBusinessContactBuyerAgent] != null) { titleAndEscrow.BuyerAgent = httpContext.Session[SessionHelper.CurrentBusinessContactBuyerAgent].ToString(); } if (httpContext.Session[SessionHelper.CurrentBusinessContactSellerAgent] != null) { titleAndEscrow.SellerAgent = httpContext.Session[SessionHelper.CurrentBusinessContactSellerAgent].ToString(); // If the Agent information is the same for both only display a single instance on row 701 if (titleAndEscrow.SellerAgent.ToLower() == titleAndEscrow.BuyerAgent.ToLower()) { titleAndEscrow.SellerAgent = String.Empty; } } } else { var realtor = BusinessContactServiceFacade.RetrieveBusinessContactByTypeAndLoan(BusinessContactCategory.BuyerAgent, loanId); if (realtor != null && !String.IsNullOrEmpty(realtor.CompanyName)) { titleAndEscrow.BuyerAgent = realtor.CompanyName; } realtor = BusinessContactServiceFacade.RetrieveBusinessContactByTypeAndLoan(BusinessContactCategory.SellerAgent, loanId); if (realtor != null && !String.IsNullOrEmpty(realtor.CompanyName)) { titleAndEscrow.SellerAgent = realtor.CompanyName; } } return(titleAndEscrow); }
public AppraisalViewModel GetAppraisalDocuments(Guid loanId, int userAccountId, ref AppraisalViewModel userAppraisalViewModel) { try { List <DocumentCategory> documentCategories = DocumentsServiceFacade.RetrieveDocumentCategoriesForClass(DocumentClass.VariousDocuments, loanId, userAccountId); if (documentCategories == null) { documentCategories = new List <DocumentCategory>(); } List <DocumentCategory> otherDocumentsCategories = DocumentsServiceFacade.RetrieveDocumentCategoriesForClass(DocumentClass.OtherDocuments, loanId, userAccountId); if (otherDocumentsCategories != null && otherDocumentsCategories.Where(x => x.IsAppraisalDocument) != null) { documentCategories.AddRange(otherDocumentsCategories.Where(x => x.IsAppraisalDocument).ToList()); } var listItems = new List <DropDownItem>(); foreach (DocumentCategory document in documentCategories) { listItems.Add(new DropDownItem() { Selected = false, Text = document.Name, Value = document.DocumentCategoryId.ToString() }); } userAppraisalViewModel.DocumentCategoryTypes = listItems; List <MML.Contracts.Document> documents = DocumentsServiceFacade.RetrieveLenderXDocuments(loanId, DocumentRole.Concierge, userAccountId); if (documents != null) { var tempDoc = documents.Where(x => x.Files != null && x.Files.Count > 0 && documentCategories.Contains(x.DocumentCategory)); if (tempDoc != null) { documents = tempDoc.ToList(); } foreach (MML.Contracts.Document document in documents) { if (document.Files.Where(x => x.LenderXFile != null).Count() < document.Files.Count) { foreach (UploadedFile file in document.Files) { if (file.LenderXFile == null) { file.LenderXFile = new LenderXFile(); } } } } userAppraisalViewModel.Documents = documents.OrderBy(x => x.Name).ToList(); } return(userAppraisalViewModel); } catch (Exception) { throw; } }