private void DeleteAttachmentFromFileManager(Loan loan, BlendDocReturned document) { foreach (EllieMae.Encompass.BusinessObjects.Loans.Attachment att in loan.Attachments) { var attachmentTitle = att.Title; if (attachmentTitle.Equals(document.Name)) { //check to make sure this document is not the one we just added to the eFolder if (att.GetDocument() == null) { loan.Attachments.Remove(att); return; } } } }
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); }