예제 #1
0
파일: MainForm.cs 프로젝트: yon28/VAV
 private void RemoveSelectedReward()
 {
     if (dgvRewards.SelectedCells.Count > 0)
     {
         DelReward form = new DelReward();
         if (form.ShowDialog(this) == DialogResult.OK)
         {
             Reward reward = (Reward)dgvRewards.SelectedCells[0].OwningRow.DataBoundItem;
             string del    = reward.Title.ToString();
             for (int i = 0; i < dgvEmployees.RowCount; i++)
             {
                 if (dgvEmployees[4, i].Value != null)
                 {
                     if (dgvEmployees[4, i].Value.ToString().Contains(del))
                     {
                         Employee employee = (Employee)dgvEmployees[4, i].OwningRow.DataBoundItem;
                         // employee.Rewards = employee.Rewards.Replace(del, "");
                         employee.Rewards.Remove(reward);
                         DisplayEmployee();
                     }
                 }
                 rewards.Remove(reward);
                 DisplayReward();
                 DisplayEmployee();
             }
         }
     }
 }
예제 #2
0
        private void RemoveReward()
        {
            if (dgvRewards.Rows.Count > 0)
            {
                var formSureRemove = new FormSureRemove(DeletingItem.Rewrad);

                if (formSureRemove.ShowDialog(this) == DialogResult.OK)
                {
                    Reward reward = (Reward)dgvRewards.SelectedCells[0].OwningRow.DataBoundItem;

                    _rewardsBL.Remove(reward);

                    foreach (var user in _usersBL.GetList())
                    {
                        foreach (var rew in user.Rewards)
                        {
                            if (rew == reward)
                            {
                                user.Rewards.Remove(reward);
                                break;
                            }
                        }
                    }
                }
            }
        }
        public IActionResult RemoveReward()
        {
            int rewardIdToRemove = int.Parse(Request.Form["rewardIdToRemove"]);

            _rewardsBL.Remove(new Entites.Reward(rewardIdToRemove, "", ""));

            return(RedirectToAction("Index"));
        }
예제 #4
0
        public ActionResult Delete(int rewardId)
        {
            var currentReward = rewardsBL.GetList().FirstOrDefault(u => u.ID == rewardId);

            if (currentReward != null)
            {
                rewardsBL.Remove(currentReward);
            }
            return(RedirectToAction("Index"));
        }
예제 #5
0
        private void RemoveReward()
        {
            if (dgvRewards.Rows.Count > 0)
            {
                var formSureRemove = new FormSureRemove(_QuestionWhenDeletingAnReward);

                if (formSureRemove.ShowDialog(this) == DialogResult.OK)
                {
                    Reward reward = (Reward)dgvRewards.SelectedCells[0].OwningRow.DataBoundItem;

                    _rewardsBL.Remove(reward);
                }
            }
        }