Encompass codes that write the actual or expected closing date

Here are codes that write the actual or expected closing date for every loan in the “My Pipeline” folder that has been sent for processing.

using System;

using System.IO;
using EllieMae.Encompass.Client;
using EllieMae.Encompass.BusinessEnums;
using EllieMae.Encompass.BusinessObjects;
using EllieMae.Encompass.BusinessObjects.Loans;
using EllieMae.Encompass.BusinessObjects.Loans.Logging;

class LoanReader
{
   public static void Main()
   {
      // Open the session to the remote server
      Session session = new Session();
      session.Start("myserver", "mary", "maryspwd");

      // Get the "My Pipeline" folder
      LoanFolder fol = session.Loans.Folders["My Pipeline"];

      // Retrieve the folder's contents
      LoanIdentityList ids = fol.GetContents();

      // Open each loan in the folder and check the expected closing date
      for (int i = 0; i < ids.Count; i++)
      {
         // Open the next loan in the loop
         Loan loan = fol.OpenLoan(ids[i].LoanName);

         // Get the "Completion" event from the loan
         MilestoneEvent msEvent = 
            loan.Log.MilestoneEvents.GetEventForMilestone(session.Loans.Milestones.Completion.Name);

         if ((msEvent != null) && (msEvent.Date != null))
         {
            if (msEvent.Completed)
               Console.WriteLine("The loan \"" + loan.LoanName + "\" was completed on " + msEvent.Date);
            else
               Console.WriteLine("The loan \"" + loan.LoanName + "\" has an expected completion date of " + msEvent.Date);
         }

         // Close the loan
         loan.Close();
      }

      // End the session to gracefully disconnect from the server
      session.End();
   }
}

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.