public void SaveDicom(Dicom dicom) { using (var dataContext = new eHealthCareEntities()) { try { dicom.UniqueIdentifier = uniqueGuid; dataContext.Dicoms.Add(dicom); dataContext.SaveChanges(); } catch (DbEntityValidationException ex) { throw new Exception(ex.EntityValidationErrors.GetValidationErrors()); } catch { throw; } } }
private void UploadButtonClick(object sender, RoutedEventArgs e) { try { var dicomRepository = new DicomDataRepository(UniqueIdentifier); var dicom = new EHealthCareDataAccess.Dicom(); var image = new DicomImage(file.Dataset); dicom.DateTime = DateTime.Now; dicom.Dicom1 = ImageToByteArray(image.RenderImage()); dicom.PatientId = this.PatientId; dicom.UniqueIdentifier = this.UniqueIdentifier; dicom.Subject = txtSubject.Text.Trim(); dicom.ProviderId = E_HealthCareProviderApp.Properties.Settings.Default.ProviderId; dicomRepository.SaveDicom(dicom); } catch (Exception ex) { MessageBox.Show(ex.Message); } // Re Load List View LoadDicom(); }