コード例 #1
0
ファイル: NL_Loans.cs プロジェクト: vijayamazon/ezbob
        /// <exception cref="InvalidCastException"><paramref /> cannot be cast to the element type of the current <see cref="T:System.Array" />.</exception>
        public override string ToString()
        {
            // loan
            StringBuilder sb = new StringBuilder().Append(PrintHeadersLine(typeof(NL_Loans))).Append(ToStringAsTable()).Append(Environment.NewLine);

            // freeze interest intervals
            if (FreezeInterestIntervals.Count > 0)
            {
                sb.Append("LoanInterestFreeze:")
                .Append(Environment.NewLine)
                .Append(PrintHeadersLine(typeof(NL_LoanInterestFreeze)));
                FreezeInterestIntervals.ForEach(s => sb.Append(s.ToString()));
            }             //else sb.Append("No LoanInterestFreeze").Append(Environment.NewLine);

            if (LoanOptions.LoanOptionsID > 0)
            {
                sb.Append("LoanOptions:")
                .Append(Environment.NewLine)
                .Append(PrintHeadersLine(typeof(NL_LoanOptions)))
                .Append(LoanOptions.ToStringAsTable());
            }             //else sb.Append("No Loan options").Append(Environment.NewLine);

            // rollovers
            if (AcceptedRollovers.Count > 0)
            {
                sb.Append(Environment.NewLine)
                .Append("AcceptedRollovers:").Append(Environment.NewLine)
                .Append(PrintHeadersLine(typeof(NL_LoanRollovers)));
                AcceptedRollovers.ForEach(r => sb.Append(r.ToStringAsTable()));
            }             //else sb.Append("No AcceptedRollovers").Append(Environment.NewLine);

            // fees
            if (Fees.Count > 0)
            {
                sb.Append(Environment.NewLine)
                .Append("Fees:").Append(Environment.NewLine)
                .Append(PrintHeadersLine(typeof(NL_LoanFees)));
                Fees.ForEach(s => sb.Append(s.ToStringAsTable()));
            }             //else sb.Append("No Fees").Append(Environment.NewLine);

            // histories
            if (Histories != null)
            {
                sb.Append(Environment.NewLine)
                .Append("Histories:").Append(Environment.NewLine);
                Histories.ForEach(h => sb.Append(h.ToString()));
            }              // else sb.Append("No Histories").Append(Environment.NewLine);

            // payments
            if (Payments.Count > 0)
            {
                sb.Append("Payments:");
                Payments.ForEach(p => sb.Append(p.ToString()));
            }             // else sb.Append("No Payments").Append(Environment.NewLine);

            return(sb.ToString());
        }
コード例 #2
0
        public Dictionary <string, decimal> CalculatedFees()
        {
            var calculatedFees = new Dictionary <string, decimal>();

            Fees.ForEach(i =>
            {
                if (i.Description != null)
                {
                    if (i.PercentageOrPrice == "Percentage")
                    {
                        calculatedFees.Add($"{i.Description} ( {i.Value}% )", SubTotal * (i.Value / 100));
                    }
                    else if (i.PercentageOrPrice == "Price")
                    {
                        calculatedFees.Add(i.Description, i.Value);
                    }
                }
            });

            return(calculatedFees);
        }