private void DeleteButtonClick(object sender, RoutedEventArgs e)
 {
     var id = int.Parse(((Button)sender).CommandParameter.ToString());
     var dicomRepository = new DicomDataRepository(EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier);
     dicomRepository.DeleteDicom(EHealthCareDesktopApp.Properties.Settings.Default.PatientID, id);
     LoadDicom();
 }
 private void LoadDicom()
 {
     try
     {
         var dicomRepository = new DicomDataRepository(EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier);
         var patientDicom = dicomRepository.GetAllDicom(EHealthCareDesktopApp.Properties.Settings.Default.PatientID);
         listView.ItemsSource = patientDicom;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void ViewDicomButtonClick(object sender, RoutedEventArgs e)
        {
            var id = int.Parse(((Button)sender).CommandParameter.ToString());
            var dicomRepository = new DicomDataRepository(EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier);

            try
            {
                var dicom = dicomRepository.GetDicomById(EHealthCareDesktopApp.Properties.Settings.Default.PatientID, id);
                var displayDicomImage = new DisplayDicomImage(ByteArrayToImage(dicom.Dicom1));
                displayDicomImage.ShowDialog();
            }
            catch(Exception ex){
                MessageBox.Show(ex.ToString());
                return;
            }
        }
 private void LoadDicom()
 {
     try
     {
         var dicomRepository = new DicomDataRepository(UniqueIdentifier);
         var patientDicom = dicomRepository.GetAllDicom(this.PatientId);
         listView.ItemsSource = patientDicom;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void DeleteButtonClick(object sender, RoutedEventArgs e)
 {
     var id = int.Parse(((Button)sender).CommandParameter.ToString());
     var dicomRepository = new DicomDataRepository(UniqueIdentifier);
     dicomRepository.DeleteDicom(this.PatientId, id);
     LoadDicom();
 }
        private void ViewDicomButtonClick(object sender, RoutedEventArgs e)
        {
            if (((Button)sender).CommandParameter == null) return;

            var id = int.Parse(((Button)sender).CommandParameter.ToString());
            var dicomRepository = new DicomDataRepository(UniqueIdentifier);

            try
            {
                var dicom = dicomRepository.GetDicomById(this.PatientId, id);
                var displayDicomImage = new DisplayDicomImage(ByteArrayToImage(dicom.Dicom1));
                displayDicomImage.ShowDialog();
            }
            catch(Exception ex){
                MessageBox.Show(ex.ToString());
                return;
            }
        }
 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();
 }