private void DeleteUser() { if (listOfUsers.GetList() != null & listOfUsers.GetList().Count() > 0) { var form = new ConfirmForm((User)ctrGridUser.SelectedCells[0].OwningRow.DataBoundItem); if (form.ShowDialog() == DialogResult.OK) { listOfUsers.Remove((User)ctrGridUser.SelectedCells[0].OwningRow.DataBoundItem); ctrGridUser.DataSource = null; ctrGridUser.DataSource = listOfUsers; } } }
private void DeleteAward() { if (listOfAwards != null & listOfAwards.GetList().Count() > 0) { var form = new ConfirmForm((Award)ctrGridAward.SelectedCells[0].OwningRow.DataBoundItem); if (form.ShowDialog() == DialogResult.OK) { var deletedAward = (Award)ctrGridAward.SelectedCells[0].OwningRow.DataBoundItem; foreach (User user in listOfUsers.GetList()) { user.Awards.Remove(deletedAward); } listOfAwards.Remove(deletedAward); DisplayAwards(); DisplayUsers(); } } }