Exemplo n.º 1
0
        private void removeDoctorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int    rowindex = doctorGridView1.CurrentCell.RowIndex;
            int    doctorid = (int)doctorGridView1.Rows[rowindex].Cells[0].Value;
            Person doctor   = _student.Doctors.Find(x => x.PersonId == doctorid);

            if (doctor != null)
            {
                if (MessageBox.Show("Are you sure you want to remove doctor '" + doctor.FullName + "' from this student?", "Remove Doctor", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    DataBase db = new DoctorData();
                    db.Remove(doctor, _student.PersonId);
                    _student.Doctors = db.GetList(_student.PersonId);
                    PopulateDoctors();
                }
            }
        }