Exemplo n.º 1
0
        private void btn_AddAward_Click(object sender, EventArgs e)
        {
            var form = new AwardForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                awardList.Add(new Award(form.Title, form.Description));
            }
        }
Exemplo n.º 2
0
        private void btn_EditAward_Click(object sender, EventArgs e)
        {
            var award = dataGridView2.CurrentRow?.DataBoundItem as Award;

            if (award != null)
            {
                var form = new AwardForm(award.Title, award.Description);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    award.Title       = form.Title;
                    award.Description = form.Description;

                    dataGridView2.Refresh();
                }
            }
        }
        private void btn_EditAward_Click(object sender, EventArgs e)
        {
            var award = dgv_Awards.CurrentRow?.DataBoundItem as Award;

            if (award != null)
            {
                var form = new AwardForm(award.Title, award.Description);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    award.Title       = form.Title;
                    award.Description = form.Description;
                    awardBL.Edit(award);
                    DisplayUsers();
                    DisplayAwards();
                }
            }
        }
Exemplo n.º 4
0
        private void btn_EditAward_Click(object sender, EventArgs e)
        {
            var award = dataGridView2.CurrentRow?.DataBoundItem as Award;

            if (award != null)
            {
                var form = new AwardForm(award.Title, award.Description);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    foreach (var user in userBL.GetList().Where(u => u.GetAwards().Contains(award.Title)))
                    {
                        user.DeleteAward(award.Title);
                        user.AddAward(form.Title);
                    }

                    award.Title       = form.Title;
                    award.Description = form.Description;

                    DisplayUsers();
                    DisplayAwards();
                }
            }
        }