/// <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); } }
/// <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 = "OFX/BANKMSGSRSV1/STMTTRNRS/"; accountInfo = "/BANKACCTFROM"; break; case AccountType.CC: xpath = "OFX/CREDITCARDMSGSRSV1/CCSTMTTRNRS/"; 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("OFX/SIGNONMSGSRSV1/SONRS"); case OFXSection.CURRENCY: return(xpath + "/CURDEF"); default: throw new OFXException("Unknown section found when retrieving XPath. Section " + section); } }
/// <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> internal 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; case AccountType.INVESTMENT: xpath = Resources.Investment; accountInfo = "/INVACCTFROM"; break; default: throw new OFXException("Account Type not supported. Account type " + type); } switch (section) { case OFXSection.ACCOUNTINFO: return(xpath + accountInfo); case OFXSection.BALANCE: if (type == AccountType.INVESTMENT) { return(xpath + "/INVBAL"); } else { return(xpath); } case OFXSection.TRANSACTIONS: if (type == AccountType.INVESTMENT) { return(xpath + "/INVTRANLIST"); } else { return(xpath + "/BANKTRANLIST"); } case OFXSection.POSITIONS: return(xpath + "/INVPOSLIST"); case OFXSection.SIGNON: return(Resources.SignOn); case OFXSection.CURRENCY: return(xpath + "/CURDEF"); default: throw new OFXException("Unknown section found when retrieving XPath. Section " + section); } }