public static IList <IDictionary <string, object> > ExtractBorrowerPairs(Loan loan, ISet <string> fields)
        {
            IList <IDictionary <string, object> > borrowerPairs = new List <IDictionary <string, object> >();

            try
            {
                int pairCount = loan.BorrowerPairs.Count;

                //using for loop instead of foreach in order to track the index
                //and ordering of the pairs
                for (int pairIndex = 0; pairIndex < pairCount; pairIndex++)
                {
                    BorrowerPair pair = loan.BorrowerPairs[pairIndex];
                    IDictionary <string, object> fieldDictionary = new Dictionary <string, object>();
                    fieldDictionary["BorrowerPairId"] = pairIndex;
                    borrowerPairs.Add(ExtractSimpleFields(loan, pair, fields, fieldDictionary));

                    if (pair.Borrower != null)
                    {
                        fieldDictionary["Borrower.ID"] = pair.Borrower.ID;
                    }
                    if (pair.CoBorrower != null)
                    {
                        fieldDictionary["CoBorrower.ID"] = pair.CoBorrower.ID;
                    }

                    if (pairIndex == 0)
                    {
                        fieldDictionary["PrimaryPair"] = true;
                    }
                    else
                    {
                        fieldDictionary["PrimaryPair"] = false;
                    }
                    //change the current borrower pair
                    loan.BorrowerPairs.Current = pair;
                    ExtractIntIndexFields(loan, FieldUtils.BorrowerEmployers(), loan.BorrowerEmployers.Count,
                                          fieldDictionary);
                    ExtractIntIndexFields(loan, FieldUtils.CoBorrowerEmployers(), loan.CoBorrowerEmployers.Count,
                                          fieldDictionary);
                    ExtractIntIndexFields(loan, FieldUtils.BorrowerResidences(), loan.BorrowerResidences.Count,
                                          fieldDictionary);
                    ExtractIntIndexFields(loan, FieldUtils.CoBorrowerResidences(), loan.CoBorrowerResidences.Count,
                                          fieldDictionary);
                    ExtractIntIndexFields(loan, FieldUtils.LiabilitiesMulti(), loan.Liabilities.Count, fieldDictionary);
                    ExtractIntIndexFields(loan, FieldUtils.MortgagesMulti(), loan.Mortgages.Count, fieldDictionary);
                }
            }
            catch
            {
                //No-op - if there are no SSN this will throw an exception.
                //But this is a no-op because SSN is not required
            }
            return(borrowerPairs);
        }
Пример #2
0
        public List <CreditContentModel> GetCreditContents(EllieMae.Encompass.Client.Session session, Loan loan)
        {
            List <CreditContentModel> creditContents = new List <CreditContentModel>();

            var _serverloanObj = GetLoanDataMgr(session, loan.Guid).LoanObject;

            string[] listofKeys = _serverloanObj.GetSupportingDataKeysOnCIFs().Where(k => k.ToUpper().Contains("LIABILITY")).ToArray();
            for (int borr = 0; borr < loan.BorrowerPairs.Count; borr++)
            {
                BorrowerPair bp = loan.BorrowerPairs[borr];
                //Pull CreditResponse XML
                if (listofKeys.Count() > 0)
                {
                    //Get Credit key by borrowerId
                    string key = listofKeys.Where(k => k.Contains(bp.Borrower.ID)).FirstOrDefault();
                    if (!string.IsNullOrEmpty(key))
                    {
                        BinaryObject binaryObject   = _serverloanObj.GetSupportingDataOnCIFs(key);
                        string       creditResponse = binaryObject.ToString().Replace("<?xml version=\"1.0\"?>", "");

                        XmlDocument doc = new XmlDocument();
                        doc.LoadXml(creditResponse);

                        //Removing EMBEDDED_FILE
                        XmlNode node = doc.SelectSingleNode("/RESPONSE_GROUP/RESPONSE/RESPONSE_DATA/CREDIT_RESPONSE/EMBEDDED_FILE");
                        if (node != null)
                        {
                            node.RemoveAll();
                        }
                        creditResponse = doc.OuterXml;

                        creditContents.Add(new CreditContentModel {
                            Content = creditResponse
                        });
                    }
                }
            }
            return(creditContents);
        }
        public static IDictionary <string, object> ExtractEverything(Loan loan)
        {
            IDictionary <string, object> loanData = new Dictionary <string, object>();

            if (loan != null)
            {
                //mark state
                BorrowerPair originalPair = loan.BorrowerPairs.Current;
                loan.BorrowerPairs.Current = loan.BorrowerPairs[0];

                AddLoanData(loanData, "fields", ExtractLoanFields(loan));
                AddLoanData(loanData, "milestones", ExtractMilestones(loan));
                AddLoanData(loanData, "lastmodified", loan.LastModified.ToString(_DateFormat));
                AddLoanData(loanData, "MachineUser", MachineUser.GetMachineUserIdentification());
                //FIXME: Commenting this out due to performance.
                //Time is ~1s/file, and there can be 100+ files
                //AddLoanData(loanData, "attachments", ExtractLoanAttachments(loan));

                //restore state
                loan.BorrowerPairs.Current = originalPair;
            }
            return(loanData);
        }
 public BorrowerPairChangedEventArgs(BorrowerPair e)
 {
     CurrentPair = e;
 }
