本文整理汇总了C#中IAccount.IsLiabilityAccount方法的典型用法代码示例。如果您正苦于以下问题:C# IAccount.IsLiabilityAccount方法的具体用法?C# IAccount.IsLiabilityAccount怎么用?C# IAccount.IsLiabilityAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAccount
的用法示例。
在下文中一共展示了IAccount.IsLiabilityAccount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBalance
public decimal GetBalance( IAccount account, DateTime asOfDate, bool reconciledOnly )
{
if( account.IsAssetAccount() )
return account.StartingBalance
+ this.GetDebits( account, asOfDate, reconciledOnly )
- this.GetCredits( account, asOfDate, reconciledOnly );
else if( account.IsLiabilityAccount() )
return account.StartingBalance
+ this.GetCredits( account, asOfDate, reconciledOnly )
- this.GetDebits( account, asOfDate, reconciledOnly );
else
return 0; // TODO: Should throw error?
}
示例2: GetPotentialMatchingLineItems
/// <summary>
/// Get all potential matching line items for the given record.
/// It is assumed the caller will prune down the list even more.
/// </summary>
/// <param name="account"></param>
/// <param name="record"></param>
/// <returns></returns>
public IEnumerable<ILineItem> GetPotentialMatchingLineItems( IAccount account, IOnlineRecord record )
{
TransactionType searchType;
if( account.IsAssetAccount() )
{
if( record.Amount < 0 ) searchType = TransactionType.Credit;
else searchType = TransactionType.Debit;
}
else if( account.IsLiabilityAccount() )
{
if( record.Amount < 0 ) searchType = TransactionType.Debit;
else searchType = TransactionType.Credit;
}
else
throw new DataProviderException( "Unsupported account type " + account.AccountType.ToString() );
List<ILineItem> matches = new List<ILineItem>();
foreach( XmlLineItem item in this.lineItems.Values )
{
// Ensure is from the right account
if( item.AccountId != account.Id ) continue;
// Don't match unless it is the right type of transaction.
if( item.TransactionType != searchType ) continue;
// Never match a reconciled line item
if( item.IsReconciled ) continue;
// Never match a voided line item
if( item.IsVoided ) continue;
// Don't match a line item which was already matched to something
if( item.OnlineRecordId != null ) continue;
// If amounts are the same, it could be a match.
if( item.Amount != Math.Abs( record.Amount ) ) continue;
// But...
// Online transaction must be later than or same date as transaction
if( record.Date < item.TransactionDate ) continue;
// If passed tests above, add to list of matches.
matches.Add( item );
}
return matches;
}
示例3: GetBalanceForward
/// <summary>
/// Gets the balance forward of the account,
/// as of the start of the given day.
/// </summary>
/// <param name="account">Account object.</param>
/// <param name="asOfDate">Date for which to compute balance. Time is not used.</param>
/// <returns></returns>
public decimal GetBalanceForward( IAccount account, DateTime asOfDate )
{
if( asOfDate < account.StartingDate )
throw new ArgumentOutOfRangeException( "Date must be after account starting date." );
decimal credits = Convert.ToDecimal(
ExecuteScalar( "SELECT SUM([Amount]) FROM [{0}]" +
"WHERE AccountID={1} AND TransactionType='C' AND TransactionDate<'{2:M/d/yyyy}'",
accountTemplate.TableName, account.Id, asOfDate )
);
decimal debits = Convert.ToDecimal(
ExecuteScalar( "SELECT SUM([Amount]) FROM [{0}]" +
"WHERE AccountID={1} AND TransactionType='D' AND TransactionDate<'{2:M/d/yyyy}'",
accountTemplate.TableName, account.Id, asOfDate )
);
if( account.IsAssetAccount() )
return account.StartingBalance + debits - credits;
else if( account.IsLiabilityAccount() )
return account.StartingBalance + credits - debits;
else
throw new ArgumentException( account.Name + " is not a balance account." );
}