private void patientAddBtn_Click(object sender, EventArgs e) { using (patientEdit frm = new patientEdit()) { if (frm.ShowDialog() == DialogResult.OK) { string familyName = frm.familyNameTextBox.Text; string name = frm.nameTextBox.Text; string fatherName = frm.fatherNameTextBox.Text; familyName = cutSpacesAndUnprintChars(familyName); name = cutSpacesAndUnprintChars(name); fatherName = cutSpacesAndUnprintChars(fatherName); if (dbm.AddPatient(familyName, name, fatherName, frm.birthDateTimePicker.Value, db.social_status.Where(p => p.soc_status.Equals(frm.socStatusComboBox.SelectedItem.ToString())).First().id, db.current_status.Where(p => p.curr_status.Equals(frm.currStatusComboBox.SelectedItem.ToString())).First().id) == null) { MessageBox.Show("Error", "Info", MessageBoxButtons.OK, MessageBoxIcon.Error); } //patiencesDataGridView.DataSource = db.patients.ToList(); //patiencesDataGridView.DataSource = dbm.GetExtPatients(); reloadData(); patiencesDataGridView.DataSource = db.ExtPatients.ToList(); } } }