예제 #1
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(AccountType type, OfxSection section)
        {
            string xpath, accountInfo;

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

            case AccountType.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);
            }
        }
예제 #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 static 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);
            }
        }