public OFXAccount(XmlNode node, OFXAccountType type)
        {
            AccountType = type;

            AccountID  = node.GetValue("//ACCTID");
            AccountKey = node.GetValue("//ACCTKEY");

            switch (AccountType)
            {
            case OFXAccountType.BANK:
                InitializeBank(node);
                break;

            case OFXAccountType.AP:
                InitializeAP(node);
                break;

            case OFXAccountType.AR:
                InitializeAR(node);
                break;

            default:
                break;
            }
        }
示例#2
0
        /// <summary>
        /// Returns the correct xpath to specified section for given account type
        /// </summary>
        /// <param name="type">Account type</param>
        /// <param name="section">Section of OFX document, e.g. Transaction Section</param>
        /// <exception cref="OFXException">Thrown in account type not supported</exception>
        private string GetXPath(OFXAccountType type, OFXSection section)
        {
            string xpath, accountInfo;

            switch (type)
            {
            case OFXAccountType.BANK:
                xpath       = Resources.BankAccount;
                accountInfo = "/BANKACCTFROM";
                break;

            case OFXAccountType.CC:
                xpath       = Resources.CCAccount;
                accountInfo = "/CCACCTFROM";
                break;

            default:
                throw new OFXException("Account Type not supported. Account type " + type);
            }

            switch (section)
            {
            case OFXSection.ACCOUNTINFO:
                return(xpath + accountInfo);

            case OFXSection.BALANCE:
                return(xpath);

            case OFXSection.TRANSACTIONS:
                return(xpath + "/BANKTRANLIST");

            case OFXSection.SIGNON:
                return(Resources.SignOn);

            case OFXSection.CURRENCY:
                return(xpath + "/CURDEF");

            default:
                throw new OFXException("Unknown section found when retrieving XPath. Section " + section);
            }
        }