public void DBSave(BsonDocument financial, String stock_index, int year, int season) { DbMango db = new DbMango(); db.connect(); db.FinancialReport_save(financial, stock_index, year, season); }
public void BatchDownloadFinancialReport() { DbMango mongo = new DbMango(); mongo.connect(); String[] stocks = new string[] { /*"2371",*/ "2373", "2374", "2375", "2376", "2377", "2379" }; foreach (String stock in stocks) { YearSeason yearseason = mongo.FinancialReport_FindLatest(stock); yearseason = (yearseason == null) ? new YearSeason(104, 1) : yearseason.next(); for (int year = 104; year <= 108; year++) { for (int season = 1; season <= 4; season++) { if (SeasonalReportReady(year, season)) { int try_count = 1; Boolean download_success = false; do { download_success = DownloadSeasonalReport(stock, year, season); Thread.Sleep(1000 * try_count); } while (!download_success && (try_count < 10)); } } } } }