Пример #1
0
        private void AddReward()
        {
            var rewardForm = new RewardForm();

            if (rewardForm.ShowDialog() == DialogResult.OK)
            {
                var reward = new Reward(rewardList.Count == 0 ? 0 : rewardList.Max(u => u.ID) + 1, rewardForm.Title, rewardForm.Description);
                rewardList.Add(reward);
            }
        }
Пример #2
0
 private void EditReward()
 {
     if (ctlRewardGrid.SelectedCells.Count != 0)
     {
         var reward     = rewardList.First(r => r.ID == SelectedEntityID(ctlRewardGrid));
         var rewardForm = new RewardForm(reward);
         if (rewardForm.ShowDialog() == DialogResult.OK)
         {
             reward.Title       = rewardForm.Title;
             reward.Description = rewardForm.Description;
         }
     }
     else
     {
         MessageBox.Show($"Вы не выбрали награду для редактирования.", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }