Esempio n. 1
0
        //Not completely implemented
        private void btnEditBottom_Click(object sender, EventArgs e)
        {
            Person pToEdit = new Person();

            pToEdit = (Person)dgvPerson.SelectedRows[0].DataBoundItem;
            frmAddGift edit = new frmAddGift((Gift)dgvGift.SelectedRows[0].DataBoundItem);

            edit.ShowDialog();

            if (edit.DialogResult == DialogResult.OK)
            {
                Gift newGift = new Gift();
                newGift = (Gift)edit.Tag;
                pToEdit.Gifts.Add(newGift);
                LoadData();

                dgvGift.DataSource = typeof(List <Gift>);
                dgvGift.DataSource = pToEdit.Gifts;
            }
        }
Esempio n. 2
0
        private void btnAddBottom_Click(object sender, EventArgs e)
        {
            Person personToAddTo = new Person();

            personToAddTo = (Person)dgvPerson.SelectedRows[0].DataBoundItem;
            frmAddGift addG = new frmAddGift((Person)dgvPerson.SelectedRows[0].DataBoundItem);

            addG.ShowDialog();

            if (addG.DialogResult == DialogResult.OK)
            {
                Gift newGift = new Gift();
                newGift = (Gift)addG.Tag;
                personToAddTo.Gifts.Add(newGift);
                LoadData();

                dgvGift.DataSource = typeof(List <Gift>);
                dgvGift.DataSource = personToAddTo.Gifts;
            }
        }