Exemplo n.º 1
0
 private void DeleteAward()
 {
     if (listOfAwards != null && listOfAwards.GetList().Count() > 0)
     {
         int   id           = (int)ctrGridAward.Rows[ctrGridAward.SelectedCells[0].RowIndex].Cells[2].Value;
         Award deletedAward = new Award();
         foreach (Award aw in listOfAwards.GetList())
         {
             if (aw.AwardId == id)
             {
                 deletedAward = aw;
             }
         }
         var form = new ConfirmForm(deletedAward);
         if (form.ShowDialog() == DialogResult.OK)
         {
             foreach (User user in listOfUsers.GetList())
             {
                 user.Awards.Remove(deletedAward);
             }
             listOfAwards.Remove(deletedAward);
             DisplayAwards();
             DisplayUsers();
         }
     }
 }
Exemplo n.º 2
0
 private void DeleteUser()
 {
     if (listOfUsers.GetList() != null && listOfUsers.GetList().Count() > 0)
     {
         UserViewModel viewModel = (UserViewModel)ctrGridUser.SelectedCells[0].OwningRow.DataBoundItem;
         User          user      = new User();
         foreach (User us in listOfUsers.GetList())
         {
             if (us.Id == viewModel.Id)
             {
                 user = us;
             }
         }
         var form = new ConfirmForm(user);
         if (form.ShowDialog() == DialogResult.OK)
         {
             listOfUsers.Remove(user);
             DisplayUsers();
         }
     }
 }