private OFXTransaction GetOFXTransactionInstance(Match transactionMatch)
        {
            var transaction    = transactionMatch.Value;
            var ofxTransaction = new OFXTransaction
            {
                DateTime    = GetTransactionDateTime(transaction),
                Description = GetTransactionDescription(transaction),
                Type        = GetTransactionType(transaction),
                Value       = GetTransactionValue(transaction)
            };

            return(ofxTransaction);
        }
Пример #2
0
        private Transaction GenereteInput(OFXTransaction ofxTransaction)
        {
            int year   = int.Parse(ofxTransaction.DatePosted.Substring(0, 4));
            int month  = int.Parse(ofxTransaction.DatePosted.Substring(4, 2));
            int day    = int.Parse(ofxTransaction.DatePosted.Substring(6, 2));
            int hour   = int.Parse(ofxTransaction.DatePosted.Substring(8, 2));
            int minute = int.Parse(ofxTransaction.DatePosted.Substring(10, 2));
            int second = int.Parse(ofxTransaction.DatePosted.Substring(12, 2));

            DateTime datePosted = new DateTime(year, month, day, hour, minute, second);
            decimal  amount     = decimal.Parse(ofxTransaction.Amount.Replace(".", ","));

            Transaction transaction = new Transaction(this.BankId,
                                                      this.AccountNumber,
                                                      this.AccountType,
                                                      ofxTransaction.Type,
                                                      datePosted,
                                                      amount,
                                                      ofxTransaction.Memo);

            return(transaction);
        }
Пример #3
0
        private void FindTransactionsInFile()
        {
            int indexCursorTransactions = 0;
            int index = 0;

            while (index >= 0)
            {
                index = OFXStream.IndexOf("<STMTTRN>", indexCursorTransactions);

                if (index > 0)
                {
                    OFXTransaction transaction =
                        new OFXTransaction(this.GetTagValue("<TRNTYPE>", index),
                                           this.GetTagValue("<DTPOSTED>", index),
                                           this.GetTagValue("<TRNAMT>", index),
                                           this.GetTagValue("<MEMO>", index));

                    this.OFXTransactions.Add(transaction);
                    indexCursorTransactions = index + 1;
                }
            }
        }