Ejemplo n.º 1
0
        /// <summary>
        /// Returns list of all transactions in OFX document
        /// </summary>
        /// <param name="doc">OFX document</param>
        /// <returns>List of transactions found in OFX document</returns>
        public override void ImportTransactions(OFXDocumentParser parser, OFXDocument ofx, XmlDocument doc)
        {
            XmlNodeList transactionNodes = null;
            var         xpath            = parser.GetXPath(AccountType, OFXDocumentParser.OFXSection.TRANSACTIONS);

            ofx.StatementStart = doc.GetValue(xpath + "//DTSTART").ToDate();
            ofx.StatementEnd   = doc.GetValue(xpath + "//DTEND").ToDate();

            transactionNodes = doc.SelectNodes(xpath + "//STMTTRN");

            foreach (XmlNode node in transactionNodes)
            {
                Transactions.Add(new BankTransaction(node, ofx.Currency));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns list of all transactions in OFX document
        /// </summary>
        /// <param name="doc">OFX document</param>
        /// <returns>List of transactions found in OFX document</returns>
        public override void ImportTransactions(OFXDocumentParser parser, OFXDocument ofx, XmlDocument doc)
        {
            XmlNodeList transactionNodes = null;
            var         xpath            = parser.GetXPath(ofx.AccType, OFXDocumentParser.OFXSection.TRANSACTIONS);

            ofx.StatementStart = doc.GetValue(xpath + "//DTSTART").ToDate();
            ofx.StatementEnd   = doc.GetValue(xpath + "//DTEND").ToDate();

            //Import Income Transactions
            transactionNodes = doc.SelectNodes(xpath + "//INCOME");
            foreach (XmlNode node in transactionNodes)
            {
                Transactions.Add(new IncomeTransaction(node, ofx.Currency));
            }

            //Import Cash Transfer Transactions
            transactionNodes = doc.SelectNodes(xpath + "//INVBANKTRAN");
            foreach (XmlNode node in transactionNodes)
            {
                Transactions.Add(new InvestmentTransferTransaction(node, ofx.Currency));
            }

            //Import Stock Transfer Transactions
            transactionNodes = doc.SelectNodes(xpath + "//TRANSFER");
            foreach (XmlNode node in transactionNodes)
            {
                Transactions.Add(new StockTransferTransaction(node, ofx.Currency));
            }

            //Import Buy Stock Transactions
            transactionNodes = doc.SelectNodes(xpath + "//BUYSTOCK");
            foreach (XmlNode node in transactionNodes)
            {
                Transactions.Add(new BuySellStockTransaction(node, ofx.Currency));
            }

            //Import Buy Option Transactions
            transactionNodes = doc.SelectNodes(xpath + "//BUYOPT");
            foreach (XmlNode node in transactionNodes)
            {
                Transactions.Add(new BuySellStockOptionTransaction(node, ofx.Currency));
            }

            //Import Sell Stock Transactions
            transactionNodes = doc.SelectNodes(xpath + "//SELLSTOCK");
            foreach (XmlNode node in transactionNodes)
            {
                Transactions.Add(new BuySellStockTransaction(node, ofx.Currency));
            }

            //Import Buy Option Transactions
            transactionNodes = doc.SelectNodes(xpath + "//SELLOPT");
            foreach (XmlNode node in transactionNodes)
            {
                Transactions.Add(new BuySellStockOptionTransaction(node, ofx.Currency));
            }

            //Import Sell Other Stock Transactions
            transactionNodes = doc.SelectNodes(xpath + "//SELLOTHER");
            foreach (XmlNode node in transactionNodes)
            {
                Transactions.Add(new BuySellStockTransaction(node, ofx.Currency));
            }
        }