Exemple #1
0
        public override string ToString()
        {
            var os = new StringBuilder();

            os.AppendFormat(
                "Summary for Loan {0} ({3}) - {1} ({5}) - {2} - {4}paid - begin\n",
                ID, LoanType.ToString(), ScheduleState.ToString(),
                DeclaredLoanAmount.ToString("C2", Schedule.Culture),
                TotalPrincipalPaid == DeclaredLoanAmount ? "" : "not ",
                Actual.Count
                );

            os.AppendFormat("\tPlanned vs Actual: {0} - {1}\n", Planned.Count, Actual.Count);

            os.AppendFormat(
                "\tRemaining + Paid = Issued: {0} - {1} + {2} <=> {3}\n",
                TotalPrincipalPaid + RemainingPrincipal == DeclaredLoanAmount ? "yes" : "no",
                RemainingPrincipal, TotalPrincipalPaid, DeclaredLoanAmount
                );

            os.AppendFormat("\tPlanned schedule ({0}):\n", Planned.Count);

            Planned.ForEach(x => os.AppendFormat("\t\t{0}\n", x));

            os.AppendFormat("\t\t{0}\n", new string('-', 38));
            os.AppendFormat("\t\t{0,27} {1,10}\n", " ", Planned.Sum(x => x.Principal).ToString("C2", Schedule.Culture));

            os.AppendFormat("\tActual schedule ({0}):\n", Actual.Count);

            Actual.ForEach(x => os.AppendFormat("\t\t{0}\n", x));

            os.AppendFormat("\t\t{0}\n", new string('-', 38));
            os.AppendFormat("\t\t{0,27} {1,10}\n", " ", RemainingPrincipal.ToString("C2", Schedule.Culture));

            os.AppendFormat("\tWorking set ({0}):\n", WorkingSet.Count);

            WorkingSet.ForEach(x => os.AppendFormat("\t\t{0}\n", x));

            os.AppendFormat("\tTransactions ({0} - {1}):\n", Transactions.Count, ProcessedTransactionCount);

            Transactions.ForEach(x => os.AppendFormat("\t\t{0}\n", x));

            os.AppendFormat("\t\t{0}\n", new string('-', 38));
            os.AppendFormat("\t\t{0,27} {1,10}\n", " ", TotalPrincipalPaid.ToString("C2", Schedule.Culture));

            os.AppendFormat("\tSchedule-transactions ({0}):\n", ScheduleTransactions.Count);

            ScheduleTransactions.ForEach(x => os.AppendFormat("\t\t{0}\n", x));

            var nExpected = WorkingSet.Sum(x => x.Principal);
            var nActual   = ScheduleTransactions.Sum(x => x.PrincipalDelta);

            os.AppendFormat(
                "\tTotal working set + schedule transactions\n\t\t{0,10} + {1,10} = {2,10}\n",
                nExpected.ToString("C2", Schedule.Culture),
                nActual.ToString("C2", Schedule.Culture),
                (nExpected + nActual).ToString("C2", Schedule.Culture)
                );

            os.AppendFormat("Loan {0} - end\n", ID);

            return(os.ToString());
        }         // ToString