Example #1
0
        private void AddNewAward()
        {
            AwardForm form = new AwardForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                Awards award = new Awards();
                award.Title       = form.Title;
                award.Description = form.Description;
                award.Id          = awardId++;
                //awards.Add(award);         //*
                data.AddAward(award);
                //refreshAwardsGrid();
                _awards.Add(award);

                refreshAwardsGrid();
            }
        }
Example #2
0
        private void EditSelectedAward()
        {
            if (ctlUsers.SelectedCells.Count > 0)
            {
                Awards award = (Awards)ctlAwards.SelectedCells[0].OwningRow.DataBoundItem;

                AwardForm form = new AwardForm(award);
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    award.Title       = form.Title;
                    award.Description = form.Description;
                    BindingList <Awards> temp = new BindingList <Awards>(_awards);
                    for (int i = 0; i < temp.Count; i++)
                    {
                        if (award.Id == temp[i].Id)
                        {
                            _awards[i] = award;
                        }
                    }
                }
            }
        }