private void AddRecord(object sender, RoutedEventArgs e) { if (cboxDocsList.SelectedIndex == -1) { MessageBox.Show("Please select doctor"); return; } if (string.IsNullOrEmpty(txtTher.Text.Trim()) || string.IsNullOrEmpty(txtDiag.Text.Trim())) { MessageBox.Show("PLease enter data"); return; } registry.AddRecord(ModelCreator.CreateRecord(PatientsPage.instance.lstPatients.SelectedValue as PatientDTO, cboxDocsList.SelectedValue as DoctorDTO, txtDiag.Text, txtTher.Text, txtAdd.Text)); MessageBox.Show("Record added!"); this.Close(); }