Ejemplo n.º 1
0
        private void ValidateIfExists(BankTransactionRule entity)
        {
            var exists = ruleRepository.Table.Any(q => q.Description == entity.Description);

            if (exists)
            {
                throw new Exception(string.Format("Rule for '{0}' already exists.", entity.Description));
            }
        }
Ejemplo n.º 2
0
 private TransactionRule MapToModel(BankTransactionRule table)
 {
     return(new TransactionRule()
     {
         RuleID = table.RuleID,
         Description = table.Description,
         Tag = table.Tag,
         TagGroup = table.TagGroup,
         IsTransfer = table.IsTransfer
     });
 }
Ejemplo n.º 3
0
        private void ApplyRuleToExistingTransactions(BankTransactionRule entity)
        {
            var transactionList = transactionRepository.Table.Where(q => string.IsNullOrEmpty(q.Tag) &&
                                                                    string.IsNullOrEmpty(q.TagGroup) &&
                                                                    q.Description.ToUpper().Contains(entity.Description.ToUpper())
                                                                    ).ToList();

            foreach (var transaction in transactionList)
            {
                transaction.Tag        = entity.Tag;
                transaction.TagGroup   = entity.TagGroup;
                transaction.IsTransfer = entity.IsTransfer;

                transactionRepository.Update(transaction);
            }
        }