public bool SavePatient()
 {
     if (formView.FormAction == 0)
     {
         if (BeforeSaveEvent != null)
         {
             BeforeSaveEventArgs e = new BeforeSaveEventArgs( );
             BeforeSaveEvent(this, e);
             if (e.Cancel)
             {
                 return(false);
             }
         }
         //新增病人
         OutPatient outpatient = new OutPatient( );
         outpatient.NewRegister( );
         int    patlistId = outpatient.PatListID;
         string visitno   = outpatient.VisitNo;
         outpatient           = PatientConvert.ConvertPatient((UIOutPatient)formView.Patient);
         outpatient.PatListID = patlistId;
         outpatient.VisitNo   = visitno;
         outpatient.UpdateRegister( );
         formView.Patient = PatientConvert.ConvertPatient(outpatient);
     }
     return(true);
 }
Example #2
0
        void controller_BeforeSaveEvent(object sender, BeforeSaveEventArgs e)
        {
            if (txtPatientName.Text == "")
            {
                MessageBox.Show("病人姓名不能为空!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPatientName.Focus( );
                e.Cancel = true;
                return;
            }

            if (txtCureDoctor.Text == "" || txtCureDoctor.MemberValue == null)
            {
                MessageBox.Show("就诊医生不能为空!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCureDoctor.Focus( );
                e.Cancel = true;
                return;
            }

            if (txtCureDept.Text == "" || txtCureDept.MemberValue == null)
            {
                MessageBox.Show("就诊科室不能为空!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCureDept.Focus( );
                e.Cancel = true;
                return;
            }
        }
        void controller_BeforeSavePrescriptionEvent(object sender, BeforeSaveEventArgs e)
        {
            string message = "";

            //保存处方前检查数据
            if (controller.CheckDataValidity(out message) == false)
            {
                MessageBox.Show(message, "数据检查", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                e.Cancel = true;
            }
        }
        /// <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);
        }