本文整理汇总了C#中OpenCBS.CoreDomain.Contracts.Savings.SavingBookContract类的典型用法代码示例。如果您正苦于以下问题:C# SavingBookContract类的具体用法?C# SavingBookContract怎么用?C# SavingBookContract使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SavingBookContract类属于OpenCBS.CoreDomain.Contracts.Savings命名空间,在下文中一共展示了SavingBookContract类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateInterest_AccrualhMode_Daily_EndOfYear_OneClosure_AfterOneWeek_Agio
public void CalculateInterest_AccrualhMode_Daily_EndOfYear_OneClosure_AfterOneWeek_Agio()
{
Assert.Ignore();
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual);
_bookProduct.InterestFrequency = OSavingInterestFrequency.EndOfYear;
SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
new DateTime(2009, 01, 01), null) { Product = _bookProduct, InterestRate = 0.1, AgioFees = 0.1 };
saving.Closure(new DateTime(2009, 01, 08), new User() { Id = 1 });
int accrualEvents = saving.Events.FindAll(item => item is SavingInterestsAccrualEvent).Count;
int postingEvents = saving.Events.FindAll(items => items is SavingInterestsPostingEvent).Count;
List<SavingEvent> agioEvents = saving.Events.FindAll(items => items is SavingAgioEvent);
Assert.AreEqual(agioEvents.Count, 7);
Assert.AreEqual(agioEvents[0].Fee, 10);
Assert.AreEqual(saving.GetBalance(), -170);
// saving.Deposit(200, new DateTime(2009, 01, 08), "depot", new User(), false, false, OPaymentMethods.Cash, null, null);
saving.Deposit(200, new DateTime(2009, 01, 08), "depot", new User(), false, false, OSavingsMethods.Cash, null, null);
//saving.Withdraw(230, new DateTime(2009, 02, 03), "retrait", new User(), false);
saving.Closure(new DateTime(2009, 01, 15), new User() { Id = 1 });
List<SavingEvent> agioEvents2 = saving.Events.FindAll(items => items is SavingAgioEvent);
Assert.AreEqual(agioEvents2.Count, 13);
Assert.AreEqual(agioEvents2[9].Fee, 13);
Assert.AreEqual(saving.GetBalance(), -51);
}
示例2: CalculateInterest_AccrualhMode_Daily_EndOfYear_OneClosure_AfterOneWeek
public void CalculateInterest_AccrualhMode_Daily_EndOfYear_OneClosure_AfterOneWeek()
{
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual);
_product.InterestFrequency = OSavingInterestFrequency.EndOfYear;
SavingBookContract saving =
new SavingBookContract(
ApplicationSettings.GetInstance(""),
new User(),
new DateTime(2009, 01, 01),
null)
{
Product = _product,
InterestRate = 0.1,
AgioFees = 8
};
saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);
saving.Closure(new DateTime(2009, 01, 08), new User() { Id = 1 });
int accrualEvents = saving.Events.FindAll(item => item is SavingInterestsAccrualEvent).Count;
int postingEvents = saving.Events.FindAll(items => items is SavingInterestsPostingEvent).Count;
Assert.AreEqual(7, accrualEvents);
Assert.AreEqual(0, postingEvents);
Assert.AreEqual(1000m, saving.GetBalance().Value);
}
示例3: PostingInterests_NoPosting
public void PostingInterests_NoPosting()
{
// Assert.Ignore();
SavingsBookProduct product = new SavingsBookProduct
{
Id = 1,
InterestBase = OSavingInterestBase.Daily,
InterestFrequency = OSavingInterestFrequency.EndOfYear,
Periodicity = new InstallmentType("Yearly", 0, 12)
};
SavingBookContract saving = new SavingBookContract(
ApplicationSettings.GetInstance(""),
new User(),
new DateTime(2009, 01, 01),
null)
{
Product = product,
InterestRate = 0.1,
NextMaturity = new DateTime(2009, 01, 01)
};
List<SavingInterestsPostingEvent> list = new List<SavingInterestsPostingEvent>();
list = saving.PostingInterests(new DateTime(2009, 02, 01), new User { Id = 1 });
Assert.AreEqual(list.Count, 0);
}
示例4: PostingInterests_OnePosting
public void PostingInterests_OnePosting()
{
SavingsBookProduct product = new SavingsBookProduct
{
Id = 1,
InterestBase = OSavingInterestBase.Daily,
InterestFrequency = OSavingInterestFrequency.EndOfDay,
Periodicity = new InstallmentType("Daily", 1, 0)
};
SavingBookContract saving = new SavingBookContract(
ApplicationSettings.GetInstance(""),
new User(),
new DateTime(2009, 01, 01), null)
{
Product = product,
InterestRate = 0.1
};
saving.NextMaturity = saving.CreationDate;
List<SavingInterestsPostingEvent> list = new List<SavingInterestsPostingEvent>();
list = saving.PostingInterests(
saving.NextMaturity.Value,
new User { Id = 1 }
);
Assert.AreEqual(1, list.Count);
}
示例5: PostingInterests_12Posting
public void PostingInterests_12Posting()
{
// Assert.Ignore();
SavingsBookProduct product = new SavingsBookProduct
{
Id = 1,
InterestBase = OSavingInterestBase.Daily,
InterestFrequency = OSavingInterestFrequency.EndOfMonth,
Periodicity = new InstallmentType("Monthly", 0, 1)
};
User user = new User() {Id = 1};
DateTime creationDate = new DateTime(2009, 01, 01);
SavingBookContract saving = new SavingBookContract(
ApplicationSettings.GetInstance(""),
user,
creationDate,
null
)
{
Product = product,
InterestRate = 0.1
};
DateTime closureDate = new DateTime(2010, 01, 01);
saving.NextMaturity = saving.CreationDate.Date;
saving.NumberOfPeriods = 1;
saving.FirstDeposit(1000, creationDate, 0, user, new Teller());
saving.NextMaturity = DateCalculationStrategy.GetNextMaturity(
saving.CreationDate.Date,
saving.Product.Periodicity,
saving.NumberOfPeriods);
List<SavingInterestsAccrualEvent> interestsAccrualEvents =
saving.CalculateInterest(closureDate, new User {Id = 1});
foreach (var accrualEvent in interestsAccrualEvents)
{
saving.Events.Add(accrualEvent);
}
List<SavingInterestsPostingEvent> list = new List<SavingInterestsPostingEvent>();
List<SavingInterestsPostingEvent> postingEvents = new List<SavingInterestsPostingEvent>();
while (saving.NextMaturity.Value <= closureDate)
{
list = saving.PostingInterests(saving.NextMaturity.Value, new User() {Id = 1});
postingEvents.AddRange(list);
foreach (var postingEvent in list)
{
saving.Events.Add(postingEvent);
}
saving.NextMaturity = DateCalculationStrategy.GetNextMaturity(saving.NextMaturity.Value, saving.Periodicity, 1);
}
list = saving.PostingInterests(new DateTime(2010, 01, 01), new User { Id = 1 });
Assert.AreEqual(12, postingEvents.Count);
}
示例6: CalculateInterest_NoDay
public void CalculateInterest_NoDay()
{
SavingsBookProduct product = new SavingsBookProduct
{
Id = 1,
InterestBase = OSavingInterestBase.Daily,
InterestFrequency = OSavingInterestFrequency.EndOfYear
};
SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
new DateTime(2009, 07, 01), null) { Product = product, InterestRate = 0.1 };
List<SavingInterestsAccrualEvent> list = new List<SavingInterestsAccrualEvent>();
list = saving.CalculateInterest(new DateTime(2009, 07, 01), new User { Id = 1 });
Assert.AreEqual(list.Count, 0);
}
示例7: Init
public void Init(IClient client, Loan loan, Guarantee guarantee, SavingBookContract savings, IList<IPrintButtonContextMenuStrip> printMenus)
{
_printButton.AttachmentPoint = AttachmentPoint.CreditCommittee;
Visibility visibility;
switch (client.Type)
{
case OClientTypes.Person:
visibility = Visibility.Individual;
break;
case OClientTypes.Group:
visibility = Visibility.Group;
break;
case OClientTypes.Corporate:
visibility = Visibility.Corporate;
break;
default:
visibility = Visibility.All;
break;
}
_printButton.Visibility = visibility;
_printButton.ReportInitializer =
report =>
{
report.SetParamValue("user_id", User.CurrentUser.Id);
if (loan != null) report.SetParamValue("contract_id", loan.Id);
};
_printButton.LoadReports();
foreach (var item in printMenus)
{
var menuItems = item.GetContextMenuStrip(client, loan, guarantee, savings, AttachmentPoint.CreditCommittee.ToString());
if (menuItems == null) continue;
foreach (var menuItem in menuItems)
{
_printButton.Menu.Items.Add(menuItem);
}
}
}
示例8: AddSavingBook
public void AddSavingBook()
{
SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
new User() { Id = 1 }, new DateTime(2009, 01, 01), _savingsBookProduct, null)
{
Code = "S/CR/2009/SAVIN-1/BAR-1", Status = OSavingsStatus.Active, InterestRate = 0.01, FlatWithdrawFees = 3, FlatTransferFees = 3
};
saving.InitialAmount = 1000;
saving.EntryFees = 10;
saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);
User user = new User {Id = 1};
saving.Events[0].User = user;
saving.Events[0].Id = 400;
saving.SavingsOfficer = user;
saving.Id = _savingManager.Add(saving, new Person { Id = 6 });
_savingEventManager.Add(saving.Events[0], saving.Id);
SavingBookContract retrievedSaving = (SavingBookContract)_savingManager.Select(saving.Id);
_compareSavings(saving, retrievedSaving);
}
示例9: SetUp
public void SetUp()
{
ApplicationSettings dataParam = ApplicationSettings.GetInstance("");
dataParam.DeleteAllParameters();
dataParam.AddParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash);
Currency currency = new Currency() { UseCents = true, Code = "SOM", Id = 1, IsPivot = true, Name = "SOM" };
_bookProduct = new SavingsBookProduct
{
CalculAmountBase = OSavingCalculAmountBase.MinimalAmount,
Id = 1,
InterestBase = OSavingInterestBase.Daily,
InterestFrequency = OSavingInterestFrequency.EndOfWeek,
ManagementFeeFreq = new InstallmentType
{
Id = 1,
Name = "Monthly",
NbOfDays = 0,
NbOfMonths = 1
},
AgioFeesFreq = new InstallmentType
{
Id = 2,
Name = "Daily",
NbOfDays = 1,
NbOfMonths = 0
},
WithdrawFeesType = OSavingsFeesType.Flat,
FlatWithdrawFees = 0,
Currency = currency
};
_saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
new User(),
new DateTime(2007, 08, 11), _bookProduct, null);
}
示例10: Create_Saving_Book_Account_With_EntryFees
public void Create_Saving_Book_Account_With_EntryFees()
{
SavingsBookProduct product = new SavingsBookProduct()
{
Name = "NewSavingProduct",
InitialAmountMin = 1000,
InitialAmountMax = 2000,
DepositMin = 100,
DepositMax = 200,
WithdrawingMin = 100,
WithdrawingMax = 200,
InterestRate = 0.2,
BalanceMin = 1000,
BalanceMax = 2000,
InterestBase = OSavingInterestBase.Monthly,
InterestFrequency = OSavingInterestFrequency.EndOfYear,
CalculAmountBase = OSavingCalculAmountBase.MinimalAmount,
ClientType = OClientTypes.All,
EntryFeesMin = 5,
EntryFeesMax = 15,
Currency = new Currency { Id = 1 }
};
SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
new DateTime(2009, 01, 01), product, null);
saving.InitialAmount = 1000;
saving.EntryFees = 10;
saving.FirstDeposit(1000, new DateTime(2009, 01, 01), 10, new User(), Teller.CurrentTeller);
Assert.AreEqual(saving.GetBalance(), 1000);
Assert.AreEqual(saving.Events.Count, 1);
Assert.AreEqual(saving.InitialAmount, 1000);
Assert.AreEqual(saving.EntryFees, 10);
}
示例11: RateWithdrawFees
public void RateWithdrawFees()
{
SavingsBookProduct product = new SavingsBookProduct()
{
WithdrawFeesType = OSavingsFeesType.Rate,
RateWithdrawFeesMin = 0.01,
RateWithdrawFeesMax = 0.05
};
SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(), new DateTime(2009, 01, 01), product, null) { RateWithdrawFees = 0.03 };
saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);
List<SavingEvent> withdrawEvents = saving.Withdraw(10, new DateTime(2009, 01, 02), "withdraw", new User(), false, null);
Assert.AreEqual(1, withdrawEvents.Count);
Assert.AreEqual(10, withdrawEvents[0].Amount.Value);
Assert.AreEqual(0.3, ((ISavingsFees)withdrawEvents[0]).Fee.Value);
Assert.AreEqual(989.7, saving.GetBalance().Value);
}
示例12: Charge_deposit_fees
public void Charge_deposit_fees()
{
SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
new User(), new DateTime(2009, 1, 1), null)
{
Product = _bookProduct,
AgioFees = 0.01,
ChequeDepositFees = 100,
DepositFees = 50,
CloseFees = 100,
ReopenFees = 100,
OverdraftFees = 100
};
Currency currency = new Currency() { UseCents = true, Code = "SOM", Id = 1, IsPivot = true, Name = "SOM" };
// List<SavingEvent> cashDepositEvents = saving.Deposit(100, new DateTime(2009, 1, 2), "cash deposit", new User(), false,
// false, OPaymentMethods.Cash, null, null);
List<SavingEvent> cashDepositEvents = saving.Deposit(100, new DateTime(2009, 1, 2), "cash deposit", new User(), false,
false, OSavingsMethods.Cash, null, null);
// List<SavingEvent> chequeDepositEvents = saving.Deposit(100, new DateTime(2009, 1, 2), "cheque deposit", new User(), false,
// false, OPaymentMethods.Cheque, null, null);
List<SavingEvent> chequeDepositEvents = saving.Deposit(100, new DateTime(2009, 1, 2), "cheque deposit", new User(), false,
false, OSavingsMethods.Cheque, null, null);
foreach (SavingEvent cashEvent in cashDepositEvents)
{
Assert.AreEqual(cashEvent.Fee, saving.DepositFees);
}
foreach (SavingEvent chequeEvent in chequeDepositEvents)
{
Assert.AreEqual(chequeEvent.Fee, saving.ChequeDepositFees);
}
}
示例13: Charge_reopen_fees
public void Charge_reopen_fees()
{
SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
new User(), new DateTime(2009, 1, 1), null)
{
Product = _bookProduct,
AgioFees = 0.01,
ChequeDepositFees = 100,
DepositFees = 50,
CloseFees = 100,
ReopenFees = 100,
OverdraftFees = 100
};
saving.Close(new DateTime(2009, 1, 2), new User(), "closing", false, Teller.CurrentTeller, false);
List<SavingEvent> reopenEvents = saving.Reopen(100, new DateTime(2009, 1, 3), new User(), "reopen", false);
foreach (SavingEvent reopenEvent in reopenEvents)
{
Assert.AreEqual(saving.ReopenFees, reopenEvent.Fee);
}
}
示例14: TestSavingIsValid_TransferAmountIsInvalid
public void TestSavingIsValid_TransferAmountIsInvalid()
{
Assert.Ignore();
SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(), TimeProvider.Today, null) { Id = 1, InterestRate = 0.13, Product = _savingsProduct };
SavingBookContract savingTarget = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(), TimeProvider.Today, null) { Id = 2, InterestRate = 0.13, Product = _savingsProduct };
_savingManagerMock = new DynamicMock(typeof(SavingManager));
_savingServices = new SavingServices((SavingManager)_savingManagerMock.MockInstance, null, new User { Id = 6 });
_savingManagerMock.Expect("UpdateAccountsBalance", saving, null);
_savingManagerMock.Expect("UpdateAccountsBalance", savingTarget, null);
try
{
_savingServices.Transfer(saving, savingTarget, TimeProvider.Today, 99, 0, "transfer", new User(), false);
Assert.Fail("Saving Contract shouldn't pass validation test before transfer (transfer amount < transfer.min).");
}
catch (OpenCbsSavingException exception)
{
Assert.AreEqual((int)OpenCbsSavingExceptionEnum.TransferAmountIsInvalid, (int)exception.Code);
}
_savingManagerMock.Expect("UpdateAccountsBalance", saving, null);
_savingManagerMock.Expect("UpdateAccountsBalance", savingTarget, null);
try
{
_savingServices.Transfer(saving, savingTarget, TimeProvider.Today, 301, 0, "transfer", new User(), false);
Assert.Fail("Saving Contract shouldn't pass validation test before transfer (transfer amount > transfer.max).");
}
catch (OpenCbsSavingException exception)
{
Assert.AreEqual((int)OpenCbsSavingExceptionEnum.TransferAmountIsInvalid, (int)exception.Code);
}
_savingManagerMock.Expect("UpdateAccountsBalance", saving, null);
_savingManagerMock.Expect("UpdateAccountsBalance", savingTarget, null);
try
{
_savingServices.Transfer(saving, savingTarget, TimeProvider.Today, 200, 0, "transfer", new User(), false);
Assert.Fail("Saving Contract shouldn't pass validation test before transfer (balance < balance.min).");
}
catch (OpenCbsSavingException exception)
{
Assert.AreEqual((int)OpenCbsSavingExceptionEnum.BalanceIsInvalid, (int)exception.Code);
}
}
示例15: Charge_close_reopen_fees
public void Charge_close_reopen_fees()
{
SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
new User(), new DateTime(2009, 1, 1), null)
{
Product = _bookProduct,
AgioFees = 0.01,
ChequeDepositFees = 100,
DepositFees = 50,
CloseFees = 100,
ReopenFees = 100,
OverdraftFees = 100
};
Currency currency = new Currency() { UseCents = true, Code = "SOM", Id = 1, IsPivot = true, Name = "SOM" };
List<SavingEvent> closeEvents = saving.Close(new DateTime(2009, 1, 2), new User(), "closing", false, Teller.CurrentTeller, false);
Assert.AreEqual(OSavingsStatus.Closed, saving.Status);
foreach (SavingEvent closeEvent in closeEvents)
{
Assert.AreEqual(closeEvent.Fee, saving.CloseFees);
}
}