예제 #1
0
        /// <summary>
        /// Method for testing extraction.
        /// </summary>
        /// <param name="session">Active session</param>
        /// <param name="id">Loan ID or Guid</param>
        public void DoExtraction(Session session, string id)
        {
            FieldUtils.AddFieldCollection(FieldUtils.session.Loans.FieldDescriptors.CustomFields);
            FieldUtils.AddFieldCollection(FieldUtils.session.Loans.FieldDescriptors.StandardFields);
            FieldUtils.AddFieldCollection(FieldUtils.session.Loans.FieldDescriptors.VirtualFields);

            Loan loan;

            if (id.StartsWith("{"))
            {
                loan = SessionUtils.OpenLoan(session, id);
            }
            else
            {
                loan = SessionUtils.OpenLoanFromLoanNumber(session, id);
            }

            IDictionary <string, object> loanData =
                Sextant.EncompassUtils.LoanDataUtils.ExtractEverything(loan);
            string json = JsonConvert.SerializeObject(loanData);

            try
            {
                if (loan != null)
                {
                    loan.Close();
                }
            }
            catch (Exception e)
            {
                //Timeout or other error
                Debug.WriteLine("Exception closing loan: " + e);
                Console.WriteLine("Exception closing loan: " + e);
            }

            Debug.WriteLine(json);
            Console.WriteLine(json);
        }
        private void GenerateUnknownMultiIndexDetails(Session session, string guid)
        {
            GuaranteedRate.Sextant.EncompassUtils.FieldUtils.session = session;
            FieldUtils.AddFieldCollection(FieldUtils.session.Loans.FieldDescriptors.CustomFields);
            FieldUtils.AddFieldCollection(FieldUtils.session.Loans.FieldDescriptors.StandardFields);
            FieldUtils.AddFieldCollection(FieldUtils.session.Loans.FieldDescriptors.VirtualFields);

            Loan loan = SessionUtils.OpenLoan(session, guid);


            ISet <string> unknownMiddle = FieldUtils.MiddleIndexMulti();
            ISet <string> unknownEnd    = FieldUtils.EndIndexMulti();

            //Write all the known index values....
            IDictionary <string, int> indexKeySizes = LoanDataUtils.IndexKeySizes(loan);

            foreach (string key in indexKeySizes.Keys)
            {
                Console.WriteLine(key + " == " + indexKeySizes[key]);
            }

            //Things that maybe are index values

            /*
             * Console.WriteLine("Disclosures2015 == " + loan.Log.Disclosures2015.Count);
             * Console.WriteLine("DocumentOrders == " + loan.Log.DocumentOrders.Count);
             * Console.WriteLine("EDMTransactions == " + loan.Log.EDMTransactions.Count);
             * Console.WriteLine("HtmlEmailMessages == " + loan.Log.HtmlEmailMessages.Count);
             * Console.WriteLine("InvestorRegistrations == " + loan.Log.InvestorRegistrations.Count);
             * Console.WriteLine("LockCancellationRequests == " + loan.Log.LockCancellationRequests.Count);
             * Console.WriteLine("LockCancellations == " + loan.Log.LockCancellations.Count);
             * Console.WriteLine("LockConfirmations == " + loan.Log.LockConfirmations.Count);
             * Console.WriteLine("LockDenials == " + loan.Log.LockDenials.Count);
             * Console.WriteLine("LockRequests == " + loan.Log.LockRequests.Count);
             * Console.WriteLine("MilestoneEvents == " + loan.Log.MilestoneEvents.Count);
             * Console.WriteLine("MilestoneTasks == " + loan.Log.MilestoneTasks.Count);
             * Console.WriteLine("PostClosingConditions == " + loan.Log.PostClosingConditions.Count);
             * Console.WriteLine("PreliminaryConditions == " + loan.Log.PreliminaryConditions.Count);
             * Console.WriteLine("PrintEvents == " + loan.Log.PrintEvents.Count);
             * Console.WriteLine("ReceivedDownloads == " + loan.Log.ReceivedDownloads.Count);
             * Console.WriteLine("StatusOnlineUpdates == " + loan.Log.StatusOnlineUpdates.Count);
             * Console.WriteLine("TrackedDocuments == " + loan.Log.TrackedDocuments.Count);
             * Console.WriteLine("UnderwritingConditions == " + loan.Log.UnderwritingConditions.Count);
             *
             * Console.WriteLine("Servicing.IsStarted() == " + loan.Servicing.IsStarted());
             * PaymentSchedule schedule = loan.Servicing.GetPaymentSchedule();
             *
             * foreach (ScheduledPayment payment in schedule.Payments)
             *  Console.WriteLine(payment.DueDate + ": P = " + payment.Principal + ", I = " + payment.Interest);
             */


            //Console.WriteLine("Transactions.GetEnumerator().Current == " + loan.Servicing.Transactions.GetEnumerator().Current);
            //Console.WriteLine("Servicing.IsStarted() == " + loan.Servicing.GetPaymentSchedule().Payments[0].);

            //For each element, itterate and print their values...

            /*
             * foreach (string field in unknownMiddle.OrderBy(x => x.ToString()))
             * {
             *  FindBoundariesMiddle(loan, field);
             * }
             */

            foreach (string field in unknownEnd.OrderBy(x => x.ToString()))
            {
                FindBoundariesEnd(loan, field);
            }

            if (loan != null)
            {
                loan.Close();
            }
        }