public override RuleResult Run(Transaction transaction)
        {
            var descriptionContainsTerm = false;

            switch (Location)
            {
                case TextLookup.StartsWith:
                    descriptionContainsTerm = Terms.Any(transaction.Description.StartsWithFragment);
                    break;
                case TextLookup.EndsWith:
                    descriptionContainsTerm = Terms.Any(transaction.Description.EndWithFragment);
                    break;
                case TextLookup.Entire:
                    descriptionContainsTerm = Terms.Any(transaction.Description.IsFragment);
                    break;
                case TextLookup.ContainsWord:
                    descriptionContainsTerm = Terms.Any(transaction.Description.ContainsFragmentAsWord);
                    break;
                default:
                    descriptionContainsTerm = Terms.Any(transaction.Description.ContainsFragment);
                    break;
            }

            if (descriptionContainsTerm)
            {
                return new RuleResult(new TypeWeighting(SuggestedType, Weighting));
            }

            return null;
        }
Example #2
0
        private RulesOutcome RunPointRules(Transaction transaction, RulesOutcome ruleOutcome)
        {
            foreach (var pointRule in pointRules)
            {
                ruleOutcome.Add(pointRule.Run(transaction));
            }

            return ruleOutcome;
        }
        public static string GetPaymentUrl(Transaction idealPayer, string mollieClientNumber, bool testMode, string paymentName, string reportUrl, string landUrl)
        {
            if(idealPayer.Payed)
                throw new Exception("Er is al betaald");

            IdealFetch idealFetch = new IdealFetch(mollieClientNumber, testMode, paymentName, reportUrl, landUrl, idealPayer.BankId, idealPayer.Amount);

            if (idealFetch.Error)
            {
                throw new Exception(idealFetch.ErrorMessage);
            }

            idealPayer.TransactionId = idealFetch.TransactionId;
            using( TransactionScope transactionScope = new TransactionScope(TransactionMode.Inherits, OnDispose.Rollback))
            {
                idealPayer.Save();
                transactionScope.VoteCommit();
            }

            return idealFetch.Url;
        }
Example #4
0
 public abstract RuleResult Run(Transaction transaction);
Example #5
0
 private void LineExplorer(string line)
 {
     if (Regex.Match(line, "[0-9]").Success)
     {
         var valies = line.Split('\t');
         var transaction = new Transaction();
         transaction.RegistrationDate = valies[0].ToNullableDateTime();
         transaction.TransactionDate = valies[1].ToNullableDateTime();
         transaction.TransactionNumber = valies[2];
         transaction.TransactionCode = valies[3];
         transaction.CurrencyType = GetCurrencyType(valies[4]);
         transaction.Value = Convert.ToDecimal(valies[5]);
         Dao.SaveOrUpdate(transaction);
     }
 }
 public RulesOutcome(Transaction transaction)
 {
     Transaction = transaction;
     Results = new List<RuleResult>();
 }
Example #7
0
 public abstract IEnumerable<RuleResult> Run(Transaction transaction,
     IOrderedEnumerable<Transaction> transactions);