/// <summary> /// Provides general information for any FRC team /// teamKey Format Example : "frc3710" /// </summary> /// <param name="teamKey"></param> /// <returns></returns> public static TeamInformation GetTeamInformation(string teamKey) { var teamInformationToReturn = new TeamInformation(); if (InternetTest.checkInternet()) { var wc = new WebClient(); wc.Headers.Add("X-TBA-App-Id", "3710-xNovax:FRC_Scouting_V2:" + Assembly.GetExecutingAssembly().GetName().Version); try { string url = ("http://www.thebluealliance.com/api/v2/team/" + teamKey); teamInformationToReturn = JsonConvert.DeserializeObject <TeamInformation>(wc.DownloadString(url)); } catch (Exception webError) { Console.WriteLine("Error Message: " + webError.Message); } } else { try { string teamNum = teamKey.Substring(3); string path = (AppDomain.CurrentDomain.BaseDirectory + "\\Saves\\TBA\\" + "Team" + (Convert.ToInt32(teamNum)) + "Info.html"); string fileLines = File.ReadAllText(path); teamInformationToReturn = JsonConvert.DeserializeObject <TeamInformation>(fileLines); } catch (Exception exception) { Console.WriteLine("Error Message: " + exception.Message); } } return(teamInformationToReturn); }
public List <TeamInformation> GetTeamList(int id) { List <TeamInformation> team = new List <TeamInformation>(); try { int currentUserid = id; var selectTeam = entity.Teams.Where(s => s.UserID == currentUserid).Select(s => s.TeamUserInfoID); foreach (var item in selectTeam) { var data = entity.Teams.Where(s => s.TeamUserInfoID == item).ToList(); TeamInformation teamInfo = new TeamInformation(); teamInfo.TeamUserInfoID = item; foreach (var _user in data) { TeamUserInfo _team = new TeamUserInfo { FirstName = _user.UserInfo.FirstName, Email = _user.UserInfo.Email, PhoneNumber = _user.UserInfo.PhoneNumber, TeamName = _user.TeamName }; teamInfo.TeamUserList.Add(_team); } team.Add(teamInfo); } } catch (Exception) { return(null); } return(team); }
private void BTN_OPPONENTS_Click(object sender, RoutedEventArgs e) { OpponentsDlg dlg = new OpponentsDlg(engine.TeamLineupData, engine.CompleteListOfTeams); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { TeamInformation.saveDatabase(engine.TeamLineupData); } }
public List <TeamInformation> GetTeamDetail(string TeamName) { List <TeamInformation> team = new List <TeamInformation>(); var GetDetails = entity.Teams.Where(s => s.TeamName == TeamName && s.IsActive == true).ToList(); TeamInformation teamInfo = new TeamInformation(); foreach (var data in GetDetails) { TeamUserInfo _team = new TeamUserInfo { TeamName = data.TeamName, FirstName = data.UserInfo.FirstName, Email = data.UserInfo.Email, PhoneNumber = data.UserInfo.PhoneNumber, UserID = data.UserID, TeamUserInfoID = data.TeamUserInfoID }; teamInfo.TeamUserList.Add(_team); } team.Add(teamInfo); return(team); }
public static TeamInformation GetTeamInformation(string teamKey) { var teamInformationToReturn = new TeamInformation(); var wc = new WebClient(); wc.Headers.Add("X-TBA-Auth-Key", headerString); try { var url = ("https://www.thebluealliance.com/api/v3/team/" + teamKey); teamInformationToReturn = JsonConvert.DeserializeObject <TeamInformation>(wc.DownloadString(url)); } catch (Exception webError) { Console.WriteLine("Error Message: " + webError.Message); } return(teamInformationToReturn); }
private void ValidateIncidentTeam(TeamInformation TeamInformation) { Assert.NotNull(TeamInformation); }
/// <summary> /// Function to load the team data into the View Model. /// </summary> /// <param name="teamnumber">The team number to load.</param> private async Task <TeamInformation> LoadTeamData(string teamnumber) { TeamInformation ti = await apiClient.TeamApi.GetTeamInfo(teamnumber); return(ti); }