The following code demonstrates how to add an Opportunity record to a Borrower Contact.
using System;
using System.IO;
using EllieMae.Encompass.Client;
using EllieMae.Encompass.BusinessObjects;
using EllieMae.Encompass.BusinessObjects.Contacts;
class ContactManager
{
public static void Main(string[] args)
{
// Open the session to the remote server
Session session = new Session();
session.Start(“myserver”, “mary”, “maryspwd”);
// Create a new contact
BorrowerContact contact = (BorrowerContact) session.Contacts.CreateNew(ContactType.Borrower);
// Set some basic properties
contact.FirstName = “Mary”;
contact.LastName = “Jones”;
contact.HomePhone = “(555) 555-5555”;
contact.BorrowerType = BorrowerContactType.Propspect;
// Save the contact before we attempt to create the opportunity
contact.Commit();
// Create an opportunity for the contact
ContactOpportunity opp = contact.Opportunities.Add();
opp.LoanAmount = 245000;
opp.MortgageBalance = 255000;
opp.MortgageRate = 6.75f;
opp.EmploymentStatus = EmploymentStatus.Employed;
opp.PropertyUse = PropertyUse.Primary;
opp.Commit();
// End the session to gracefully disconnect from the server
session.End();
}
}