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