Example #1
0
        private void RegisterNewReward()
        {
            RewardForm form = new RewardForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                rewards.Add(form.Title, form.Description);
                DisplayReward();
            }
        }
Example #2
0
 private void EditSelectedReward()
 {
     if (dgvRewards.SelectedCells.Count > 0)
     {
         Reward     reward = (Reward)dgvRewards.SelectedCells[0].OwningRow.DataBoundItem;
         RewardForm form   = new RewardForm(reward);
         if (form.ShowDialog(this) == DialogResult.OK)
         {
             reward.Title       = form.txtTitle.Text;
             reward.Description = form.txtDescription.Text;
             DisplayReward();
         }
     }
 }
Example #3
0
        private void AddReward(object sender, EventArgs e)
        {
            Reward reward;

            RewardForm uf = new RewardForm();

            if (uf.ShowDialog() == DialogResult.OK)
            {
                reward = new Reward
                {
                    Title       = uf.Title,
                    Description = uf.Description
                };

                Rewards.AddReward(reward);
            }

            DisplayRewards();
        }
Example #4
0
        private void ChangeReward()
        {
            if (ctlRewardsGridView.SelectedCells.Count > 0)
            {
                Reward     reward     = (Reward)ctlRewardsGridView.SelectedCells[0].OwningRow.DataBoundItem;
                RewardForm rewardForm = new RewardForm(reward);


                if (rewardForm.ShowDialog(this) == DialogResult.OK)
                {
                    reward.Title       = rewardForm.Title;
                    reward.Description = rewardForm.Description;

                    logic.ChangeReward(reward);

                    DisplayRewards();
                    DisplayUsers();
                }
            }
        }
Example #5
0
        public void UpdateReward(object sender, EventArgs e)
        {
            var rewardDT = new Reward
            {
                ID          = (int)ctlRewardDataGridView.SelectedCells[0].OwningRow.Cells[0].Value,
                Title       = (string)ctlRewardDataGridView.SelectedCells[0].OwningRow.Cells[1].Value,
                Description = (string)ctlRewardDataGridView.SelectedCells[0].OwningRow.Cells[2].Value
            };

            RewardForm form = new RewardForm(rewardDT);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                rewardDT.Title       = form.Title;
                rewardDT.Description = form.Description;
            }

            Rewards.UpdateReward(rewardDT);

            DisplayUsers();
            DisplayRewards();
        }