private void button_DownloadEarning_Click(object sender, EventArgs e) { db_manager.DBConnect(); CompanyProfilePage cpp = new CompanyProfilePage(); // cpp.DownloadEarningInfoAll(db_manager.getConnection(), "2379"); //from 98-102. profit margin cpp.DownloadEpsInfo(db_manager.getConnection(), "2379", 100, 1); //eps cpp.DownloadMonthRevenue(db_manager.getConnection(), "2379", 100, 1); //revenue cpp.DownloadEpsInfo(db_manager.getConnection(), "2379", 102, 1); //eps cpp.DownloadMonthRevenue(db_manager.getConnection(), "2379", 102, 1); //revenue int rev = cpp.GetMonthRevenue(db_manager.getConnection(), "2379", 102, 1); EarningInfo ei = cpp.GetSeasonEarning(db_manager.getConnection(), "2379", 102, 1); YearSeasonMonth ysm = cpp.GetLatestRevenueInfoDate(db_manager.getConnection(), "2379"); ysm = cpp.GetLatestEarningInfoDate(db_manager.getConnection(), "2379"); }
private void button_GetEarning_Click(object sender, EventArgs e) { db_manager.DBConnect(); CompanyProfilePage cpp = new CompanyProfilePage(); int year; int season; for (year = 98; year < 102; year++) { for (season = 1; season <= 4; season++) { cpp.DownloadMonthRevenue(db_manager.getConnection(), "2379", year, season); } } }
private void backgroundWorker_downloadrevenue_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker downloadrevenue_worker = sender as BackgroundWorker; List <String> stocks = GetAllStocks(); DateTime current = DateTime.Now; YearSeasonMonth currentYSM = new YearSeasonMonth(current, true); CompanyProfilePage cpp = new CompanyProfilePage(); backgroundWorker_downloadrevenue_inprogress = true; foreach (String stock_idx in stocks) { if (downloadrevenue_worker.CancellationPending) { Logger.v("cancelling databases update"); backgroundWorker_downloadrevenue_inprogress = false; break; } //earning YearSeasonMonth latestEarning = cpp.GetLatestEarningInfoDate(db_manager.getConnection(), stock_idx); List <YearSeasonMonth> EPS2download = new List <YearSeasonMonth>(); YearSeasonMonth nextEarning; if ((latestEarning == null) || (latestEarning.year < 102)) { cpp.DownloadEarningInfo_beforeIFRS(db_manager.getConnection(), stock_idx, EPS2download); nextEarning = IfrsStart; } else { nextEarning = latestEarning.NextSeason(); } downloadrevenue_index++; for (int y = nextEarning.year; y <= (current.Year - 1911); y++) { cpp.DownloadEarningInfo(db_manager.getConnection(), stock_idx, y, EPS2download); downloadrevenue_index++; } //eps info is from another page foreach (YearSeasonMonth season in EPS2download) { cpp.DownloadEpsInfo(db_manager.getConnection(), stock_idx, season.year, season.season); downloadrevenue_index++; int loop; for (loop = 0; loop < 10; loop++) { if (cpp.isEPS_Null(db_manager.getConnection(), stock_idx, season.year, season.season)) { cpp.DownloadEpsInfo(db_manager.getConnection(), stock_idx, season.year, season.season); downloadrevenue_index++; } } } YearSeasonMonth latestRevenue = cpp.GetLatestRevenueInfoDate(db_manager.getConnection(), stock_idx); if (latestRevenue == null) { latestRevenue = EarningStart; } for (YearSeasonMonth month = latestRevenue; month < currentYSM; month.NextMonth()) { cpp.DownloadMonthRevenue(db_manager.getConnection(), stock_idx, month.year, month.month); downloadrevenue_index++; } } }