Пример #1
0
        private bool UpdateMedicalRecord(string status)
        {
            bool result;
            //Update medical record
            MedicalRecord medicalRecord = new MedicalRecord
            {
                MedicalRecordID = (int)textMedicalRecordID.EditValue,
                DoctorID        = UserBusiness.User.UserID,
                Diagnostic      = memoDiagnostic.Text,
                ExamineDate     = (DateTime)dateExamineDay.EditValue,
                ExamineReason   = memoExamineReason.Text,
                Note            = textNote.Text,
                PatientID       = (int)textPatientID.EditValue,
                Status          = status
            };

            if (dateReExamineDay.EditValue != null)
            {
                medicalRecord.ReExamineDate = (DateTime)dateReExamineDay.EditValue;
            }

            result = medicalRecordBusiness.Update(medicalRecord);

            //Delete old service detail
            result = result && serviceDetailBusiness.DeleteByMedicalRecordID(medicalRecord.MedicalRecordID);

            //Insert new Service detail
            DataTable     services      = gridService.DataSource as DataTable;
            ServiceDetail serviceDetail = new ServiceDetail
            {
                MedicalRecordID = medicalRecord.MedicalRecordID
            };

            foreach (DataRow row in services.Rows)
            {
                serviceDetail.ServiceID  = (int)row["ServiceID"];
                serviceDetail.ServiceFee = serviceBusiness.GetByServiceID(serviceDetail.ServiceID).ServiceFee;
                result = result && (serviceDetailBusiness.Insert(serviceDetail) > 0);
            }

            return(result);
        }