private void okButton_Click(object sender, EventArgs e) { if (offensiveCaptainCombo.Text.Equals("") || defensiveCaptainCombo.Text.Equals("") || specialTeamsCaptainCombo.Text.Equals("")) { MessageBox.Show("You must select 3 captains", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (teamCaptainRecord != null) { teamCaptainRecord.Captain1 = ((PlayerRecord)offensiveCaptainCombo.SelectedItem).PlayerId; teamCaptainRecord.Captain2 = ((PlayerRecord)defensiveCaptainCombo.SelectedItem).PlayerId; teamCaptainRecord.Captain3 = ((PlayerRecord)specialTeamsCaptainCombo.SelectedItem).PlayerId; } else { teamCaptainRecord = (TeamCaptainRecord)model.TableModels[EditorModel.TEAM_CAPTAIN_TABLE].CreateNewRecord(true); teamCaptainRecord.TeamId = ((PlayerRecord)(offensiveCaptainCombo.SelectedItem)).TeamId; teamCaptainRecord.Captain1 = ((PlayerRecord)offensiveCaptainCombo.SelectedItem).PlayerId; teamCaptainRecord.Captain2 = ((PlayerRecord)defensiveCaptainCombo.SelectedItem).PlayerId; teamCaptainRecord.Captain3 = ((PlayerRecord)specialTeamsCaptainCombo.SelectedItem).PlayerId; } MessageBox.Show("Captains Stored for " + teamComboBox.Text, "Team Captains Changed", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void LoadTeamCaptains() { if (teamComboBox.Text.Equals("")) { return; } isInitialising = true; this.Cursor = Cursors.WaitCursor; int teamId = ((TeamRecord)teamComboBox.SelectedItem).TeamId; offensiveCaptainCombo.Items.Clear(); defensiveCaptainCombo.Items.Clear(); specialTeamsCaptainCombo.Items.Clear(); SortedList <string, PlayerRecord> list = new SortedList <string, PlayerRecord>(); foreach (TableRecordModel record in model.TableModels[EditorModel.PLAYER_TABLE].GetRecords()) { if (record.Deleted) { continue; } PlayerRecord player = (PlayerRecord)record; if (player.TeamId == teamId) { try { list.Add(player.ToString(), player); } catch (ArgumentException e) { Trace.WriteLine(e.ToString()); } } } //Now load them into the combo boxes foreach (PlayerRecord player in list.Values) { offensiveCaptainCombo.Items.Add(player); defensiveCaptainCombo.Items.Add(player); specialTeamsCaptainCombo.Items.Add(player); } //Lose the reference to the old team captain record teamCaptainRecord = null; //Now find the team captains if there are some foreach (TableRecordModel record in model.TableModels[EditorModel.TEAM_CAPTAIN_TABLE].GetRecords()) { if (((TeamCaptainRecord)record).TeamId == teamId) { teamCaptainRecord = (TeamCaptainRecord)record; break; } } if (teamCaptainRecord != null) { foreach (PlayerRecord player in list.Values) { if (player.PlayerId == teamCaptainRecord.Captain1) { offensiveCaptainCombo.Text = player.ToString(); } if (player.PlayerId == teamCaptainRecord.Captain2) { defensiveCaptainCombo.Text = player.ToString(); } if (player.PlayerId == teamCaptainRecord.Captain3) { specialTeamsCaptainCombo.Text = player.ToString(); } } } else { offensiveCaptainCombo.Text = ""; defensiveCaptainCombo.Text = ""; specialTeamsCaptainCombo.Text = ""; } this.Cursor = Cursors.Default; isInitialising = false; }
public TableRecordModel ConstructRecordModel(int recno) { TableRecordModel newRecord = null; string tablename = name; // Need to reverse the name if BE if (BigEndian) { string rev = ConvertBE(name); tablename = rev; } switch (tablename) { case EditorModel.CITY_TABLE: newRecord = new CityRecord(recno, this, parentModel); break; case EditorModel.COACH_TABLE: { // coch table in streameddata is different than ros/fra if (parentModel.FileType == MaddenFileType.Streameddata) { newRecord = new CoachCollection(recno, this, parentModel); } else { newRecord = new CoachRecord(recno, this, parentModel); } break; } case EditorModel.SALARY_CAP_TABLE: newRecord = new SalaryCapRecord(recno, this, parentModel); break; case EditorModel.COACH_SLIDER_TABLE: newRecord = new CoachPrioritySliderRecord(recno, this, parentModel); break; case EditorModel.TEAM_CAPTAIN_TABLE: newRecord = new TeamCaptainRecord(recno, this, parentModel); break; case EditorModel.OWNER_TABLE: newRecord = new OwnerRecord(recno, this, parentModel); break; case EditorModel.DEPTH_CHART_TABLE: newRecord = new DepthChartRecord(recno, this, parentModel); break; case EditorModel.INJURY_TABLE: newRecord = new InjuryRecord(recno, this, parentModel); break; case EditorModel.PLAYER_TABLE: newRecord = new PlayerRecord(recno, this, parentModel); break; case EditorModel.TEAM_TABLE: newRecord = new TeamRecord(recno, this, parentModel); break; case EditorModel.SCHEDULE_TABLE: newRecord = new ScheduleRecord(recno, this, parentModel); break; case EditorModel.STADIUM_TABLE: newRecord = new StadiumRecord(recno, this, parentModel); break; case EditorModel.UNIFORM_TABLE: newRecord = new UniformRecord(recno, this, parentModel); break; // MADDEN DRAFT EDIT case EditorModel.DRAFT_PICK_TABLE: newRecord = new DraftPickRecord(recno, this, parentModel); break; case EditorModel.DRAFTED_PLAYERS_TABLE: newRecord = new RookieRecord(recno, this, parentModel); break; case EditorModel.BOXSCORE_DEFENSE_TABLE: newRecord = new BoxScoreDefenseRecord(recno, this, parentModel); break; case EditorModel.BOXSCORE_OFFENSE_TABLE: newRecord = new BoxScoreOffenseRecord(recno, this, parentModel); break; case EditorModel.CAREER_STATS_DEFENSE_TABLE: newRecord = new CareerStatsDefenseRecord(recno, this, parentModel); break; case EditorModel.CAREER_STATS_OFFENSE_TABLE: newRecord = new CareerStatsOffenseRecord(recno, this, parentModel); break; case EditorModel.SEASON_STATS_DEFENSE_TABLE: newRecord = new SeasonStatsDefenseRecord(recno, this, parentModel); break; case EditorModel.SEASON_STATS_OFFENSE_TABLE: newRecord = new SeasonStatsOffenseRecord(recno, this, parentModel); break; case EditorModel.TEAM_SEASON_STATS: newRecord = new TeamSeasonStatsRecord(recno, this, parentModel); break; case EditorModel.FRANCHISE_TIME_TABLE: newRecord = new FranchiseTimeRecord(recno, this, parentModel); break; case EditorModel.BOXSCORE_TEAM_TABLE: newRecord = new BoxScoreTeamStats(recno, this, parentModel); break; case EditorModel.BOXSCORE_OFFENSIVE_LINE_TABLE: newRecord = new BoxScoreOffensiveLineRecord(recno, this, parentModel); break; case EditorModel.SEASON_STATS_OFFENSIVE_LINE_TABLE: newRecord = new SeasonStatsOffensiveLineRecord(recno, this, parentModel); break; case EditorModel.CAREER_STATS_OFFENSIVE_LINE_TABLE: newRecord = new CareerStatsOffensiveLineRecord(recno, this, parentModel); break; case EditorModel.CAREER_GAMES_PLAYED_TABLE: newRecord = new CareerGamesPlayedRecord(recno, this, parentModel); break; case EditorModel.SEASON_GAMES_PLAYED_TABLE: newRecord = new SeasonGamesPlayedRecord(recno, this, parentModel); break; case EditorModel.CAREER_STATS_KICKPUNT_TABLE: newRecord = new CareerPuntKickRecord(recno, this, parentModel); break; case EditorModel.SEASON_STATS_KICKPUNT_TABLE: newRecord = new SeasonPuntKickRecord(recno, this, parentModel); break; case EditorModel.CAREER_STATS_KICKPUNT_RETURN_TABLE: newRecord = new CareerPKReturnRecord(recno, this, parentModel); break; case EditorModel.SEASON_STATS_KICKPUNT_RETURN_TABLE: newRecord = new SeasonPKReturnRecord(recno, this, parentModel); break; case EditorModel.SCOUTING_STATE_TABLE: newRecord = new ScoutingStateRecord(recno, this, parentModel); break; case EditorModel.RFA_STATE_TABLE: newRecord = new RFAStateRecord(recno, this, parentModel); break; case EditorModel.RFA_PLAYERS: newRecord = new RestrictedFreeAgentPlayers(recno, this, parentModel); break; case EditorModel.RFA_SALARY_TENDERS: newRecord = new RestrictedFreeAgentSigningTenders(recno, this, parentModel); break; case EditorModel.RESIGN_PLAYERS_STATE_TABLE: newRecord = new ResignPlayersStateRecord(recno, this, parentModel); break; case EditorModel.FREE_AGENCY_STATE_TABLE: newRecord = new FreeAgencyStateRecord(recno, this, parentModel); break; case EditorModel.DRAFT_STATE_TABLE: newRecord = new DraftStateRecord(recno, this, parentModel); break; case EditorModel.FRANCHISE_STAGE_TABLE: newRecord = new FranchiseStageRecord(recno, this, parentModel); break; case EditorModel.GAME_OPTIONS_TABLE: newRecord = new GameOptionRecord(recno, this, parentModel); break; case EditorModel.PLAYER_AWARDS_TABLE: newRecord = new YearlyAwards(recno, this, parentModel); break; case EditorModel.FREE_AGENT_PLAYERS: newRecord = new FreeAgentPlayers(recno, this, parentModel); break; case EditorModel.COACHES_EXPECTED_SALARY: newRecord = new CoachExpectedSalary(recno, this, parentModel); break; case EditorModel.COACHING_HISTORY_TABLE: newRecord = new CoachHistory(recno, this, parentModel); break; case EditorModel.PROGRESSION_SCHEDULE: newRecord = new ProgressionSchedule(recno, this, parentModel); break; case EditorModel.USER_OPTIONS_TABLE: newRecord = new UserOptionRecord(recno, this, parentModel); break; case EditorModel.TEAM_RIVAL_HISTORY: newRecord = new TeamRivalHistory(recno, this, parentModel); break; case EditorModel.PRO_BOWL_PLAYERS: newRecord = new ProBowlPlayer(recno, this, parentModel); break; case EditorModel.USER_INFO_TABLE: newRecord = new UserInfoRecord(recno, this, parentModel); break; #region Streamed Data case EditorModel.COLLEGES_TABLE: newRecord = new CollegesRecord(recno, this, parentModel); break; case EditorModel.PLAYER_FIRST_NAMES: newRecord = new FirstNames(recno, this, parentModel); break; case EditorModel.PLAYER_LAST_NAMES: newRecord = new LastNames(recno, this, parentModel); break; case EditorModel.ROLES_DEFINE: newRecord = new PRDF(recno, this, parentModel); break; case EditorModel.ROLES_INFO: newRecord = new RoleInfo(recno, this, parentModel); break; case EditorModel.ROLES_PLAYER_EFFECTS: newRecord = new RolePlayerEffects(recno, this, parentModel); break; case EditorModel.ROLES_TEAM_EFFECTS: newRecord = new RoleTeamEffects(recno, this, parentModel); break; case EditorModel.STATS_REQUIRED: newRecord = new SuperStarStatsRequired(recno, this, parentModel); break; case EditorModel.PROGRESSION: newRecord = new PlayerProgression(recno, this, parentModel); break; case EditorModel.REGRESSION: newRecord = new PlayerRegression(recno, this, parentModel); break; case EditorModel.PTCB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTCE: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTDE: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTDT: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTFB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTFS: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTGA: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTHB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTKI: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTKP: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTMB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTOB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTPU: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTQB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTSS: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTTA: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTTE: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTWR: newRecord = new ProgressionTracking(recno, this, parentModel); break; #endregion case EditorModel.POSITION_SUBS: newRecord = new PlayerSubs(recno, this, parentModel); break; case EditorModel.DEPTH_CHART_SUBS: newRecord = new DepthChartSubs(recno, this, parentModel); break; case EditorModel.SALARY_CAP_INCREASE: newRecord = new SalaryCapIncrease(recno, this, parentModel); break; case EditorModel.PLAYER_MINIMUM_SALARY_TABLE: newRecord = new SalaryYearsPro(recno, this, parentModel); break; case EditorModel.PLAYER_SALARY_DEMAND_TABLE: newRecord = new PlayerSalaryDemands(recno, this, parentModel); break; case EditorModel.INACTIVE_TABLE: newRecord = new InactiveRecord(recno, this, parentModel); break; case EditorModel.LEAGUE_REVENUE_TABLE: newRecord = new LeagueRevenue(recno, this, parentModel); break; case EditorModel.OWNER_REVENUE_TABLE: newRecord = new OwnerRevenue(recno, this, parentModel); break; case EditorModel.WEEKLY_INCOME_TABLE: newRecord = new Income(recno, this, parentModel); break; case EditorModel.TEAM_WIN_LOSS_RECORD: newRecord = new TeamWinLossRecord(recno, this, parentModel); break; // DB Templates case EditorModel.PLAYER_OVERALL_CALC: newRecord = new OverallRecord(recno, this, parentModel); break; case EditorModel.PLAYBOOK_TABLE: newRecord = new FRAPlayBooks(recno, this, parentModel); break; default: newRecord = new TableRecordModel(recno, this, parentModel); break; } //Add the new record to our list of records recordList.Add(newRecord); return(newRecord); }