private void scoutingSubmitButton_Click(object sender, EventArgs e)
        {
            scoutingSubmitButton.Enabled = false;
            Program.selectedEventName    = "RecycleRush_GTR_East";

            var match = new Match_Scout
            {
                Author                           = Settings.Default.username,
                TimeCreated                      = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss"),
                UniqueID                         = Guid.NewGuid().ToString(),
                Team_Number                      = currentTeamNumber,
                Team_Name                        = currentTeamName,
                Match_Number                     = Convert.ToInt32(scoutingMatchNumberNumericUpDown.Value),
                Alliance_Colour                  = allianceColour,
                Robot_Dead                       = scoutingDidTheRobotDieCheckBox.Checked,
                Auto_Starting_X                  = startingX,
                Auto_Starting_Y                  = startingY,
                Auto_Drive_To_Autozone           = scoutingDriveToAutoZoneCheckBox.Checked,
                Auto_Robot_Set                   = scoutingRobotSetCheckBox.Checked,
                Auto_Tote_Set                    = scoutingToteSetCheckBox.Checked,
                Auto_Bin_Set                     = scoutingBinSetCheckBox.Checked,
                Auto_Stacked_Tote_Set            = scoutingStackedToteSetCheckBox.Checked,
                Auto_Acquired_Step_Bins          = Convert.ToInt32(scoutingAcquiredStepBinsNumUpDown.Value),
                Auto_Fouls                       = Convert.ToInt32(scoutingAutoFoulsNumUpDown.Value),
                Auto_Did_Nothing                 = scoutingDidNothingCheckBox.Checked,
                Tele_Tote_Pickup_Upright         = scoutingTotePickupUprightCheckbox.Checked,
                Tele_Tote_Pickup_Upside_Down     = scoutingTotePickupUpsideDownCheckBox.Checked,
                Tele_Tote_Pickup_Sideways        = scoutingTotePickupSideWaysCheckBox.Checked,
                Tele_Bin_Pickup_Upright          = scoutingBinPickupUprightCheckBox.Checked,
                Tele_Bin_Pickup_Upside_Down      = scoutingBinPickupUpsideDownCheckBox.Checked,
                Tele_Bin_Pickup_Sideways         = scoutingBinPickupSidewaysCheckBox.Checked,
                Tele_Human_Station_Load_Totes    = scoutingHumanStationLoadTotesCheckBox.Checked,
                Tele_Human_Station_Stack_Totes   = scoutingHumanStationStackTotesCheckBox.Checked,
                Tele_Human_Station_Insert_Litter = scoutingHumanStationInsertLitterCheckBox.Checked,
                Tele_Human_Throwing_Litter       = scoutingHumanThrowingLitterCheckBox.Checked,
                Tele_Pushed_Litter_To_Landfill   = scoutingPushedLitterToLandfill.Checked,
                Tele_Fouls                       = Convert.ToInt32(scoutingTeleFoulPointsNumUpDown.Value),
                Comments                         = scoutingCommentsRichTextBox.Text,
                Stacks                           = matchStacks,
                Coopertition_Set                 = scoutingCoopertitionSetCheckBox.Checked,
                Coopertition_Stack               = scoutingCoopertitionStackCheckBox.Checked,
                Final_Score_Red                  = Convert.ToInt32(scoutingRedAllianceFinalScoreNumUpDown.Value),
                Final_Score_Blue                 = Convert.ToInt32(scoutingBlueAllianceFinalScoreNumUpDown.Value),
                Driver_Rating                    = driverRating
            };

            if (match.Comments.Contains(";"))
            {
                match.Comments = Regex.Replace(match.Comments, "[;]", string.Empty);
            }

            try
            {
                Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "\\Saves");
                var jsonText      = JsonConvert.SerializeObject(match, Formatting.Indented);
                var matchLocation = AppDomain.CurrentDomain.BaseDirectory + "\\Saves\\RecycleRush_GTR_East_" +
                                    Convert.ToInt32(scoutingMatchNumberNumericUpDown.Value) + "_" + currentTeamName +
                                    ".json";
                File.WriteAllText(matchLocation, jsonText);
            }
            catch (Exception exception)
            {
                Console.Write("Error Occured: " + exception.Message);
                ConsoleWindow.WriteLine("Error Occured: " + exception.Message);
                Notifications.ReportCrash(exception);
            }

            try
            {
                var conn = new MySqlConnection(MySQLMethods.MakeMySqlConnectionString());
                conn.Open();
                var cmd         = conn.CreateCommand();
                var commandText =
                    string.Format(
                        "Insert into RecycleRush_GTR_East_Matches (EntryID,UniqueID,Author,TimeCreated,Team_Number,Team_Name,Match_Number,Alliance_Colour,Robot_Dead,Auto_Starting_X,Auto_Starting_Y,Auto_Drive_To_Autozone,Auto_Robot_Set,Auto_Tote_Set,Auto_Bin_Set,Auto_Stacked_Tote_Set,Auto_Acquired_Step_Bins,Auto_Fouls,Auto_Did_Nothing,Tele_Tote_Pickup_Upright,Tele_Tote_Pickup_Upside_Down,Tele_Tote_Pickup_Sideways,Tele_Bin_Pickup_Upright,Tele_Bin_Pickup_Upside_Down,Tele_Bin_Pickup_Sideways,Tele_Human_Station_Load_Totes,Tele_Human_Station_Stack_Totes,Tele_Human_Station_Insert_Litter,Tele_Human_Throwing_Litter,Tele_Pushed_Litter_To_Landfill,Tele_Fouls,Comments,Stacks,Coopertition_Set,Coopertition_Stack,Final_Score_Red,Final_Score_Blue,Driver_Rating) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}','{24}','{25}','{26}','{27}','{28}','{29}','{30}','{31}','{32}','{33}','{34}','{35}','{36}','{37}');",
                        MySQLMethods.GetNumberOfRowsInATable() + 1, match.UniqueID, match.Author, match.TimeCreated,
                        match.Team_Number, match.Team_Name, match.Match_Number, match.Alliance_Colour,
                        Convert.ToInt16(match.Robot_Dead), match.Auto_Starting_X, match.Auto_Starting_Y,
                        Convert.ToInt16(match.Auto_Drive_To_Autozone), Convert.ToInt16(match.Auto_Robot_Set),
                        Convert.ToInt16(match.Auto_Tote_Set), Convert.ToInt16(match.Auto_Bin_Set),
                        Convert.ToInt16(match.Auto_Stacked_Tote_Set), match.Auto_Acquired_Step_Bins, match.Auto_Fouls,
                        Convert.ToInt16(match.Auto_Did_Nothing), Convert.ToInt16(match.Tele_Tote_Pickup_Upright),
                        Convert.ToInt16(match.Tele_Tote_Pickup_Upside_Down),
                        Convert.ToInt16(match.Tele_Tote_Pickup_Sideways), Convert.ToInt16(match.Tele_Bin_Pickup_Upright),
                        Convert.ToInt16(match.Tele_Bin_Pickup_Upside_Down),
                        Convert.ToInt16(match.Tele_Bin_Pickup_Sideways),
                        Convert.ToInt16(match.Tele_Human_Station_Load_Totes),
                        Convert.ToInt16(match.Tele_Human_Station_Stack_Totes),
                        Convert.ToInt16(match.Tele_Human_Station_Insert_Litter),
                        Convert.ToInt16(match.Tele_Human_Throwing_Litter),
                        Convert.ToInt16(match.Tele_Pushed_Litter_To_Landfill), match.Tele_Fouls, match.Comments,
                        JsonConvert.SerializeObject(match.Stacks), Convert.ToInt16(match.Coopertition_Set),
                        Convert.ToInt16(match.Coopertition_Stack), match.Final_Score_Red, match.Final_Score_Blue,
                        match.Driver_Rating);
                cmd.CommandText = commandText;
                cmd.ExecuteNonQuery();
                conn.Close();
            }
            catch (Exception exception)
            {
                Console.Write("Error Occured: " + exception.Message);
                ConsoleWindow.WriteLine("Error Occured: " + exception.Message);
                Notifications.ReportCrash(exception);
            }

            ResetScoutingInterface();
            scoutingSubmitButton.Enabled = true;
        }
        private void teamSelector_SelectedIndexChanged(object sender, EventArgs e)
        {
            currentTeamName            = teamNameArray[teamSelector.SelectedIndex];
            currentTeamNumber          = teamNumberArray[teamSelector.SelectedIndex];
            Program.selectedTeamNumber = currentTeamNumber;

            teamInformationTeamName.Text   = "Team Name: " + teamNameArray[teamSelector.SelectedIndex];
            teamInformationTeamNumber.Text = "Team Number: " + teamNumberArray[teamSelector.SelectedIndex];

            ResetMatchBreakdownInterface();

            try
            {
                var teamImage = Resources.ResourceManager.GetObject("FRC" + teamNumberArray[teamSelector.SelectedIndex]);
                teamInformationLogo.Image = (Image)teamImage;
            }
            catch (Exception exception)
            {
                Console.Write("Error Occured: " + exception.Message);
                ConsoleWindow.WriteLine("Error Occured: " + exception.Message);
            }

            if (Network.CheckForInternetConnection())
            {
                var url = "http://www.thebluealliance.com/api/v2/team/frc";
                url = url + Convert.ToString(teamNumberArray[teamSelector.SelectedIndex]);
                string downloadedData;
                var    wc = new WebClient();
                wc.Headers.Add("X-TBA-App-Id",
                               "3710-xNovax:FRC_Scouting_V2:" + Assembly.GetExecutingAssembly().GetName().Version);

                try
                {
                    downloadedData = wc.DownloadString(url);
                    var deserializedData =
                        JsonConvert.DeserializeObject <AerialAssist_RahChaCha.TeamInformationJSONData>(downloadedData);

                    teamInformationTeamLocation.Text     = "Team Location: " + Convert.ToString(deserializedData.location);
                    teamInformationRookieYear.Text       = "Rookie Year: " + Convert.ToString(deserializedData.rookie_year);
                    teamInformationWebsiteLinkLabel.Text = Convert.ToString(deserializedData.website);
                }
                catch (Exception webError)
                {
                    ConsoleWindow.WriteLine("Error Message: " + webError.Message);
                }
            }
            else
            {
                teamInformationTeamLocation.Text     = "Team Location: ";
                teamInformationRookieYear.Text       = "Rookie Year: ";
                teamInformationWebsiteLinkLabel.Text = "";
            }

            if (Network.CheckForInternetConnection())
            {
                try
                {
                    var             conn = new MySqlConnection(MySQLMethods.MakeMySqlConnectionString());
                    var             cmd  = conn.CreateCommand();
                    MySqlDataReader reader;
                    cmd.CommandText =
                        string.Format("SELECT * FROM RecycleRush_GTR_East_Matches WHERE Team_Number = '{0}'",
                                      Program.selectedTeamNumber);
                    conn.Open();
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        var match = new Match_Scout
                        {
                            Author                           = reader["Author"].ToString(),
                            TimeCreated                      = reader["TimeCreated"].ToString(),
                            Match_Number                     = Convert.ToInt32(reader["Match_Number"]),
                            Alliance_Colour                  = Convert.ToString(reader["Alliance_Colour"]),
                            Robot_Dead                       = Convert.ToBoolean(reader["Robot_Dead"]),
                            Auto_Starting_X                  = Convert.ToInt32(reader["Auto_Starting_X"]),
                            Auto_Starting_Y                  = Convert.ToInt32(reader["Auto_Starting_Y"]),
                            Auto_Drive_To_Autozone           = Convert.ToBoolean(reader["Auto_Drive_To_Autozone"]),
                            Auto_Robot_Set                   = Convert.ToBoolean(reader["Auto_Robot_Set"]),
                            Auto_Tote_Set                    = Convert.ToBoolean(reader["Auto_Tote_Set"]),
                            Auto_Bin_Set                     = Convert.ToBoolean(reader["Auto_Bin_Set"]),
                            Auto_Stacked_Tote_Set            = Convert.ToBoolean(reader["Auto_Stacked_Tote_Set"]),
                            Auto_Acquired_Step_Bins          = Convert.ToInt32(reader["Auto_Acquired_Step_Bins"]),
                            Auto_Fouls                       = Convert.ToInt32(reader["Auto_Fouls"]),
                            Auto_Did_Nothing                 = Convert.ToBoolean(reader["Auto_Did_Nothing"]),
                            Tele_Tote_Pickup_Upright         = Convert.ToBoolean(reader["Tele_Tote_Pickup_Upright"]),
                            Tele_Tote_Pickup_Upside_Down     = Convert.ToBoolean(reader["Tele_Tote_Pickup_Upside_Down"]),
                            Tele_Tote_Pickup_Sideways        = Convert.ToBoolean(reader["Tele_Tote_Pickup_Sideways"]),
                            Tele_Bin_Pickup_Upright          = Convert.ToBoolean(reader["Tele_Bin_Pickup_Upright"]),
                            Tele_Bin_Pickup_Upside_Down      = Convert.ToBoolean(reader["Tele_Bin_Pickup_Upside_Down"]),
                            Tele_Bin_Pickup_Sideways         = Convert.ToBoolean(reader["Tele_Bin_Pickup_Sideways"]),
                            Tele_Human_Station_Load_Totes    = Convert.ToBoolean(reader["Tele_Human_Station_Load_Totes"]),
                            Tele_Human_Station_Stack_Totes   = Convert.ToBoolean(reader["Tele_Human_Station_Stack_Totes"]),
                            Tele_Human_Station_Insert_Litter =
                                Convert.ToBoolean(reader["Tele_Human_Station_Insert_Litter"]),
                            Tele_Human_Throwing_Litter     = Convert.ToBoolean(reader["Tele_Human_Throwing_Litter"]),
                            Tele_Pushed_Litter_To_Landfill = Convert.ToBoolean(reader["Tele_Pushed_Litter_To_Landfill"]),
                            Tele_Fouls         = Convert.ToInt32(reader["Tele_Fouls"]),
                            Comments           = Convert.ToString(reader["Comments"]),
                            Stacks             = JsonConvert.DeserializeObject <List <Stack> >(reader["Stacks"].ToString()),
                            Coopertition_Set   = Convert.ToBoolean(reader["Coopertition_Set"]),
                            Coopertition_Stack = Convert.ToBoolean(reader["Coopertition_Stack"]),
                            Final_Score_Red    = Convert.ToInt32(reader["Final_Score_Red"]),
                            Final_Score_Blue   = Convert.ToInt32(reader["Final_Score_Blue"]),
                            Driver_Rating      = Convert.ToInt32(reader["Driver_Rating"])
                        };

                        teamsMatches.Add(match);

                        matchBreakdownMatchList.Items.Add("Match Number: " + reader["Match_Number"]);
                    }
                    conn.Close();
                }
                catch (MySqlException exception)
                {
                    Console.Write("Error Occured: " + exception.Message);
                    ConsoleWindow.WriteLine("Error Occured: " + exception.Message);
                }
            }
        }