Exemplo n.º 1
0
        public bool UploadIUSEligibilityData(string loanGuid, string htmlContent, string encompassInstance, string encompassUserName, string encompassPassword)
        {
            using (EllieMae.Encompass.Client.Session session = new EllieMae.Encompass.Client.Session())
            {
                session.Start(encompassInstance, encompassUserName, encompassPassword);
                Loan loan = null;

                try
                {
                    loan = session.Loans.Open("{" + loanGuid.ToString() + "}", true, true);// "{bd019591-41b1-4fa5-8c97-0554f483413c}";
                }
                catch (Exception ex)
                {
                    session.End();
                    throw new LoanLockedException(ex.Message);
                }

                if (loan == null)
                {
                    throw new FileNotFoundException();
                }

                try
                {
                    loan.Lock();

                    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    // Got the below code from: $\Apps\Work\Encompass\Customizations\CodeBase\Impac Eligibility\Impac.Eligibility.Codebase\Impac.Eligibility.Codebase\WinForm\EligibilityResponseForm.cs
                    // private void SaveResponseHtml(string certHtmlDecision)
                    // AttachmentHelper.AddAttachment(Encoding.ASCII.GetBytes(certHtmlDecision), "Eligibility Certificate", ".html", _loan);
                    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    AddAttachment(Encoding.ASCII.GetBytes(htmlContent), "TPO IUS Eligibility Certificate", ".html", loan);
                    loan.Commit();
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
                finally
                {
                    if (loan != null)
                    {
                        loan.Unlock();
                        loan.Close();
                    }

                    // end the encompass login session
                    session.End();
                }
            } // end using client.session - NOTE, i am guessing "using" call would just put this session object in the garabage collector. I don't think it will do session.End. So we have to call that in above.


            return(true);
        }
Exemplo n.º 2
0
        public bool UploadFNMFile(Guid loanGuid, string filePath, string encompassInstance, string encompassUserName, string encompassPassword)
        {
            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException();
            }

            using (EllieMae.Encompass.Client.Session session = new EllieMae.Encompass.Client.Session())
            {
                session.Start(encompassInstance, encompassUserName, encompassPassword);
                Loan loan;

                try
                {
                    loan = session.Loans.Open("{" + loanGuid.ToString() + "}", true, true);// "{bd019591-41b1-4fa5-8c97-0554f483413c}";
                }
                catch (Exception ex)
                {
                    throw new LoanLockedException(ex.Message);
                }

                if (loan == null)
                {
                    throw new FileNotFoundException();
                }

                loan.Lock();
                loan.Import(filePath, LoanImportFormat.FNMA3X);
                loan.Commit();
                loan.Unlock();
                loan.Close();
                session.End();
            }

            return(true);
        }