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; }
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; }
public abstract RuleResult Run(Transaction transaction);
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>(); }
public abstract IEnumerable<RuleResult> Run(Transaction transaction, IOrderedEnumerable<Transaction> transactions);