本文整理汇总了C#中OpenCBS.CoreDomain.Contracts.Loans.Loan.CalculateExpectedOlb方法的典型用法代码示例。如果您正苦于以下问题:C# Loan.CalculateExpectedOlb方法的具体用法?C# Loan.CalculateExpectedOlb怎么用?C# Loan.CalculateExpectedOlb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenCBS.CoreDomain.Contracts.Loans.Loan
的用法示例。
在下文中一共展示了Loan.CalculateExpectedOlb方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateExpectedOLB2
public void CalculateExpectedOLB2()
{
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.Flat,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1 }
};
package.KeepExpectedInstallment = false;
package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
Loan myContract = new Loan(package, 20000, 0.02m, 10, 0, new DateTime(2009, 1, 17), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
myContract.BadLoan = false;
myContract.Repay(1, new DateTime(2009, 1, 17), 1000, true, false);
Assert.AreEqual(19000, myContract.CalculateExpectedOlb(1, false).Value);
Assert.AreEqual(17100, myContract.CalculateExpectedOlb(2, false).Value);
Assert.AreEqual(15200, myContract.CalculateExpectedOlb(3, false).Value);
Assert.AreEqual(13300, myContract.CalculateExpectedOlb(4, false).Value);
Assert.AreEqual(11400, myContract.CalculateExpectedOlb(5, false).Value);
Assert.AreEqual(9500, myContract.CalculateExpectedOlb(6, false).Value);
Assert.AreEqual(7600, myContract.CalculateExpectedOlb(7, false).Value);
Assert.AreEqual(5700, myContract.CalculateExpectedOlb(8, false).Value);
Assert.AreEqual(3800, myContract.CalculateExpectedOlb(9, false).Value);
Assert.AreEqual(1900, myContract.CalculateExpectedOlb(10, false).Value);
}
示例2: CalculateExpectedOLB_Flat_Accrual
public void CalculateExpectedOLB_Flat_Accrual()
{
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual);
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.Flat,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1, UseCents = true}
};
package.KeepExpectedInstallment = false;
package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2009, 2, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
myContract.BadLoan = false;
myContract.Repay(1, new DateTime(2009, 3, 2), 31.07m, true, false);
myContract.Repay(2, new DateTime(2009, 4, 1), 230, true, false);
myContract.Repay(3, new DateTime(2009, 4, 7), 806m, true, false);
Assert.AreEqual(1000, myContract.CalculateExpectedOlb(1, false).Value);
Assert.AreEqual(1000m, myContract.CalculateExpectedOlb(2, false).Value);
Assert.AreEqual(800m, myContract.CalculateExpectedOlb(3, false).Value);
Assert.AreEqual(0m, myContract.CalculateExpectedOlb(4, false).Value);
Assert.AreEqual(0m, myContract.CalculateExpectedOlb(5, false).Value);
Assert.AreEqual(0m, myContract.CalculateExpectedOlb(6, false).Value);
}
示例3: TestCalculateOLBWith2MonthOfGracePeriodWhenDecliningExotic
public void TestCalculateOLBWith2MonthOfGracePeriodWhenDecliningExotic()
{
Assert.Ignore();
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.DecliningFixedInstallments,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1 }
};
ExoticInstallmentsTable exoticProduct = new ExoticInstallmentsTable();
exoticProduct.Add(new ExoticInstallment(1, 0.1, null));
exoticProduct.Add(new ExoticInstallment(2, 0.1, null));
exoticProduct.Add(new ExoticInstallment(3, 0.1, null));
exoticProduct.Add(new ExoticInstallment(4, 0.1, null));
exoticProduct.Add(new ExoticInstallment(5, 0.1, null));
exoticProduct.Add(new ExoticInstallment(6, 0.5, null));
package.ExoticProduct = exoticProduct;
Loan myContract = new Loan(package, 1000, 0.03m, 8, 2, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
myContract.Repay(1, new DateTime(2006, 2, 1), 100, true, false);
Assert.AreEqual(1000m, myContract.CalculateExpectedOlb(1, false).Value);
Assert.AreEqual(930m, myContract.CalculateExpectedOlb(2, false).Value);
Assert.AreEqual(930m, myContract.CalculateExpectedOlb(3, false).Value);
Assert.AreEqual(837m, myContract.CalculateExpectedOlb(4, false).Value);
Assert.AreEqual(744m, myContract.CalculateExpectedOlb(5, false).Value);
Assert.AreEqual(651m, myContract.CalculateExpectedOlb(6, false).Value);
Assert.AreEqual(558m, myContract.CalculateExpectedOlb(7, false).Value);
Assert.AreEqual(465m, myContract.CalculateExpectedOlb(8, false).Value);
}
示例4: TestCalculateOLBWith2MonthOfGracePeriod
public void TestCalculateOLBWith2MonthOfGracePeriod()
{
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.Flat,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1 }
};
package.KeepExpectedInstallment = false;
package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
Loan myContract = new Loan(package, 1000, 0.03m, 7, 2, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
myContract.BadLoan = false;
myContract.AnticipatedTotalRepaymentPenalties = 0.03;
Assert.AreEqual(1000m, myContract.CalculateExpectedOlb(1, false).Value);
Assert.AreEqual(1000m, myContract.CalculateExpectedOlb(2, false).Value);
Assert.AreEqual(1000m, myContract.CalculateExpectedOlb(3, false).Value);
Assert.AreEqual(800m, myContract.CalculateExpectedOlb(4, false).Value);
Assert.AreEqual(600m, myContract.CalculateExpectedOlb(5, false).Value);
Assert.AreEqual(400m, myContract.CalculateExpectedOlb(6, false).Value);
Assert.AreEqual(200m, myContract.CalculateExpectedOlb(7, false).Value);
}
示例5: TestCalculateOLB6
public void TestCalculateOLB6()
{
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.Flat,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1 }
};
package.KeepExpectedInstallment = false;
package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
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 = false;
myContract.AnticipatedTotalRepaymentPenalties = 0.03;
myContract.Repay(1, new DateTime(2006, 2, 1), 30, false, false);
RepaymentEvent rE = myContract.Repay(2, new DateTime(2006, 3, 3), 1000, false, true);
Assert.AreEqual(0m, rE.Fees.Value);
Assert.AreEqual(150m, rE.Interests.Value);
Assert.AreEqual(850m, rE.Principal.Value);
Assert.AreEqual(1000m, myContract.CalculateExpectedOlb(1, true).Value);
Assert.AreEqual(1000m, myContract.CalculateExpectedOlb(2, true).Value);
Assert.AreEqual(800m, myContract.CalculateExpectedOlb(3, true).Value);
Assert.AreEqual(600m, myContract.CalculateExpectedOlb(4, true).Value);
Assert.AreEqual(400m, myContract.CalculateExpectedOlb(5, true).Value);
Assert.AreEqual(200m, myContract.CalculateExpectedOlb(6, true).Value);
}
示例6: TestCalculateOLB4
public void TestCalculateOLB4()
{
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.DecliningFixedInstallments,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1, UseCents = true}
};
package.KeepExpectedInstallment = false;
package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
Loan myContract = new Loan(package, 1000, 0.03m, 6, 0, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
myContract.BadLoan = false;
myContract.AnticipatedTotalRepaymentPenalties = 0.03;
Assert.AreEqual(1000m, myContract.CalculateExpectedOlb(1, false).Value);
Assert.AreEqual(845.40m, myContract.CalculateExpectedOlb(2, false).Value);
Assert.AreEqual(686.16m, myContract.CalculateExpectedOlb(3, false).Value);
Assert.AreEqual(522.14m, myContract.CalculateExpectedOlb(4, false).Value);
Assert.AreEqual(353.21m, myContract.CalculateExpectedOlb(5, false).Value);
Assert.AreEqual(179.22m, myContract.CalculateExpectedOlb(6, false).Value);
myContract.Repay(1,new DateTime(2006,2,1),184.60m,false,false);
RepaymentEvent rE = myContract.Repay(2,new DateTime(2006,4,3),369.2m,false,false);
Assert.AreEqual(0m, rE.Fees.Value);
Assert.AreEqual(45.94m, rE.Interests.Value);
Assert.AreEqual(323.26m, rE.Principal.Value);
Assert.AreEqual(1000, myContract.CalculateExpectedOlb(1, false).Value);
Assert.AreEqual(845.40m, myContract.CalculateExpectedOlb(2, false).Value);
Assert.AreEqual(686.16m, myContract.CalculateExpectedOlb(3, false).Value);
Assert.AreEqual(522.14m, myContract.CalculateExpectedOlb(4, false).Value);
Assert.AreEqual(353.21m, myContract.CalculateExpectedOlb(5, false).Value);
Assert.AreEqual(179.22m, myContract.CalculateExpectedOlb(6, false).Value);
}
示例7: TestCalculateOLB3
public void TestCalculateOLB3()
{
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual);
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.Flat,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1, UseCents = true }
};
package.KeepExpectedInstallment = false;
package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
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 = false;
myContract.AnticipatedTotalRepaymentPenalties = 0.03;
myContract.Repay(1, new DateTime(2006, 2, 1), 30, false, false);
RepaymentEvent rE = myContract.Repay(2, new DateTime(2006, 3, 3), 1055.82m, false, false);
Assert.AreEqual(24, rE.Fees.Value);
Assert.AreEqual(31.82m, rE.Interests.Value);
Assert.AreEqual(1000, rE.Principal.Value);
Assert.AreEqual(1000, myContract.CalculateExpectedOlb(1, false).Value);
Assert.AreEqual(1000, myContract.CalculateExpectedOlb(2, false).Value);
Assert.AreEqual(800m, myContract.CalculateExpectedOlb(3, false).Value);
Assert.AreEqual(0, myContract.CalculateExpectedOlb(4, false).Value);
Assert.AreEqual(0, myContract.CalculateExpectedOlb(5, false).Value);
Assert.AreEqual(0, myContract.CalculateExpectedOlb(6, false).Value);
}
示例8: OLB_DecliningFixedInstallments_OneRepayment_OneMonthGracePeriod_Overdue_KeepNotExpectedInstallment
public void OLB_DecliningFixedInstallments_OneRepayment_OneMonthGracePeriod_Overdue_KeepNotExpectedInstallment()
{
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual);
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.DecliningFixedInstallments,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1, UseCents = true}
};
Loan myContract = new Loan(package, 750, 0.03m, 9, 1, new DateTime(2006, 2, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
myContract.Repay(1, new DateTime(2006, 3, 1), 740, false, false);
Assert.AreEqual(750, myContract.CalculateExpectedOlb(1, false).Value);
Assert.AreEqual(32.5m, myContract.CalculateExpectedOlb(2, false).Value);
Assert.AreEqual(28.85m, myContract.CalculateExpectedOlb(3, false).Value);
Assert.AreEqual(25.09m, myContract.CalculateExpectedOlb(4, false).Value);
Assert.AreEqual(21.21m, myContract.CalculateExpectedOlb(5, false).Value);
Assert.AreEqual(17.22m, myContract.CalculateExpectedOlb(6, false).Value);
Assert.AreEqual(13.11m, myContract.CalculateExpectedOlb(7, false).Value);
Assert.AreEqual(8.87m, myContract.CalculateExpectedOlb(8, false).Value);
Assert.AreEqual(4.51m, myContract.CalculateExpectedOlb(9, false).Value);
}
示例9: TestRepayFlat_GracePeriod_KeepNotExpectedInstallments
public void TestRepayFlat_GracePeriod_KeepNotExpectedInstallments()
{
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual);
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.Flat,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1, UseCents = true }
};
package.KeepExpectedInstallment = false;
package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
Loan myContract = new Loan(package, 50000, 0.01m, 8, 2, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
myContract.BadLoan = false;
myContract.Repay(1, new DateTime(2006, 2, 1), 1050, true, true);
myContract.Repay(2, new DateTime(2006, 6, 1), 40000, true, true);
Assert.AreEqual(50000, myContract.CalculateExpectedOlb(1, false).Value);
Assert.AreEqual(50000, myContract.CalculateExpectedOlb(2, false).Value);
Assert.AreEqual(50000m, myContract.CalculateExpectedOlb(3, false).Value);
Assert.AreEqual(41666.67m, myContract.CalculateExpectedOlb(4, false).Value);
Assert.AreEqual(33333.34m, myContract.CalculateExpectedOlb(5, false).Value);
//Assert.AreEqual(11428m, myContract.CalculateExpectedOLB(6, false).Value);
//Assert.AreEqual(7618.67m, myContract.CalculateExpectedOLB(7, false).Value);
//Assert.AreEqual(3809.34m, myContract.CalculateExpectedOLB(8, false).Value);
}
示例10: CancelLastEvent
/// <summary>
/// Cancels last event from given contract, restores associated installment status.
/// and restores Client(individual, corporate) status
/// </summary>
/// <param name="contract">Contract</param>
/// <param name="pClient"></param>
/// <param name="comment"> </param>
/// <returns>Cancelled event</returns>
public Event CancelLastEvent(Loan contract, IClient pClient, string comment)
{
using (SqlConnection conn = _loanManager.GetConnection())
using (SqlTransaction sqlTransaction = conn.BeginTransaction())
{
Event cancelledEvent;
try
{
Event evnt = contract.GetLastNonDeletedEvent();
if (null == evnt)
throw new OpenCbsContractSaveException(OpenCbsContractSaveExceptionEnum.EventIsNull);
if (!evnt.Cancelable)
throw new OpenCbsContractSaveException(OpenCbsContractSaveExceptionEnum.EventNotCancelable);
if (string.IsNullOrEmpty(comment))
throw new OpenCbsContractSaveException(OpenCbsContractSaveExceptionEnum.EventCommentIsEmpty);
if (pClient is Person)
evnt.ClientType = OClientTypes.Person;
else if (pClient is Group)
evnt.ClientType = OClientTypes.Group;
else if (pClient is Corporate)
evnt.ClientType = OClientTypes.Corporate;
else if (pClient is Village)
evnt.ClientType = OClientTypes.Village;
evnt.Comment = comment;
evnt.CancelDate = TimeProvider.Now;
// if event is loan close event, we delete it first
if (evnt is LoanCloseEvent)
{
_ePs.CancelFireEvent(evnt, sqlTransaction, contract, contract.Product.Currency.Id);
evnt.Deleted = true;
evnt = contract.GetLastNonDeletedEvent();
if (pClient is Person)
evnt.ClientType = OClientTypes.Person;
else if (pClient is Group)
evnt.ClientType = OClientTypes.Group;
else if (pClient is Corporate)
evnt.ClientType = OClientTypes.Corporate;
else if (pClient is Village)
evnt.ClientType = OClientTypes.Village;
evnt.Comment = comment;
evnt.CancelDate = TimeProvider.Now;
}
_ePs.CancelFireEvent(evnt, sqlTransaction, contract, contract.Product.Currency.Id);
_ePs.UpdateCommentForLoanEvent(evnt, sqlTransaction);
evnt.Deleted = true;
//in case total repayment there could be several rep events
foreach (RepaymentEvent evt in contract.Events.GetRepaymentEvents())
{
if ((evt.ParentId == evnt.ParentId && evnt.ParentId != null) || (evt.Id == evnt.ParentId))
{
evt.Deleted = true;
evt.Comment = evnt.Comment;
_ePs.UpdateCommentForLoanEvent(evt, sqlTransaction);
}
}
if (evnt.Code == "ATR" || evnt.Code == "RBLE")
{
foreach (Event cie in contract.Events)
{
if (cie is CreditInsuranceEvent)
if (cie.Deleted == false && cie.Code == "LCIP")
{
_ePs.CancelFireEvent(cie, sqlTransaction, contract, contract.Product.Currency.Id);
cie.Deleted = true;
}
}
}
cancelledEvent = evnt;
// Restore the installment status.
UnarchiveInstallments(contract, cancelledEvent, sqlTransaction);
contract.InstallmentList = _instalmentManager.SelectInstallments(contract.Id, sqlTransaction);
contract.GivenTranches = _loanManager.SelectTranches(contract.Id, sqlTransaction);
contract.NbOfInstallments = contract.InstallmentList.Count;
foreach (Installment installment in contract.InstallmentList)
{
installment.OLB = contract.CalculateExpectedOlb(installment.Number, true);
}
if (evnt is LoanDisbursmentEvent)
{
contract.Disbursed = false;
}
//.........这里部分代码省略.........