private void ok_Click(object sender, EventArgs e) { if (textBoxMrn.Text.Length == 0) { MessageBox.Show(PleaseEnterAMedicalRecordNumberToAddAnAppointment); return; } if (!_init) { _init = true; this.Enabled = false; this._appointment.MRN = this.textBoxMrn.Text; this._appointment.Load(); AddAppointmentView view; if (this._appointment.apptid.HasValue) { AppointmentList appts = new AppointmentList(); appts.LoadFullList(); appts.LoadList(); Appointment goldenAppointment = appts.First(appt => appt.apptID == this._appointment.apptid); view = new AddAppointmentView(goldenAppointment, this._clinicId, AddAppointmentView.Mode.Copy); } else { view = new AddAppointmentView(this._appointment.MRN, this._clinicId); } view.ShowDialog(); this.Close(); } }