private void SavePlayers() { try { SortPlayers(); SetRanksBasedOnRowPositions(); bool successful = dataStore.SavePlayersToDataStore(playerList); if (successful) { gridPlayers.Refresh(); frmMessage messageForm = new frmMessage(); messageForm.SetMessageText("All Players have been saved."); messageForm.ShowDialog(); } } catch (Exception ex) { frmMessage messageForm = new frmMessage(); messageForm.SetMessageText("Error saving players: " + ex.Message); messageForm.ShowDialog(); } }
private void btnStart_Click(object sender, EventArgs e) { meeting = dataStore.GetMeetingByDate(dateCheckIn.Value); if (meeting == null) { frmMessage message = new frmMessage(); message.SetMessageText("Meeting not found."); message.ShowDialog(); return; // meeting = new clsChessClubMeeting(); // meeting.MeetingDate = dateCheckIn.Value; } InitializePlayerLists(); EnableControls(true); if (meeting.initialRankings.Count == 0) { clsChessClubMeeting previousMeeting = dataStore.GetPreviousMeetingFromDataStore(meeting.MeetingDate); if (previousMeeting == null) { List <clsPlayer> playerList = dataStore.LoadPlayersFromDataStore(); foreach (clsPlayer player in playerList) { clsPlayerRanking playerRanking = new clsPlayerRanking(); playerRanking.PlayerID = player.PlayerID; playerRanking.Rank = player.Rank; playerRanking.PlayerFullName = player.FullName; meeting.initialRankings.Add(playerRanking); } meeting.initialRankings.Sort(rankComparer); } else { meeting.initialRankings = previousMeeting.finalRankings; } } }