Exemplo n.º 1
0
        public bool IsMatch(IImportRow importRow)
        {
            switch (Direction)
            {
                case EntryType.NotSpecified:
                    return Amount == Math.Abs(importRow.Amount);

                case EntryType.Debit:
                    return Amount == importRow.Amount;

                case EntryType.Credit:
                    return Amount == -importRow.Amount;

                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 2
0
        private Transaction AsTransaction(IImportRow row, Account account, string description)
        {
            var transaction = row.Amount > 0
                ? new Transaction(Credit, account, row.Amount)
                : new Transaction(account, Credit, -row.Amount);

            transaction.Date = row.Date;
            transaction.Description = description ?? row.Description;
            transaction.Reference = row.Id;

            Result.TransactionCount++;
            if ( account == UnclassifedDestination )
            {
                Result.UnclassifiedTransactions++;
            }

            return transaction;
        }
Exemplo n.º 3
0
 public bool IsMatch(IImportRow importRow)
 {
     var amount = Math.Abs(importRow.Amount);
     return amount >= Min && amount <= Max;
 }
Exemplo n.º 4
0
 public bool IsMatch(IImportRow importRow)
 {
     var value = importRow.Properties.SingleOrDefault(x => x.Key == Name);
     return value.Value != null && Regex.IsMatch(value.Value.Trim());
 }
Exemplo n.º 5
0
 public bool IsMatch(IImportRow importRow)
 {
     return DaysOfMonth.Any(x => importRow.Date.Day == x);
 }
Exemplo n.º 6
0
 public bool IsMatch(IImportRow row)
 {
     return Pattern.IsMatch(row);
 }
Exemplo n.º 7
0
        private IImportRow BuildId(IImportRow row, int rowId)
        {
            if ( row.Id == null )
            {
                row.Id = Name == null
                         	? rowId.ToString(CultureInfo.InvariantCulture)
                         	: string.Concat(Name, '/', rowId);
            }

            return row;
        }
Exemplo n.º 8
0
        private Account GetAccount(IImportRow row)
        {
            if ( _mappings == null )
            {
                return null;
            }

            ImportRowOptions options;
            return _mappings.TryGetValue(row.Id, out options)
                ? _context.General[options.Account]
                : null;
        }
Exemplo n.º 9
0
        private string GetDescription(IImportRow row)
        {
            if ( _mappings == null )
            {
                return null;
            }

            ImportRowOptions options;
            return _mappings.TryGetValue(row.Id, out options)
                ? options.Description
                : null;
        }