Пример #5
0
        private void FormWrapper_FormOpened(object sender, FormOpenedArgs e)
        {
            var form = e.OpenForm;

            if (!form.Name.Equals("UnderwritingDetailsDialog", StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            var pnlStatus = form.Controls.Find("pageStatus", true);

            if (pnlStatus != null && pnlStatus.Count() > 0)
            {
                Panel uwStatusPanel = (Panel)pnlStatus[0];
                if (uwStatusPanel.Controls != null && uwStatusPanel.Controls.Count > 0)
                {
                    string borrowerName = "";
                    // populate borrower checkboxes that let you select who to send tasks to
                    BorrowerPair currentPair = EncompassApplication.CurrentLoan.BorrowerPairs.Current;

                    string borrowerBlendId = BlendUtility.GetCurrentBorrowerPairBorrowerBlendId(EncompassApplication.CurrentLoan);
                    if (string.IsNullOrEmpty(borrowerBlendId))
                    {
                        return;
                    }

                    borrowerName = $"{currentPair.Borrower.FirstName} {currentPair.Borrower.LastName}";


                    //if (currentPair.CoBorrower != null)
                    //{
                    //    string coborrowerBlendId = BlendUtility.GetCurrentBorrowerPairCoBorrowerBlendId(theLoan);
                    //    if (string.IsNullOrEmpty(coborrowerBlendId) == false)
                    //    {
                    //        CoBorrowePortalId = coborrowerBlendId;
                    //        checkBox_CoBorrower.Text = $"{currentPair.CoBorrower.FirstName} {currentPair.CoBorrower.LastName}";
                    //        checkBox_CoBorrower.Visible = true;
                    //    }
                    //}

                    //has this condition already been posted
                    // if y, show updates control
                    // if n, show post control

                    var conditionManager = new BlendConditionManagerPost_Control(borrowerName);
                    conditionManager.Location = new Point(100, 70);

                    conditionManager.Visible = true;
                    conditionManager.BringToFront();
                    uwStatusPanel.Controls.Add((Control)conditionManager);
                    uwStatusPanel.Refresh();

                    //var SendDisclosures = new Button();
                    //SendDisclosures.Name = "WcmDisclosures";
                    //SendDisclosures.Text = "WCM TESTING";
                    //SendDisclosures.Size = new Size(70, 22);
                    //// Back.Image = (Image)Resources.Back;
                    //SendDisclosures.Click += new EventHandler(SendDisclosuresButton_Click);
                    //SendDisclosures.Location = new Point(75, 22);
                    //SendDisclosures.Visible = true;
                    //SendDisclosures.Enabled = true;
                    //SendDisclosures.BringToFront();
                    //ButtonsPanel.Controls.Add((Control)SendDisclosures);
                    //ButtonsPanel.Refresh();
                }
            }
        }
        public static IDictionary <string, object> ExtractSimpleFields(Loan currentLoan, BorrowerPair borrowerPair,
                                                                       ISet <string> fieldIds, IDictionary <string, object> fieldDictionary)
        {
            if (fieldIds == null || fieldIds.Count == 0)
            {
                return(fieldDictionary);
            }

            try
            {
                var loanNumber = currentLoan.LoanNumber;
                foreach (var fieldId in fieldIds)
                {
                    try
                    {
                        if (!currentLoan.Fields[fieldId].IsEmpty())
                        {
                            var    fieldObject = currentLoan.Fields[fieldId].GetValueForBorrowerPair(borrowerPair);
                            string value       = ParseField(fieldObject);

                            if (value != null)
                            {
                                var key = SafeFieldId(fieldId);
                                fieldDictionary[key] = value;
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Logger.Error("LoandataUtils",
                                     $"Failed to pull loan={loanNumber} borrowerPair={borrowerPair} field={fieldId} Exception: {e}");
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("LoandataUtils", "Exception in ExtractSimpleFields with BorrowerPairs:" + ex);
            }

            return(fieldDictionary);
        }