本文整理汇总了C#中OpenCBS.CoreDomain.Contracts.Loans.Loan.GetFirstUnpaidInstallment方法的典型用法代码示例。如果您正苦于以下问题:C# Loan.GetFirstUnpaidInstallment方法的具体用法?C# Loan.GetFirstUnpaidInstallment怎么用?C# Loan.GetFirstUnpaidInstallment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenCBS.CoreDomain.Contracts.Loans.Loan
的用法示例。
在下文中一共展示了Loan.GetFirstUnpaidInstallment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculatePrincipalAndInterest
private KeyValuePair<Loan, RepaymentEvent> CalculatePrincipalAndInterest(Loan loan, decimal amount, bool disableFees, decimal manualFees, int paymentOption)
{
try
{
int installmentNumber = loan.GetFirstUnpaidInstallment().Number;
DateTime date = TimeProvider.Now;
PaymentMethod paymentMethod =
ServicesProvider.GetInstance().GetPaymentMethodServices().GetPaymentMethodById(1);
bool keepIntialSchedule = true;
bool payProportion = false;
switch (paymentOption)
{
case 1:
keepIntialSchedule = true;
payProportion = false;
break;
case 2:
keepIntialSchedule = false;
payProportion = false;
break;
case 3:
keepIntialSchedule = false;
payProportion = true;
break;
}
return ServicesProvider.GetInstance().GetContractServices().ShowNewContract(loan,
installmentNumber,
date,
amount,
disableFees,
manualFees,
0,
false,
0,
keepIntialSchedule,
payProportion,
paymentMethod,
false,
false);
}
catch (Exception ex)
{
new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
LoadContracts();
}
return new KeyValuePair<Loan, RepaymentEvent>();
}
示例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>();
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)
e.Item.SubItems[9].Tag = cbItem.SelectedItem;
if (5 == e.SubItem)
e.DisplayText = total.GetFormatedValue(loan.UseCents);
if (9 == e.SubItem)
e.DisplayText = cbItem.SelectedItem.ToString();
if (10 == e.SubItem)
e.Item.SubItems[10].Text = e.DisplayText;
int paymentOption = cbItem.SelectedIndex + 1;
KeyValuePair<Loan, RepaymentEvent> keyValuePair = CalculatePrincipalAndInterest(loan,
total.Value,
disableFees,
penalties.Value,
paymentOption);
if (keyValuePair.Value != null)
{
e.Item.SubItems[2].Text =
keyValuePair.Value.Principal.GetFormatedValue(loan.Product.UseCents);
e.Item.SubItems[2].Tag = keyValuePair.Value.Principal;
e.Item.SubItems[3].Text =
keyValuePair.Value.Interests.GetFormatedValue(loan.Product.UseCents);
e.Item.SubItems[3].Tag = keyValuePair.Value.Interests;
e.Item.SubItems[4].Text =
keyValuePair.Value.Penalties.GetFormatedValue(loan.Product.UseCents);
//.........这里部分代码省略.........