/// <summary>
        /// Used to test Blend Pass/Fail logic. Obviously never for prod
        /// </summary>
        public void AdminSetAllPassFailLogicToPass()
        {
            if (_personaBreakOut.isAdmin == false)
            {
                Macro.Alert("You are not a super admin; NOT setting pass/fail fields to pass");
                return;
            }
            else
            {
                List <string> cdoValidationList = new List <string>()
                {
                    "LODisclosurePrimaryValidationCheckFields.csv",
                    "LoanSetupDisclosureValidationCheckFields.csv"
                };

                foreach (string cdoValidation in cdoValidationList)
                {
                    EllieMae.Encompass.BusinessObjects.DataObject firstSetOfValidations = this.Loan.Session.DataExchange.GetCustomDataObject(cdoValidation);
                    StreamReader reader = new StreamReader(firstSetOfValidations.OpenStream());
                    string       firstValidationString      = reader.ReadToEnd();
                    string[]     firstValidationStringArray = firstValidationString.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string field in firstValidationStringArray)
                    {
                        if (!string.IsNullOrWhiteSpace(field))
                        {
                            this.Loan.Fields[field].Value = "PASS";
                        }
                    }
                }

                Macro.Alert("Stting fields to Pass complete");
            }
        }
Exemple #2
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));
            }
        }
Exemple #3
0
        public static void SaveObjectToJsonCDO(Loan loan, string cdoName, Object obj)
        {
            string output = JsonConvert.SerializeObject(obj, Newtonsoft.Json.Formatting.Indented);

            byte[] bytes = Encoding.UTF8.GetBytes(output);
            EllieMae.Encompass.BusinessObjects.DataObject dataObj = new EllieMae.Encompass.BusinessObjects.DataObject(bytes);
            loan.SaveCustomDataObject(cdoName, dataObj);
        }
        private static XConfiguration GetConfiguration(RunMode runMode, Assembly assembly)
        {
            if (assembly == (Assembly)null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }
            switch (runMode)
            {
            case RunMode.EncompassServer:
                Session runtimeSession = GlobalConfiguration.getRuntimeSession();
                if (runtimeSession == null)
                {
                    return(XConfiguration.Empty);
                }
                EllieMae.Encompass.BusinessObjects.DataObject customDataObject = runtimeSession.DataExchange.GetCustomDataObject(GlobalConfiguration.GetConfigurationFileName(runMode, assembly));
                if (customDataObject == null || customDataObject.Size == 0)
                {
                    return(XConfiguration.Empty);
                }
                using (Stream stream = customDataObject.OpenStream())
                {
                    try
                    {
                        return(new XConfiguration(stream));
                    }
                    catch (Exception ex)
                    {
                        return(XConfiguration.Empty);
                    }
                }

            case RunMode.WebServer:
            case RunMode.Client:
                return(new XConfiguration(GlobalConfiguration.GetConfigurationFileName(runMode, assembly)));

            case RunMode.Test:
                string name = string.Empty;
                foreach (string manifestResourceName in assembly.GetManifestResourceNames())
                {
                    if (manifestResourceName.EndsWith(string.Format("{0}.config", (object)assembly.GetName().Name)))
                    {
                        name = manifestResourceName;
                        break;
                    }
                }
                if (!string.IsNullOrWhiteSpace(name))
                {
                    using (Stream manifestResourceStream = assembly.GetManifestResourceStream(name))
                        return(new XConfiguration(manifestResourceStream));
                }
                else
                {
                    break;
                }
            }
            return((XConfiguration)null);
        }
 private static XElement getSettingsElementFromCustomData(string fileName)
 {
     if (string.IsNullOrWhiteSpace(fileName))
     {
         throw new ArgumentNullException(nameof(fileName));
     }
     if (GlobalConfiguration.CurrentSession == null)
     {
         throw new InvalidOperationException("Please initialize encompass session in the first!");
     }
     EllieMae.Encompass.BusinessObjects.DataObject customDataObject = GlobalConfiguration.CurrentSession.DataExchange.GetCustomDataObject(fileName);
     if (customDataObject == null || customDataObject.Size == 0)
     {
         return((XElement)null);
     }
     using (Stream stream = customDataObject.OpenStream())
         return(XElement.Load(stream));
 }
 private static void SaveInternal(XConfiguration configuration, string configFile)
 {
     using (MemoryStream memoryStream = new MemoryStream())
     {
         EllieMae.Encompass.BusinessObjects.DataObject data = new EllieMae.Encompass.BusinessObjects.DataObject();
         configuration.Save((Stream)memoryStream);
         memoryStream.Flush();
         data.Load(memoryStream.ToArray());
         if (data.Size == 0)
         {
             throw new Exception("Failed to save configuration.");
         }
         try
         {
             GlobalConfiguration.CurrentSession.DataExchange.SaveCustomDataObject(configFile, data);
         }
         catch (Exception ex)
         {
         }
     }
 }
Exemple #7
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);
        }
        public static void Save(object session, bool ignoreLog)
        {
            Assembly       assembly              = GlobalConfiguration.GetAssembly();
            XConfiguration configuration         = GlobalConfiguration.Configuration;
            string         configurationFileName = GlobalConfiguration.GetConfigurationFileName(GlobalConfiguration.Mode, assembly);

            switch (GlobalConfiguration.Mode)
            {
            case RunMode.EncompassServer:
                if (session == null)
                {
                    session = (object)GlobalConfiguration.getRuntimeSession();
                }
                using (MemoryStream memoryStream = new MemoryStream())
                {
                    EllieMae.Encompass.BusinessObjects.DataObject data = new EllieMae.Encompass.BusinessObjects.DataObject();
                    configuration.Save((Stream)memoryStream);
                    memoryStream.Flush();
                    if (!ignoreLog)
                    {
                        try
                        {
                            //GlobalTracer.TraceVerboseFormat("The length of configuration file stream is:{0}.", (object)memoryStream.Length);
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    data.Load(memoryStream.ToArray());
                    if (!ignoreLog)
                    {
                        try
                        {
                            //GlobalTracer.TraceVerboseFormat("The size of data object is:{0}.", (object)data.Size);
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    if (data.Size == 0)
                    {
                        if (!ignoreLog)
                        {
                            try
                            {
                                //GlobalTracer.TraceError("Failed to save configuration.");
                            }
                            catch (Exception ex)
                            {
                            }
                        }
                        throw new Exception("Failed to save configuration.");
                    }
                    try
                    {
                        (session as Session).DataExchange.SaveCustomDataObject(configurationFileName, data);
                        break;
                    }
                    catch (Exception ex1)
                    {
                        if (ignoreLog)
                        {
                            break;
                        }
                        try
                        {
                            //GlobalTracer.TraceErrorFormat("Failed to save changes to configuration file, details:{0}", (object)ex1.Message);
                            break;
                        }
                        catch (Exception ex2)
                        {
                            break;
                        }
                    }
                }

            case RunMode.WebServer:
            case RunMode.Client:
                configuration.Save(configurationFileName);
                break;
            }
        }