protected void btnProcessManualBox_Click( object sender, EventArgs e ) { StatGrabber.StatGrabber sg = new StatGrabber.StatGrabber(); SqlDatabase db = new SqlDatabase( System.Configuration.ConfigurationManager.AppSettings["ConnectionString"] ); ArrayList problems = new ArrayList(); try { ArrayList perfs = sg.GetGamePerformances( tbManualBoxURL.Text, problems ); tbOutput.Text += "Got " + perfs.Count + " perfs from " + tbManualBoxURL.Text + "\r\n"; problems.AddRange( sg.SavePerformances( db, perfs, calStatDate.SelectedDate ) ); } catch( StatGrabber.StatGrabberException ex ) { tbOutput.Text += ex.Message; } if( problems.Count > 0 ) { tbOutput.Text += "Problems:\r\n"; foreach( StatGrabber.PlayerPerformance p in problems ) { tbOutput.Text += p.FirstName + " " + p.LastName + " " + p.TeamName + "\r\n"; } } else { tbOutput.Text += "No problems identifying players\r\n"; } tbOutput.Text += sg.UpdateAveragesAndScores( db, calStatDate.SelectedDate ); Log.AddLogEntry( LogEntryTypes.StatsProcessed, Page.User.Identity.Name, tbOutput.Text ); }
protected void ButtonProcessDaily_Click(object sender, System.EventArgs e) { tbOutput.Text += "\r\nScraping " + calStatDate.SelectedDate.ToString() + "\r\n"; StatGrabber.StatGrabber sg = new StatGrabber.StatGrabber(); ArrayList urls = sg.GetGames( this.calStatDate.SelectedDate ); tbOutput.Text += "Found " + urls.Count + " games\r\n"; SqlDatabase db = new SqlDatabase( System.Configuration.ConfigurationManager.AppSettings["ConnectionString"] ); ArrayList problems = new ArrayList(); foreach( string url in urls ) { try { ArrayList perfs = sg.GetGamePerformances( url ); tbOutput.Text += "Got " + perfs.Count + " perfs from " + url + "\r\n"; problems.AddRange( sg.SavePerformances( db, perfs, calStatDate.SelectedDate ) ); } catch( StatGrabber.StatGrabberException ex ) { tbOutput.Text += ex.Message; } } if( problems.Count > 0 ) { tbOutput.Text += "\r\nFound the following problems:\r\n"; foreach( StatGrabber.PlayerPerformance p in problems ) { tbOutput.Text += p.FirstName + " " + p.LastName + " " + p.TeamName + "\r\n"; } } else { tbOutput.Text += "\r\nNo problems identifying players\r\n"; } tbOutput.Text += "\r\n"; tbOutput.Text += sg.UpdateAveragesAndScores( db, calStatDate.SelectedDate ); Log.AddLogEntry( LogEntryTypes.StatsProcessed, Page.User.Identity.Name, tbOutput.Text ); }