本文整理汇总了C#中ISavingsContract.ChargeOverdraftFee方法的典型用法代码示例。如果您正苦于以下问题:C# ISavingsContract.ChargeOverdraftFee方法的具体用法?C# ISavingsContract.ChargeOverdraftFee怎么用?C# ISavingsContract.ChargeOverdraftFee使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISavingsContract
的用法示例。
在下文中一共展示了ISavingsContract.ChargeOverdraftFee方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Withdraw
public List<SavingEvent> Withdraw(ISavingsContract pSaving, DateTime pDate, OCurrency pWithdrawAmount,
string pDescription, User pUser, Teller teller, SqlTransaction sqlTransaction, PaymentMethod paymentMethod)
{
ValidateWithdrawal(pWithdrawAmount, pSaving, pDate, pDescription, pUser, teller, paymentMethod);
List<SavingEvent> events = pSaving.Withdraw(pWithdrawAmount, pDate, pDescription, pUser, false, teller, paymentMethod);
foreach (SavingEvent savingEvent in events)
{
_ePS.FireEvent(savingEvent, pSaving, sqlTransaction);
}
// Charge overdraft fees if the balance is negative
if (pSaving is SavingBookContract)
{
if (pSaving.GetBalance() < 0 && !((SavingBookContract)pSaving).InOverdraft)
{
SavingEvent overdraftFeeEvent = pSaving.ChargeOverdraftFee(pDate, pUser);
_ePS.FireEvent(overdraftFeeEvent, pSaving, sqlTransaction);
((SavingBookContract)pSaving).InOverdraft = true;
UpdateOverdraftStatus(pSaving.Id, true);
}
}
return events;
}
示例2: Withdraw
/// <summary>
/// Checks DepositAmount and balance simulation
/// </summary>
/// <param name="pSaving"></param>
/// <param name="pDate"></param>
/// <param name="pWithdrawAmount"></param>
/// <param name="pDescription"></param>
/// <param name="pUser"></param>
/// <returns></returns>
public List<SavingEvent> Withdraw(ISavingsContract pSaving, DateTime pDate, OCurrency pWithdrawAmount, string pDescription, User pUser, Teller teller)
{
ValidateWithdrawal(pWithdrawAmount, pSaving, pDate, pDescription, pUser, teller);
List<SavingEvent> events = pSaving.Withdraw(pWithdrawAmount, pDate, pDescription, pUser, false, teller);
using (SqlConnection conn = _savingManager.GetConnection())
using (SqlTransaction sqlTransaction = conn.BeginTransaction())
{
try
{
foreach (SavingEvent savingEvent in events)
{
_ePS.FireEvent(savingEvent, pSaving, sqlTransaction);
}
// Charge overdraft fees if the balance is negative
if (pSaving is SavingBookContract)
{
if (pSaving.GetBalance() < 0 && !((SavingBookContract) pSaving).InOverdraft)
{
SavingEvent overdraftFeeEvent = pSaving.ChargeOverdraftFee(pDate, pUser);
_ePS.FireEvent(overdraftFeeEvent, pSaving, sqlTransaction);
((SavingBookContract) pSaving).InOverdraft = true;
UpdateOverdraftStatus(pSaving.Id, true);
}
}
sqlTransaction.Commit();
return events;
}
catch (Exception)
{
sqlTransaction.Rollback();
throw;
}
}
}