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(); Front_Picture = null; Left_Side_Picture = null; Left_Isometric_Picture = null; Other_Picture = null; pitScoutingEditorFrontPictureLabel.Text = "Front Picture:"; pitScoutingEditorSidePictureLabel.Text = "Side Picture:"; pitScoutingEditorSideIsometricPictureLabel.Text = "Side Isometric Picture:"; pitScoutingEditorOtherPictureLabel.Text = "Other Picture:"; try { object teamImage = Resources.ResourceManager.GetObject("FRC" + teamNumberArray[teamSelector.SelectedIndex]); teamInformationLogo.Image = (Image) teamImage; } catch (Exception exception) { Console.WriteLine("Error Occured: " + exception.Message); ConsoleWindow.WriteLine("Error Occured: " + exception.Message); } if (Home.internetAvailable) { string 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) { Console.WriteLine("Error Message: " + webError.Message); ConsoleWindow.WriteLine("Error Message: " + webError.Message); } } else { teamInformationTeamLocation.Text = "Team Location: "; teamInformationRookieYear.Text = "Rookie Year: "; teamInformationWebsiteLinkLabel.Text = ""; } if (Home.internetAvailable) { try { var conn = new MySqlConnection(MySQLMethods.MakeMySqlConnectionString()); MySqlCommand cmd = conn.CreateCommand(); MySqlDataReader reader; cmd.CommandText = String.Format("SELECT * FROM RecycleRush_Northbay_Matches WHERE Team_Number = '{0}'", Program.selectedTeamNumber); conn.Open(); reader = cmd.ExecuteReader(); while (reader.Read()) { var match = new RecycleRush_Scout_Match { 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<RecycleRush_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.WriteLine("Error Occured: " + exception.Message); ConsoleWindow.WriteLine("Error Occured: " + exception.Message); } try { ResetPitScoutingViewerInterface(); ResetPitScoutingEditorInterface(); var conn = new MySqlConnection(MySQLMethods.MakeMySqlConnectionString()); MySqlCommand cmd = conn.CreateCommand(); MySqlDataReader reader; cmd.CommandText = String.Format("SELECT * FROM RecycleRush_Northbay_Pits WHERE Team_Number = '{0}'", Program.selectedTeamNumber); conn.Open(); reader = cmd.ExecuteReader(); while (reader.Read()) { var pitScout = new RecycleRush_Pit_Scouting_Team { Author = reader["Author"].ToString(), Time_Created = reader["Time_Created"].ToString(), UniqueID = reader["UniqueID"].ToString(), Team_Number = Convert.ToInt32(reader["Team_Number"]), Team_Name = reader["Team_Name"].ToString(), Drive_Train = reader["Drive_Train"].ToString(), Number_Of_Robots = Convert.ToInt32(reader["Number_Of_Robots"]), Does_It_have_A_Ramp = Convert.ToBoolean(reader["Does_It_have_A_Ramp"]), Can_It_Manipulate_Totes = Convert.ToBoolean(reader["Can_It_Manipulate_Totes"]), Can_It_Manipulate_Bins = Convert.ToBoolean(reader["Can_It_Manipulate_Bins"]), Can_It_Manipulate_Litter = Convert.ToBoolean(reader["Can_It_Manipulate_Litter"]), Needs_Special_Starting_Position = Convert.ToBoolean(reader["Needs_Special_Starting_Position"]), Special_Starting_Position = reader["Special_Starting_Position"].ToString(), Max_Stack_Height = Convert.ToInt32(reader["Max_Stack_Height"]), Max_Bin_On_Stack_Height = Convert.ToInt32(reader["Max_Bin_On_Stack_Height"]), Human_Tote_Loading = Convert.ToBoolean(reader["Human_Tote_Loading"]), Human_Litter_Loading = Convert.ToBoolean(reader["Human_Litter_Loading"]), Human_Litter_Throwing = Convert.ToBoolean(reader["Human_Litter_Throwing"]), Comments = reader["Comments"].ToString(), Front_Picture = reader["Front_Picture"] as byte[], Left_Side_Picture = reader["Left_Side_Picture"] as byte[], Left_Isometric_Picture = reader["Left_Isometric_Picture"] as byte[], Other_Picture = reader["Other_Picture"] as byte[], }; currentTeamPit = pitScout; } conn.Close(); try { pitScoutingViewerEntryInformationAuthorDisplay.Text = currentTeamPit.Author; pitScoutingViewerEntryInformationTimeCreatedDisplay.Text = currentTeamPit.Time_Created; pitScoutingViewerManipulationTotesDisplay.Text = currentTeamPit.Can_It_Manipulate_Totes.ToString(); pitScoutingViewerManipulationBinsDisplay.Text = currentTeamPit.Can_It_Manipulate_Bins.ToString(); pitScoutingViewerManipulationLitterDisplay.Text = currentTeamPit.Can_It_Manipulate_Litter.ToString(); pitScoutingViewerRobotSpecsNumRobotsDisplay.Text = currentTeamPit.Number_Of_Robots.ToString(); pitScoutingViewerRobotSpecsDriveTrainTextBox.Text = "Drive Train: " + currentTeamPit.Drive_Train; pitScoutingViewerRobotSpecsDoesItHaveARampDisplay.Text = currentTeamPit.Does_It_have_A_Ramp.ToString(); pitScoutingViewerStartingLocationDoesItNeedSpecificStartingLocationDisplay.Text = currentTeamPit.Needs_Special_Starting_Position.ToString(); pitScoutingViewerStartingLocationSpecificStartingLocationTextBox.Text = "If so where? " + currentTeamPit.Special_Starting_Position; pitScoutingViewerStackInformationMaxStackHeightDisplay.Text = currentTeamPit.Max_Stack_Height.ToString(); pitScoutingViewerStackInformationMaxHeightWithBinDisplay.Text = currentTeamPit.Max_Bin_On_Stack_Height.ToString(); pitScoutingViewerPictureBox.Image = null; pitScoutingViewerHumanInteractionToteLoadingDisplay.Text = currentTeamPit.Human_Tote_Loading.ToString(); pitScoutingViewerHumanInteractionLitterLoadingDisplay.Text = currentTeamPit.Human_Litter_Loading.ToString(); pitScoutingViewerHumanInteractionLitterThrowingDisplay.Text = currentTeamPit.Human_Litter_Throwing.ToString(); pitScoutingViewerCommentsBox.Text = "Comments: " + currentTeamPit.Comments; } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); ConsoleWindow.WriteLine("Error: " + ex.Message); } } catch (MySqlException exception) { Console.WriteLine("Error Occured: " + exception.Message); ConsoleWindow.WriteLine("Error Occured: " + exception.Message); } } }
private void scoutingSubmitButton_Click(object sender, EventArgs e) { scoutingSubmitButton.Enabled = false; Program.selectedEventName = "RecycleRush_Northbay"; var match = new RecycleRush_Scout_Match { 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\\Matches"); string jsonText = JsonConvert.SerializeObject(match, Formatting.Indented); string matchLocation = (AppDomain.CurrentDomain.BaseDirectory + "\\Saves\\Matches\\RecycleRush_Northbay_" + Convert.ToInt32(scoutingMatchNumberNumericUpDown.Value) + "_" + currentTeamName + ".json"); File.WriteAllText(matchLocation, jsonText); } catch (Exception exception) { Console.WriteLine("Error Occured: " + exception.Message); ConsoleWindow.WriteLine("Error Occured: " + exception.Message); Notifications.ReportCrash(exception); } try { var conn = new MySqlConnection(MySQLMethods.MakeMySqlConnectionString()); conn.Open(); MySqlCommand cmd = conn.CreateCommand(); string commandText = String.Format("Insert into RecycleRush_Northbay_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.WriteLine("Error Occured: " + exception.Message); ConsoleWindow.WriteLine("Error Occured: " + exception.Message); Notifications.ReportCrash(exception); } ResetScoutingInterface(); scoutingSubmitButton.Enabled = true; }
private void scoutingSubmitButton_Click(object sender, EventArgs e) { scoutingSubmitButton.Enabled = false; Program.selectedEventName = "RecycleRush_TroyAthens"; int teamNo = Convert.ToInt32(teamNumberBeingScoutedNumericUpDown.Value); string teamName = currentTeamName; try { teamName = teamNameArray[Array.IndexOf(teamNumberArray, teamNo)]; } catch (Exception) { teamName = TheBlueAlliance.Teams.GetTeamInformation("frc" + teamNo).nickname; } int DS = Convert.ToInt32(scoutingPositionNumericUpDown.Value); string sP = allianceColour + DS; int autonScoreAprox = calcuateThisRobotsAutonScore(); int teleopScoreAprox = calcuateThisRobotsTeleopScore(); int coopScoreAprox = calculateThisRobotsCoopertitionScore(); int totalScoreAprox = calculateThisRobotsTotalScore(); var match = new RecycleRush_Scout_Match { Author = Settings.Default.username, TimeCreated = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss"), UniqueID = Guid.NewGuid().ToString(), Team_Number = teamNo, Team_Name = teamName, scoutingPosition = sP, Robot_Dead = scoutingDidTheRobotDieCheckBox.Checked, Auto_Starting_X = startingX, Auto_Starting_Y = startingY, Auto_Drive_To_Autozone = scoutingDriveToAutoZoneCheckBox.Checked, Auto_Can_Burgeled = scoutingCanBurgeledCheckbox.Checked, Auto_Cans_Grabbed = Convert.ToInt32(numCansGrabbedNumbericUpDown.Value), 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 = Convert.ToInt32(litterThrownNumUpDown.Value), Tele_Pushed_Litter_To_Landfill = Convert.ToInt32(litterPushedToLandFillNumUpDown.Value), Tele_Fouls = Convert.ToInt32(scoutingTeleFoulPointsNumUpDown.Value), Comments = scoutingCommentsRichTextBox.Text, Stacks = matchStacks, Coopertition_Set = scoutingCoopertitionSetCheckBox.Checked, Coopertition_Stack = scoutingCoopertitionStackCheckBox.Checked, Driver_Rating = driverRating, Aprox_Robots_Auton_Score = Convert.ToInt32(autonScoreAprox), Aprox_Robots_Teleop_Score = Convert.ToInt32(teleopScoreAprox), Aprox_Robots_Coopertition_Score = Convert.ToInt32(coopScoreAprox), Aprox_Robots_Total_Score = Convert.ToInt32(totalScoreAprox) }; if (match.Comments.Contains(";")) { match.Comments = Regex.Replace(match.Comments, "[;]", string.Empty); } try { Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "\\Saves"); string jsonText = JsonConvert.SerializeObject(match, Formatting.Indented); string matchLocation = (AppDomain.CurrentDomain.BaseDirectory + "\\Saves\\RecycleRush_TroyAthens_" + "Match" + Convert.ToInt32(scoutingMatchNumberNumericUpDown.Value) + "_" + sP + "_" + teamNo + ".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(); MySqlCommand cmd = conn.CreateCommand(); string commandText = String.Format("Insert into RecycleRush_TroyAthens_Matches (EntryID,UniqueID,Author,TimeCreated,Team_Number,Team_Name,Match_Number,scoutingPositon,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,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, 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.Driver_Rating); cmd.CommandText = commandText; cmd.ExecuteNonQuery(); conn.Close(); } catch (Exception exception) { //Do Nothing: /* 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 { object 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 (Home.internetAvailable) { string 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) { Console.WriteLine("Error Message: " + webError.Message); ConsoleWindow.WriteLine("Error Message: " + webError.Message); } } else { teamInformationTeamLocation.Text = "Team Location: "; teamInformationRookieYear.Text = "Rookie Year: "; teamInformationWebsiteLinkLabel.Text = ""; } if (Home.internetAvailable) { try { var conn = new MySqlConnection(MySQLMethods.MakeMySqlConnectionString()); MySqlCommand cmd = conn.CreateCommand(); MySqlDataReader reader; cmd.CommandText = String.Format("SELECT * FROM RecycleRush_TroyAthens_Matches WHERE Team_Number = '{0}'", Program.selectedTeamNumber); conn.Open(); reader = cmd.ExecuteReader(); while (reader.Read()) { var match = new RecycleRush_Scout_Match { Author = reader["Author"].ToString(), TimeCreated = reader["TimeCreated"].ToString(), Match_Number = Convert.ToInt32(reader["Match_Number"]), scoutingPosition = Convert.ToString(reader["stringPosition"]), 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_Can_Burgeled = Convert.ToBoolean(reader["Auto_Can_Burgeled"]), Auto_Cans_Grabbed = Convert.ToInt32(reader["Auto_Cans_Grabbed"]), 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.ToInt32(reader["Tele_Human_Throwing_Litter"]), Tele_Pushed_Litter_To_Landfill = Convert.ToInt32(reader["Tele_Pushed_Litter_To_Landfill"]), Tele_Fouls = Convert.ToInt32(reader["Tele_Fouls"]), Comments = Convert.ToString(reader["Comments"]), Stacks = JsonConvert.DeserializeObject <List <RecycleRush_Stack> >(reader["Stacks"].ToString()), Coopertition_Set = Convert.ToBoolean(reader["Coopertition_Set"]), Coopertition_Stack = Convert.ToBoolean(reader["Coopertition_Stack"]), Driver_Rating = Convert.ToInt32(reader["Driver_Rating"]), Aprox_Robots_Auton_Score = Convert.ToInt32(calcuateThisRobotsAutonScore()), Aprox_Robots_Teleop_Score = Convert.ToInt32(calcuateThisRobotsTeleopScore()), Aprox_Robots_Coopertition_Score = Convert.ToInt32(calculateThisRobotsCoopertitionScore()), Aprox_Robots_Total_Score = Convert.ToInt32(calculateThisRobotsTotalScore()) }; 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); } } }
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 { object 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 (Home.internetAvailable) { string 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) { Console.WriteLine("Error Message: " + webError.Message); ConsoleWindow.WriteLine("Error Message: " + webError.Message); } } else { teamInformationTeamLocation.Text = "Team Location: "; teamInformationRookieYear.Text = "Rookie Year: "; teamInformationWebsiteLinkLabel.Text = ""; } if (Home.internetAvailable) { try { var conn = new MySqlConnection(MySQLMethods.MakeMySqlConnectionString()); MySqlCommand cmd = conn.CreateCommand(); MySqlDataReader reader; cmd.CommandText = String.Format("SELECT * FROM RecycleRush_IRI_Matches WHERE Team_Number = '{0}'", Program.selectedTeamNumber); conn.Open(); reader = cmd.ExecuteReader(); while (reader.Read()) { var match = new RecycleRush_Scout_Match { Author = reader["Author"].ToString(), TimeCreated = reader["TimeCreated"].ToString(), Match_Number = Convert.ToInt32(reader["Match_Number"]), scoutingPosition = Convert.ToString(reader["stringPosition"]), 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_Can_Burgeled = Convert.ToBoolean(reader["Auto_Can_Burgeled"]), Auto_Cans_Grabbed = Convert.ToInt32(reader["Auto_Cans_Grabbed"]), 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.ToInt32(reader["Tele_Human_Throwing_Litter"]), Tele_Pushed_Litter_To_Landfill = Convert.ToInt32(reader["Tele_Pushed_Litter_To_Landfill"]), Tele_Fouls = Convert.ToInt32(reader["Tele_Fouls"]), Comments = Convert.ToString(reader["Comments"]), Stacks = JsonConvert.DeserializeObject<List<RecycleRush_Stack>>(reader["Stacks"].ToString()), Coopertition_Set = Convert.ToBoolean(reader["Coopertition_Set"]), Coopertition_Stack = Convert.ToBoolean(reader["Coopertition_Stack"]), Driver_Rating = Convert.ToInt32(reader["Driver_Rating"]), Aprox_Robots_Auton_Score = Convert.ToInt32(calcuateThisRobotsAutonScore()), Aprox_Robots_Teleop_Score = Convert.ToInt32(calcuateThisRobotsTeleopScore()), Aprox_Robots_Coopertition_Score = Convert.ToInt32(calculateThisRobotsCoopertitionScore()), Aprox_Robots_Total_Score = Convert.ToInt32(calculateThisRobotsTotalScore()) }; 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); } } }
private void scoutingSubmitButton_Click(object sender, EventArgs e) { scoutingSubmitButton.Enabled = false; Program.selectedEventName = "RecycleRush_GTR_East"; var match = new RecycleRush_Scout_Match { 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"); string jsonText = JsonConvert.SerializeObject(match, Formatting.Indented); string 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(); MySqlCommand cmd = conn.CreateCommand(); string 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; }