本文整理汇总了C#中OpenCBS.CoreDomain.Contracts.Loans.Loan.CalculateMaximumAmountToRegradingLoan方法的典型用法代码示例。如果您正苦于以下问题:C# Loan.CalculateMaximumAmountToRegradingLoan方法的具体用法?C# Loan.CalculateMaximumAmountToRegradingLoan怎么用?C# Loan.CalculateMaximumAmountToRegradingLoan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenCBS.CoreDomain.Contracts.Loans.Loan
的用法示例。
在下文中一共展示了Loan.CalculateMaximumAmountToRegradingLoan方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestCalculateMaximumAmountToRegradingLoan
public void TestCalculateMaximumAmountToRegradingLoan()
{
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.Flat,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1 }
};
package.KeepExpectedInstallment = false;
Loan myContract = new Loan(package, 1000, 0.03m,6,1,new DateTime(2006,1,1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
myContract.BadLoan = true;
myContract.NonRepaymentPenalties.OLB = 0.003;
myContract.AnticipatedTotalRepaymentPenalties = 0.01;
Assert.AreEqual(30m, myContract.CalculateMaximumAmountToRegradingLoan(1, new DateTime(2006, 2, 1), true, 0, 0, false, 0, false).Value);
}
示例2: lvContracts_SubItemEndEditing
private void lvContracts_SubItemEndEditing(object sender, UserControl.SubItemEndEditingEventArgs e)
{
if (4 == e.SubItem && e.Item.Tag != null)
{
e.Item.SubItems[e.SubItem].Tag = (OCurrency)decimal.Parse(e.DisplayText);
e.Item.SubItems[e.SubItem].Text = e.DisplayText;
}
if (5 == e.SubItem && e.Item.Tag != null)
{
e.Item.SubItems[e.SubItem].Tag = (OCurrency)decimal.Parse(e.DisplayText);
e.Item.SubItems[e.SubItem].Text = e.DisplayText;
}
var loan = new Loan();
if (4 == e.SubItem || 5 == e.SubItem || 9 == e.SubItem && e.Item.Tag != null)
{
loan = e.Item.Tag as Loan;
}
if (loan != null && loan.Id != 0)
{
Installment i = loan.GetFirstUnpaidInstallment();
bool disableFees = false;
var result = new KeyValuePair<Loan, RepaymentEvent>();
if (loan.Product.LoanType == OLoanTypes.DecliningFixedPrincipalWithRealInterest)
{
OCurrency amountForToday = loan.CalculateMaximumAmountToRegradingLoan(i.Number,
TimeProvider.Now,
false,
0,
0,
false,
0,
true);
PaymentMethod paymentMethod =
ServicesProvider.GetInstance().GetPaymentMethodServices().GetPaymentMethodById(1);
result = ServicesProvider.GetInstance().GetContractServices().ShowNewContract(loan,
i.Number,
TimeProvider.Now.Date,
amountForToday,
false,
0,
0,
false,
0,
true,
false,
paymentMethod,
false,
false);
}
OCurrency penalties = (OCurrency)e.Item.SubItems[4].Tag;
OCurrency principal = result.Value == null ? i.PrincipalHasToPay : result.Value.Principal;
OCurrency interest = result.Value == null ? i.InterestHasToPay : result.Value.InterestPrepayment;
OCurrency total;
if (penalties != loan.CalculateDuePenaltiesForInstallment(i.Number, TimeProvider.Today))
disableFees = true;
total = (OCurrency)e.Item.SubItems[5].Tag;
if (e.SubItem == 5)
{
if (total < 0)
throw new ArithmeticException("Total cannot be negative.");
if (total > penalties)
{
OCurrency remainder = total - penalties;
if (remainder > interest)
{
remainder -= interest;
principal = remainder > principal ? principal : remainder;
remainder -= principal;
total = principal + interest + penalties + remainder;
}
else
{
interest = remainder;
principal = 0;
}
}
else
{
penalties = total;
principal = 0;
interest = 0;
}
}
e.Item.SubItems[2].Text = principal.GetFormatedValue(loan.UseCents);
e.Item.SubItems[2].Tag = principal;
e.Item.SubItems[3].Text = interest.GetFormatedValue(loan.UseCents);
e.Item.SubItems[3].Tag = interest;
e.Item.SubItems[4].Text = penalties.GetFormatedValue(loan.UseCents);
e.Item.SubItems[4].Tag = penalties;
e.Item.SubItems[5].Text = total.GetFormatedValue(loan.UseCents);
e.Item.SubItems[5].Tag = total;
if (e.Item.SubItems.Count > 9)
//.........这里部分代码省略.........