Ejemplo n.º 1
0
 protected string Autosub( string weekId, SqlDatabase db, DateTime selectedDate )
 {
     string result = AutoSub.ProcessAutosubs( weekId );
     StatGrabber.StatGrabber sg = new StatGrabber.StatGrabber();
     result += sg.UpdateAveragesAndScores( db, selectedDate );
     return result;
 }
Ejemplo n.º 2
0
        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 );
        }
Ejemplo n.º 3
0
        protected void ButtonProcessDaily_Click(object sender, System.EventArgs e)
        {
            tbScrapeResults.Text += "\r\n" + calStatDate.SelectedDate.ToString() + "\r\n";

            StatGrabber.StatGrabber sg = new StatGrabber.StatGrabber();
            ArrayList urls = sg.GetGames( calStatDate.SelectedDate );

            tbScrapeResults.Text += "Ran GetGames, got back " + urls.Count + " games\r\n";

            ArrayList problems = null;
            ArrayList performances = null;

            if( urls.Count > 0 )
            {
                try
                {
                    performances = sg.GetPerformances( urls );
                    tbScrapeResults.Text += "Ran GetPerformances, got back " + performances.Count + " perfs\r\n";

                    if( performances.Count > 0 )
                    {
                        SqlConnection con = new SqlConnection( System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"] );
                        problems = sg.SavePerformances( con, performances, calStatDate.SelectedDate );

                        tbScrapeResults.Text += "Ran SavePerformances, got back " + problems.Count + " problems\r\n";
                        foreach( PlayerPerformance p in problems )
                        {
                            tbScrapeResults.Text += p.FirstName + " " + p.LastName + " " + p.TeamName + "\r\n";
                        }
                    }
                }
                catch( StatGrabberException ex )
                {
                    tbScrapeResults.Text += "StatGrabber threw: "
                        + ex.Message;
                }
            }

            Log.AddLogEntry(
                LogEntryTypes.StatsProcessed,
                Page.User.Identity.Name,
                "Processed stats for "
                    + calStatDate.SelectedDate.ToString()
                    + ", found "
                    + urls.Count
                    + " games, "
                    + ( performances == null ? -1 : performances.Count )
                    + " perfs, "
                    + ( problems == null ? -1 : problems.Count )
                    + " problems" );
        }
Ejemplo n.º 4
0
        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 );
        }