当前位置: 首页>>代码示例>>C#>>正文


C# IAccount.IsAssetAccount方法代码示例

本文整理汇总了C#中IAccount.IsAssetAccount方法的典型用法代码示例。如果您正苦于以下问题:C# IAccount.IsAssetAccount方法的具体用法?C# IAccount.IsAssetAccount怎么用?C# IAccount.IsAssetAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAccount的用法示例。


在下文中一共展示了IAccount.IsAssetAccount方法的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?
 }
开发者ID:tkrehbiel,项目名称:UvMoney,代码行数:13,代码来源:XmlDataProvider.cs

示例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;
        }
开发者ID:tkrehbiel,项目名称:UvMoney,代码行数:54,代码来源:XmlDataProvider.cs

示例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." );
        }
开发者ID:tkrehbiel,项目名称:UvMoney,代码行数:29,代码来源:SqlStorage.cs


注:本文中的IAccount.IsAssetAccount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。