public void AddSingletonTransaction(int transactionTypeId, AccountTransactionType template, IEnumerable <AccountData> accountDataList)
 {
     if (AccountTransactions.SingleOrDefault(x => x.AccountTransactionTypeId == transactionTypeId) == null)
     {
         AddNewTransaction(template, accountDataList);
     }
 }
        public static AccountTransaction Create(AccountTransactionType template, IEnumerable <AccountData> accountDataList)
        {
            var result = Create(template);

            result.UpdateAccounts(accountDataList);
            return(result);
        }
        public AccountTransaction AddNewTransaction(AccountTransactionType template, IEnumerable <AccountData> accountDataList)
        {
            var transaction = AccountTransaction.Create(template, accountDataList);

            AccountTransactions.Add(transaction);
            return(transaction);
        }
        public static AccountTransaction Create(AccountTransactionType template)
        {
            // <pex>
            if (template == null)
            {
                throw new ArgumentNullException("template");
            }
            // </pex>

            var result = new AccountTransaction
            {
                Name = template.Name,
                AccountTransactionTypeId = template.Id,
                SourceTransactionValue   = new AccountTransactionValue {
                    AccountId = template.DefaultSourceAccountId, AccountTypeId = template.SourceAccountTypeId, Name = template.Name
                },
                TargetTransactionValue = new AccountTransactionValue {
                    AccountId = template.DefaultTargetAccountId, AccountTypeId = template.TargetAccountTypeId, Name = template.Name
                },
                SourceAccountTypeId = template.SourceAccountTypeId,
                TargetAccountTypeId = template.TargetAccountTypeId
            };


            return(result);
        }
        public AccountTransaction AddNewTransaction(AccountTransactionType template, IEnumerable <AccountData> accountDataList, decimal amount, decimal exchangeRate)
        {
            var transaction = AccountTransaction.Create(template, accountDataList);

            transaction.UpdateAmount(amount, exchangeRate);
            AccountTransactions.Add(transaction);
            return(transaction);
        }