void controller_AfterSavedEvent(object sender, AfterSavedEventArgs e) { if (e.Cancel) { MessageBox.Show(e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { controller.ReadPatientNotBalancePrescription(false); } }
/// <summary> /// 保存处方 /// </summary> public bool SavePrescription() { DataTable tbPresc = formView.Prescriptions; if (tbPresc.Rows.Count == 0) { return(false); } if (BeforeSavePrescriptionEvent != null) { BeforeSaveEventArgs be = new BeforeSaveEventArgs( ); BeforeSavePrescriptionEvent(this, be); if (be.Cancel == true) { return(false); } } OutPatient patient = PatientConvert.ConvertPatient((UIOutPatient)formView.Patient); DataTable tbAmbit = GetPrescriptionAmbitList( ); Prescription[] prescriptions = GetPrescriptionsFromDataTable(); AfterSavedEventArgs e = new AfterSavedEventArgs( ); try { bool success = prescController.SavePrescription(patient, prescriptions); if (success) { FillPrescData(prescriptions, tbPresc); } } catch (Exception err) { e.Cancel = true; e.Message = err.Message; return(false); } if (AfterSavedEvent != null) { AfterSavedEvent(this, e); } return(true); }