private void PopulateDoctors() { cmbDoctorName.DisplayMember = "FullName"; cmbDoctorName.ValueMember = "DoctorId"; DataBase db = new DoctorData(); List <Doctor> list = db.GetList().ConvertAll(x => x as Doctor); List <Doctor> doctors = list.Except(_student.Doctors.ConvertAll(x => x as Doctor)).ToList(); cmbDoctorName.DataSource = GetOtherDoctors(list, _student.Doctors.ConvertAll(x => x as Doctor));// db.GetList(); cmbDoctorName.SelectedIndex = -1; cmbDoctorName.Refresh(); }
private void addDoctorToolStripMenuItem_Click(object sender, EventArgs e) { //DoctorAddOld ad = new DoctorAddOld(_student); DoctorAdd ad = new DoctorAdd(new AddDoctorToExistingStudent(_student)); ad.ShowDialog(); if (ad.DialogResult == DialogResult.OK) { DataBase db = new DoctorData(); _student.Doctors = db.GetList(_student.PersonId); PopulateDoctors(); } }
public void PopulateDoctors() { //cmbSpecialistId.SelectedIndexChanged -= cmbSpecialistId_SelectedIndexChanged; DoctorData dd = new DoctorData(); List <Doctor> doctors = dd.GetList().ConvertAll(x => x as Doctor); cmbSpecialistId.DataSource = null; cmbSpecialistId.DataSource = doctors; cmbSpecialistId.ValueMember = "PersonId"; cmbSpecialistId.DisplayMember = "FullName"; cmbSpecialistId.Refresh(); //cmbSpecialistId.SelectedIndex = -1; //cmbSpecialistId.SelectedIndexChanged += cmbSpecialistId_SelectedIndexChanged; }
public void PopulateDoctors() { cmbDoctorName.DisplayMember = "FullName"; //cmbDoctorName.ValueMember = "PersonId"; DataBase db = new DoctorData(); List <Doctor> list = db.GetList().ConvertAll(x => x as Doctor); BindingSource bs = new BindingSource(); List <Doctor> otherDoctors = GetOtherDoctors(list, _student.Doctors.ConvertAll(x => x as Doctor)); bs.DataSource = otherDoctors; cmbDoctorName.DataSource = bs; cmbDoctorName.SelectedIndex = -1; cmbDoctorName.Refresh(); }
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(); } } }
public void LoadFullList() { ep.SetError(dgDoctor, ""); try { //DataBase db; //if(rbAllStudents.Checked) // db = new StudenData(); //else DataBase db = new DoctorData(); _allDoctors = db.GetList(); _filteredDoctorList = _allDoctors; } catch (Exception ex) { ep.SetError(dgDoctor, ex.Message); } }