private void buttonDelete_Click(object sender, EventArgs e) { DialogResult confirm = MessageBox.Show("Matchup akan didelete, Apakah anda yakin?", "Confirm", MessageBoxButtons.YesNo); if (confirm == System.Windows.Forms.DialogResult.Yes) { int matchupSelectedIndex = dataGridViewMatchup.CurrentCell.RowIndex; string selectedMatchupId = dataGridViewMatchup.Rows[matchupSelectedIndex].Cells[0].Value.ToString(); selectedMatchup = Matchups.SelectMatchup(selectedMatchupId); List <MatchupEntries> pair = Matchups.GetEntries(selectedMatchup); selectedMatchupEntry1 = pair[0]; selectedMatchupEntry2 = pair[1]; MatchupEntries.Delete(selectedMatchup, selectedMatchupEntry1.Team); MatchupEntries.Delete(selectedMatchup, selectedMatchupEntry2.Team); Matchups.DeleteMatchup(selectedMatchup); MessageBox.Show("Delete successful."); } else { MessageBox.Show("Delete matchup canceled."); } }
private void buttonEditMatchup_Click(object sender, EventArgs e) { int matchupSelectedIndex = dataGridViewMatchup.CurrentCell.RowIndex; string selectedMatchupId = dataGridViewMatchup.Rows[matchupSelectedIndex].Cells[0].Value.ToString(); selectedMatchup = Matchups.SelectMatchup(selectedMatchupId); List <MatchupEntries> pair = Matchups.GetEntries(selectedMatchup); selectedMatchupEntry1 = pair[0]; selectedMatchupEntry2 = pair[1]; FormEditMatchup formEditMatchup = new FormEditMatchup(); formEditMatchup.Owner = this; formEditMatchup.ShowDialog(); }