Beispiel #1
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            frmEditPerson frm = new frmEditPerson();

            frm.person = null;
            frm.ShowDialog();
            loadGrid();
        }
Beispiel #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (dgPersons.SelectedRows[0] == null)
            {
                MessageBox.Show("Please select a person");
                return;
            }
            else
            {
                Person person = new Person();
                using (DBManager dm = new DBManager())
                {
                    int id = (int)dgPersons.SelectedRows[0].Cells[0].Value;

                    person.Find(dm, id);
                }

                frmEditPerson frm = new frmEditPerson();
                frm.person = person;
                frm.ShowDialog();
                loadGrid();
            }
        }