private void DisplayTournamentGameOfficial() { int ctr = 0; referee = RefereeHelper.GetReferee(tournament); lsvTournamentOfficial.Items.Clear(); ListViewItem item; foreach (var official in referee) { item = lsvTournamentOfficial.Items.Add((++ctr).ToString()); item.SubItems.Add(official.official.officialID.ToString()); item.SubItems.Add(official.official.firstName); item.SubItems.Add(official.official.lastName); } }
private void lvOfficial_DoubleClick(object sender, EventArgs e) { int si = 0; try { si = lvOfficial.SelectedItems[0].Index; } catch { return; } foreach (var r in referee) { if (r.official.officialID == listGameOfficial[si].officialID) { MessageBox.Show(r.official.firstName + " is already on the list"); return; } } Referee refereeTemp = new Referee() { official = new GameOfficial() { officialID = listGameOfficial[si].officialID, }, tournament = new Tournament() { tournamentID = tournament.tournamentID } }; string message = listGameOfficial[si].firstName + " " + listGameOfficial[si].lastName; if (MessageBox.Show("Do you want to add [ " + message + " ]", "System", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { RefereeHelper.SaveReferee(refereeTemp); DisplayTournamentGameOfficial(); } }