/// <summary> /// Restores the tracked document if not already active. /// </summary> internal void RestoreTrackedDocument() { if (TrackedDocument != null && Package.ActiveDocument != TrackedDocument) { TrackedDocument.Activate(); } }
private void cdlLetter() { string fileName = "Cond'l Approval Letter.pdf"; string attachmentFile = ToPdf("_capprovalLetter.docx"); EllieMae.Encompass.BusinessObjects.Loans.Attachment att = EncompassApplication.CurrentLoan.Attachments.AddImage(attachmentFile); LogEntryList lst = EncompassApplication.CurrentLoan.Log.TrackedDocuments.GetDocumentsByTitle("* Approval Letter"); if (lst.Count == 0) { EncompassApplication.CurrentLoan.Log.TrackedDocuments.Add("* Approval Letter", "Approval"); att.Title = "Cond'l Approval Letter " + DateTime.Now.ToShortDateString(); lst = EncompassApplication.CurrentLoan.Log.TrackedDocuments.GetDocumentsByTitle("* Approval Letter"); TrackedDocument appLetter = (TrackedDocument)lst[0]; appLetter.Attach(att); } if (lst.Count > 0) { TrackedDocument appLetter = (TrackedDocument)lst[0]; att.Title = "Cond'l Approval Letter " + DateTime.Now.ToShortDateString(); appLetter.Attach(att); } SendMail(EncompassApplication.Session.Users.GetUser(EncompassApplication.CurrentLoan.LoanProcessorID).Email.ToString(), "Congratulations! The loan for " + EncompassApplication.CurrentLoan.Fields["4000"].FormattedValue.ToString() + " " + EncompassApplication.CurrentLoan.Fields["4002"].FormattedValue.ToString() + " has been conditionally approved!", attachmentFile, fileName, cdlAppBody()); SendMail(EncompassApplication.Session.Users.GetUser(EncompassApplication.CurrentLoan.LoanOfficerID).Email.ToString(), "Congratulations! The loan for " + EncompassApplication.CurrentLoan.Fields["4000"].FormattedValue.ToString() + " " + EncompassApplication.CurrentLoan.Fields["4002"].FormattedValue.ToString() + " has been conditionally approved!", attachmentFile, fileName, cdlAppBody()); SendMail(EncompassApplication.Session.Users.GetUser(EncompassApplication.CurrentLoan.Session.UserID).Email.ToString(), "Congratulations! The loan for " + EncompassApplication.CurrentLoan.Fields["4000"].FormattedValue.ToString() + " " + EncompassApplication.CurrentLoan.Fields["4002"].FormattedValue.ToString() + " has been conditionally approved!", attachmentFile, fileName, cdlAppBody()); SendMail("*****@*****.**", "Congratulations! The loan for " + EncompassApplication.CurrentLoan.Fields["4000"].FormattedValue.ToString() + " " + EncompassApplication.CurrentLoan.Fields["4002"].FormattedValue.ToString() + " has been conditionally approved!", attachmentFile, fileName, cdlAppBody()); }
public static TrackedDocument GetTrackedDocument(Loan oLoan, string oDocmentTitle, string oLoanMilestone) { TrackedDocument oTrackedDocument = null; if (oLoan == null) { return(oTrackedDocument); } try { LogEntryList oTrackedDocuments = oLoan.Log.TrackedDocuments.GetDocumentsByTitle(oDocmentTitle); if (oTrackedDocuments != null && oTrackedDocuments.Count > 0) { oTrackedDocument = (TrackedDocument)oTrackedDocuments[0]; } else { oTrackedDocument = oLoan.Log.TrackedDocuments.Add(oDocmentTitle, oLoanMilestone); } } catch (Exception Ex) { Macro.Alert(String.Format("Error: Get Tracked Document Folder: {0}", Ex.Message)); } return(oTrackedDocument); }
private void TSUMPrintBtn_Click(object sender, EventArgs e) { File.WriteAllBytes("1008tsum.pdf", Resources.Stripped1008___TSUM_P1); File.WriteAllBytes("1008tsum.xml", Resources.Stripped1008___TSUM_P1_pdf); GeneratePDFForm PdfForm = new GeneratePDFForm(); string attachmentFile = PdfForm.GeneratePdfForm(EncompassApplication.CurrentLoan, "1008tsum.pdf", "1008tsum.xml", "_1008___TSUM_P1CLASS"); EllieMae.Encompass.BusinessObjects.Loans.Attachment att = EncompassApplication.CurrentLoan.Attachments.AddImage(attachmentFile); LogEntryList lst = EncompassApplication.CurrentLoan.Log.TrackedDocuments.GetDocumentsByTitle("1008 Completed By U/W"); if (lst.Count == 0) { EncompassApplication.CurrentLoan.Log.TrackedDocuments.Add("1008 Completed By U/W", "Approval"); att.Title = "1008 Transmital Summary " + DateTime.Now.ToShortDateString(); lst = EncompassApplication.CurrentLoan.Log.TrackedDocuments.GetDocumentsByTitle("1008 Completed By U/W"); TrackedDocument appLetter = (TrackedDocument)lst[0]; appLetter.Attach(att); } if (lst.Count > 0) { TrackedDocument appLetter = (TrackedDocument)lst[0]; att.Title = "1008 Transmital Summary " + DateTime.Now.ToShortDateString(); appLetter.Attach(att); } }
/// <summary> /// Restores the tracked document if not already active. /// </summary> private void RestoreTrackedDocument() { if (TrackedDocument != null && Package.IDE.ActiveDocument != TrackedDocument) { TrackedDocument.Activate(); } }
public static void AddAttachment(byte[] file, string title, string fileExtension, string name, Loan ln) { try { EllieMae.Encompass.BusinessObjects.DataObject dataObject = new EllieMae.Encompass.BusinessObjects.DataObject(file); // Create a new attachment by importing it from a TIFF document on disk Attachment att = ln.Attachments.AddObject(dataObject, fileExtension); att.Title = name; LogEntryList documents = ln.Log.TrackedDocuments.GetDocumentsByTitle(title); if (documents.Count == 0) { //Creating title ln.Log.TrackedDocuments.Add(title, ln.Log.MilestoneEvents.NextEvent.MilestoneName); documents = ln.Log.TrackedDocuments.GetDocumentsByTitle(title); } // Create a new attachment by importing it from disk TrackedDocument document = (TrackedDocument)documents[0]; document.Attach(att); } catch (Exception ex) { throw new Exception(string.Format("Exception occurred in [DataService][AddAttachment] {0}", ex.Message)); } }
public override void LogEntryChanged(object sender, LogEntryEventArgs e) { int[] array = new int[] { 1, 2, 3, 4, 5 }; int lowest = array.Min(x => x); if (e.LogEntry.EntryType == LogEntryType.TrackedDocument) { TrackedDocument doc = (TrackedDocument)e.LogEntry; if (doc.Title.Equals("Closing Disclosure") || doc.Title.Equals("Closing Disclosure (Alternate)")) { doc.ShippingReadyDate = DateTime.Now; } } }
private void removeOldApprovalLetters() { TrackedDocument junkDocs = getBucket("* Junk Folder"); //go through all the buckets and get the approval letters bucket and get all attachments then remove them foreach (TrackedDocument doc in EncompassApplication.CurrentLoan.Log.TrackedDocuments) { if (doc.Title.Equals("* Approval Letter")) { TrackedDocument approvalDocs = doc; foreach (EllieMae.Encompass.BusinessObjects.Loans.Attachment appAtt in approvalDocs.GetAttachments()) { doc.Detach(appAtt); junkDocs.Attach(appAtt); } } } }
private bool MapDocumentToEfolder(Loan loan, BlendDocReturned document, TrackedDocument eFolder) { string docId = document.Id; try { var url = WcmSettings.GetDocumentFromBlendUri; GetDocumentResponse docResponse = BlendUtility.GetDocumentFromBlendPortal(docId, url); var data = new EllieMae.Encompass.BusinessObjects.DataObject(docResponse.DocumentData); EllieMae.Encompass.BusinessObjects.Loans.Attachment attachment = loan.Attachments.AddObject(data, ".pdf"); attachment.Title = $"{document.Name}"; eFolder.Attach(attachment); // once attached go update the export status var uri = WcmSettings.UpdateDocExportStatusBlendUri; var updateRequest = new UpdateDocumentExportStatusRequest() { BlendDocumentId = docId, UtcDocumentExportTime = DateTime.UtcNow.ToShortDateString() }; var requestTest = Newtonsoft.Json.JsonConvert.SerializeObject(updateRequest); var updateResponse = BlendUtility.PostDocumentExportStatusUpdate(updateRequest, uri); } catch (Exception ex) { Macro.Alert($"Error mapping {document.Name} to eFolder. Please submit a Help Desk Ticket." + Environment.NewLine + $"Error Message: {ex.Message}"); return(false); } return(true); }
private bool DownloadAndMapBlendApplicationDocuments(Loan loan) { TrackedDocument eFolder = null; string blendLoanId = loan.Fields["CX.BLEND.LOANID"].ToString(); List <BlendDocReturned> eFolderDocuments = new List <BlendDocReturned>(); string url = WcmSettings.GetAllPortalDocumentsUri; GetAllPortalDocumentsResponse getAllDocsResponse = BlendUtility.GetAllBlendPortalDocuments(blendLoanId, url); var responseTest = Newtonsoft.Json.JsonConvert.SerializeObject(getAllDocsResponse); try { foreach (var doc in getAllDocsResponse.Documents) { var docType = doc.Type; switch (docType) { case "CREDIT_REPORT": eFolder = loan.Log.TrackedDocuments.Add("Credit Report", "Started"); var creditReportMapped = MapDocumentToEfolder(loan, doc, eFolder); if (creditReportMapped) { DeleteAttachmentFromFileManager(loan, doc); } break; case "BLEND_INCOME_VERIFICATION": //case "VERIFICATION_OF_INCOME": eFolder = loan.Log.TrackedDocuments.Add("Income - Written VOE", "Started"); var voiMapped = MapDocumentToEfolder(loan, doc, eFolder); if (voiMapped) { DeleteAttachmentFromFileManager(loan, doc); } break; case "PAY_STUB": case "IRSW2": eFolder = loan.Log.TrackedDocuments.Add("Income- Paystubs/W-2s", "Started"); var payMapped = MapDocumentToEfolder(loan, doc, eFolder); if (payMapped) { DeleteAttachmentFromFileManager(loan, doc); } break; case "4506t": case "4506c": eFolder = loan.Log.TrackedDocuments.Add("Income-4506C", "Started"); var taxReturnMapped = MapDocumentToEfolder(loan, doc, eFolder); if (taxReturnMapped) { DeleteAttachmentFromFileManager(loan, doc); } break; case "IRS1040": eFolder = loan.Log.TrackedDocuments.Add("Income- Pers Tax Returns w/Scheds", "Started"); var irsMapped = MapDocumentToEfolder(loan, doc, eFolder); if (irsMapped) { DeleteAttachmentFromFileManager(loan, doc); } break; case "PRE_APPROVAL_LETTER": case "PRE_QUALIFICATION_LETTER": eFolder = loan.Log.TrackedDocuments.Add("Preapproval - Blend", "Started"); if (MapDocumentToEfolder(loan, doc, eFolder)) { DeleteAttachmentFromFileManager(loan, doc); loan.Fields["CX.BLEND.PREAPP.SENT"].Value = "Y"; } break; case "GENERATED_ASSET_STATEMENT": var assetPlaceholder = loan.Log.TrackedDocuments.GetDocumentsByTitle("Asset - Bank Statements - Chk/Svgs"); if (assetPlaceholder.Count > 0) { foreach (TrackedDocument assetDoc in assetPlaceholder) { eFolder = assetDoc; break; } } else { eFolder = loan.Log.TrackedDocuments.Add("Asset - Bank Statements - Chk/Svgs", "Started"); } var assetsMapped = MapDocumentToEfolder(loan, doc, eFolder); if (assetsMapped) { DeleteAttachmentFromFileManager(loan, doc); } break; default: break; } } } catch (Exception e) { Macro.Alert($"Error mapping Blend Documents to the eFolder. Please submit a helpdesk Ticket." + Environment.NewLine + $"Error Message: {e.Message}"); return(false); } //once mapped set the date field loan.Fields["CX.BLEND.APP.DOCS.IMPORTED"].Value = DateTime.Now; return(true); }
protected void On_RetrieveAndTrackInvoice(string oLenderCID, string oOrderID) { oAFN2IRSection = AFN2IRHelper.ReadAppConfig(); if (oAFN2IRSection == null) { Macro.Alert("Error: AFN2IRAppConfig is missing or corrupted"); return; } var oType = oAFN2IRSection.AFNRequest.Endpoint; IRServiceEndpoint oEndPoint = (oAFN2IRSection.IRServiceEndpoints.IRServiceEndpoint).Find(ep => ep.Type == oType); RestClient oRestClient = new RestClient(oEndPoint.Url); RestRequest oRestRequest = new RestRequest(Method.POST); oRestRequest.AddHeader("cache-control", "no-cache"); oRestRequest.AddHeader("content-type", "text/xml"); string oXML = IR_RequestGroup.ToXML(oAFN2IRSection, oEndPoint.InternalAID, oEndPoint.UID, oEndPoint.PwD, oLenderCID, oOrderID); oRestRequest.AddParameter("text/xml", oXML, ParameterType.RequestBody); Stopwatch oStopWatch = new Stopwatch(); oStopWatch.Start(); oRestClient.ExecuteAsync(oRestRequest, (IRestResponse oIRResp) => { Loan oLoan = EncompassApplication.CurrentLoan; oStopWatch.Stop(); if (oIRResp.StatusCode != HttpStatusCode.OK) { Macro.Alert(string.Format(oIRResp.ErrorMessage, oIRResp.ErrorException.InnerException)); } else { IR_ResponseGroup oIRResponseGroup = AFN2IRHelper.ConvertXMLToObject <IR_ResponseGroup>(Encoding.UTF8.GetBytes(oIRResp.Content)); IR_Status oIRStatus = oIRResponseGroup.Response.Status; var oIRStatusPacked = String.Format("{0}:{1}:{2} ms:{3} Bytes:{4}", oIRStatus.Condition.ToLower(), oIRStatus.Code, oStopWatch.ElapsedMilliseconds, oIRResp.ContentLength, oIRStatus.Description); //WNW: Pack status into CX.FX.IRRESP.STATUS // "success:S0010:1354:100747:Complete- Product Delivery" oLoan.Fields["CX.FX.IRRESPSTATUS"].Value = (object)oIRStatusPacked; if (oIRStatus.Condition.ToLower().Equals("success") == false) { Macro.Alert(string.Format("Condition={0} StatusCode={1}{2}Description={3}", oIRStatus.Condition, oIRStatus.Code, Environment.NewLine, oIRStatus.Description)); oLoan.Fields["CX.FX.IRINVCASEID"].Value = (object)String.Empty; oLoan.Fields["CX.FX.IRINVORDERID"].Value = (object)String.Empty; oLoan.Fields["CX.FX.IRINVORDERDT"].Value = (object)String.Empty; oLoan.Fields["CX.FX.IRINVBILLINGDT"].Value = (object)String.Empty; oLoan.Fields["CX.FX.IRINVAMNT"].Value = (object)String.Empty; oLoan.Fields["CX.FX.IRINVRPTNAME"].Value = (object)String.Empty; } else { try { Attachment oLoanAttachment = null; TrackedDocument oTrackedDocumentFolder = null; IR_BillingResponse oBillingResponse = oIRResponseGroup.Response.ResponseData.BillingResponse; string oAttachmentTitle = oAFN2IRSection.AFNResponse.AttachmentPrefix + oOrderID; string oTrackedDocumentTitle = oAFN2IRSection.AFNResponse.TrackedDocumentTitle; oLoanAttachment = AFN2IRHelper.NewLoanAttachment(oLoan, oAttachmentTitle, Convert.FromBase64String(oBillingResponse.EmbeddedFile.Document), "PDF"); oTrackedDocumentFolder = AFN2IRHelper.GetTrackedDocument(oLoan, oTrackedDocumentTitle, EncompassApplication.Session.Loans.Milestones.Submittal.Name); if ((oTrackedDocumentFolder == null) || (oLoanAttachment != null)) { oTrackedDocumentFolder.Attach(oLoanAttachment); oLoanAttachment.IsActive = Convert.ToBoolean(oAFN2IRSection.AFNResponse.AttachementActivated); } oLoan.Fields["CX.FX.IRRESPSTATUS"].Value = (object)oIRStatusPacked; oLoan.Fields["CX.FX.IRINVCASEID"].Value = (object)oBillingResponse.LenderCaseIdentifier; oLoan.Fields["CX.FX.IRINVORDERID"].Value = (object)oBillingResponse.OrderIdentifier; oLoan.Fields["CX.FX.IRINVORDERDT"].Value = (object)oBillingResponse.OrderedDate; oLoan.Fields["CX.FX.IRINVBILLINGDT"].Value = (object)oBillingResponse.BilledDate; oLoan.Fields["CX.FX.IRINVAMNT"].Value = (object)oBillingResponse.BilledAmount; oLoan.Fields["CX.FX.IRINVRPTNAME"].Value = (object)oBillingResponse.EmbeddedFile.Name; oLoan.Fields["CX.FX.AFNTRACKEDDOCFOLDER"].Value = (object)oTrackedDocumentFolder.Title; //Macro.Alert(string.Format("Received: {0}.{1}Now tracked in eFolder: {2}", oLoanAttachment.Title, // Environment.NewLine, // oTrackedDocumentFolder.Title)); } catch (Exception Ex) { var oMethodName = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name; Macro.Alert(string.Format("{0}: Error moving billing report to eFolder: {1}", oMethodName, Ex.Message)); } } if (this.fxIRRespHTTPStatus != null) { this.fxIRRespHTTPStatus.Refresh(); } if (fxIRRespBilling != null) { this.fxIRRespBilling.Refresh(); } } }); }
public List <WCMDisclosure> GetDisclosuresFromTrackedDocument(WCMDisclosurePackage packageSelected, TrackedDocument efolder) { var result = new List <WCMDisclosure>(); AttachmentList attachments = efolder.GetAttachments(); foreach (Attachment attachment in attachments) { // SP - 03/21 - Doc Conversion Turned on // attachments are NOT available until after they are fully converted // while loop below allows us to check if doc is fully converted 20 times // thread.sleep in between each try let's doc finish converting int attemptDisclosureCount = 0; while (attemptDisclosureCount < 10) { attemptDisclosureCount++; try { result.Add(PopulateWCMDisclosures(attachment, packageSelected)); break; } catch (Exception ex) { // SP - aftr trying x times, throw ex if (attemptDisclosureCount >= 10) { throw new WCMException($"Unable to retrieve attachment from efolder " + $"'{efolder.Title}. '{ex.ToString()}'"); } Thread.Sleep(5000); } } } return(result); }