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());
        }
        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);
            }
        }
コード例 #3
0
        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));
            }
        }
        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);
                    }
                }
            }
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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();
                    }
                }
            });
        }