本文整理汇总了C#中IAccount.SumTransactions方法的典型用法代码示例。如果您正苦于以下问题:C# IAccount.SumTransactions方法的具体用法?C# IAccount.SumTransactions怎么用?C# IAccount.SumTransactions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAccount
的用法示例。
在下文中一共展示了IAccount.SumTransactions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateInterest
public decimal CalculateInterest(IAccount account)
{
var amount = account.SumTransactions();
if (amount <= 0)
return 0;
return amount * 0.001m;
}
示例2: CalculateInterest
public decimal CalculateInterest(IAccount account)
{
var amount = account.SumTransactions();
if (amount <= 0)
return 0;
if (amount <= 1000)
return amount * 0.001m;
else
return 1 + (amount - 1000) * 0.002m;
}
示例3: CalculateInterest
public decimal CalculateInterest(IAccount account)
{
var amount = account.SumTransactions();
if (amount <= 0)
return 0;
DateTime tenDaysPrior = DateTime.Now.AddDays(-10);
bool hasWithdrawalsInTenDaysPrior = account.Transactions.Any(t =>
t.transactionType == Model.TransactionTypes.Withdrawal
&& t.transactionDate >= tenDaysPrior);
if (hasWithdrawalsInTenDaysPrior)
return amount * 0.001m;
return amount * 0.05m;
}