本文整理汇总了C#中O2GSession.getReportURL方法的典型用法代码示例。如果您正苦于以下问题:C# O2GSession.getReportURL方法的具体用法?C# O2GSession.getReportURL怎么用?C# O2GSession.getReportURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类O2GSession
的用法示例。
在下文中一共展示了O2GSession.getReportURL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetReports
/// <summary>
/// Get reports for all accounts
/// </summary>
/// <param name="session"></param>
public static void GetReports(O2GSession session)
{
O2GLoginRules loginRules = session.getLoginRules();
if (loginRules == null)
{
throw new Exception("Cannot get login rules");
}
O2GResponseReaderFactory responseFactory = session.getResponseReaderFactory();
O2GResponse accountsResponse = loginRules.getTableRefreshResponse(O2GTableType.Accounts);
O2GAccountsTableResponseReader accountsReader = responseFactory.createAccountsTableReader(accountsResponse);
System.Net.WebClient webClient = new System.Net.WebClient();
for (int i = 0; i < accountsReader.Count; i++)
{
O2GAccountRow account = accountsReader.getRow(i);
string url = session.getReportURL(account, DateTime.Now.AddMonths(-1), DateTime.Now, "html", null, null, 0);
Console.WriteLine("AccountID={0}; Balance={1}; UsedMargin={2}; Report URL={3}",
account.AccountID, account.Balance, account.UsedMargin, url);
string content = webClient.DownloadString(url);
string filename = account.AccountID + ".html";
System.IO.File.WriteAllText(filename, content);
Console.WriteLine("Report is saved to {0}", filename);
}
}