private void button5_Click(object sender, EventArgs e) { progressBar1.Minimum = 0; progressBar1.Maximum = 1000; // History starts on February, 2006 int currentYear = 2006; int currentMonth = 2; while (currentYear <= DateTime.Now.Year || currentMonth <= DateTime.Now.Month) { ParliamentarySessionParser.OnNetworkStart += NetworkStart; ParliamentarySessionParser.OnNetworkStop += NetworkStop; var dates = ParliamentarySessionParser.GetDates(currentYear, currentMonth); SummaryProcessor.Init(dbCfg.BuildSessionFactory()); SummaryProcessor.OnProgress += SummaryProgress; SummaryProcessor.OnNetworkStart += NetworkStart; SummaryProcessor.OnNetworkStop += NetworkStop; int idx = 1; foreach (var date in dates) { if (date.Year == DateTime.Now.Year && date.Month == DateTime.Now.Month && date.Day == DateTime.Now.Day) { // Don't even attempt to parse today; YMMV break; } toolStripStatusLabel1.Text = "Processing date " + date.ToString() + " (" + idx + "/" + dates.Count + ")"; Application.DoEvents(); SummaryProcessor.Process(date); idx++; } currentMonth++; if (currentMonth == 13) { currentMonth = 1; currentYear++; } } toolStripStatusLabel1.Text = "Idle"; }
private void button4_Click(object sender, EventArgs e) { SummaryProcessor.Init(dbCfg.BuildSessionFactory()); SummaryProcessor.Process(new DateTime(2018, 6, 18)); }