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); }
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); } } } }