protected override RISObject GetRISObject(DICOMObject dicomObject)
        {
            ImageObject risImage = new ImageObject();
            DICOMImageObject dicomImage = (DICOMImageObject)dicomObject;
            risImage.ImageInstance.Value = dicomImage.ImageInstance.Value;
            risImage.ImageClassUI.Value = dicomImage.ImageClassUI.Value;
            risImage.ImageNumber.Value = dicomImage.ImageNumber.Value;
            risImage.ImageDate.Value = DatabaseUtility.GetDateTime(dicomImage.ImageDate.Value, dicomImage.ImageTime.Value);
            risImage.EchoNumber.Value = dicomImage.EchoNumber.Value;
            risImage.NumberOfFrames.Value = dicomImage.NumberOfFrames.Value;
            risImage.AcquiredDate.Value = DatabaseUtility.GetDateTime(dicomImage.AcqDate.Value, dicomImage.AcqTime.Value);
            risImage.SliceLocation.Value = dicomImage.SliceLocation.Value;
            risImage.NumberOfSamples.Value = dicomImage.NumberOfSamples.Value;
            risImage.PhotoMetric.Value = dicomImage.PhotoMetric.Value;
            risImage.Rows.Value = dicomImage.Rows.Value;
            risImage.Columns.Value = dicomImage.Columns.Value;
            risImage.BitsStored.Value = dicomImage.BitsStored.Value;
            risImage.Path.Value = dicomImage.ObjectFile.Value;
            risImage.DeviceName.Value = dicomImage.DeviceName.Value;

            SeriesObject risSeries = new SeriesObject();
            risSeries.SeriesInstance.Value = dicomImage.SeriesInst.Value;
            risSeries.Load();
            if (risSeries.IsLoaded)
            {
                risImage.SeriesId.Value = risSeries.GetPrimaryKey().Value;
            }
            else
            {
                risImage = null;
            }
            return risImage;
        }
 protected override RISObject GetRISObject(DICOMObject dicomObject)
 {
     PatientObject risPatient = new PatientObject();
     DICOMPatientObject dicomPatient = (DICOMPatientObject)dicomObject;
     risPatient.ExternalPatientId.Value = dicomPatient.PatientID.Value;
     risPatient.Name.Value = dicomPatient.Name.Value;
     risPatient.DateOfBirth.Value = dicomPatient.DateOfBirth.Value;
     //risPatient.DateOfBirth.Value = DateTime.Now.ToString();
     risPatient.Gender.Value = dicomPatient.Gender.Value;
     return risPatient;
 }
 protected override void UpdateDICOMObject(DICOMObject dicomObject)
 {
     DICOMImageObject image = (DICOMImageObject)dicomObject;
     image.SyncTime.Value = DateTime.Now;
     image.Update(Constants.Database.SystemUserId);
 }
 protected override bool AreEqual(DICOMObject dicomObject, RISObject risObject)
 {
     DICOMImageObject dicomImage = (DICOMImageObject)dicomObject;
     ImageObject risImage = (ImageObject)risObject;
     return dicomImage.ImageInstance.Value.Equals(risImage.ImageInstance.Value);
 }
 protected abstract RISObject GetRISObject(DICOMObject dicomObject);
 protected abstract bool AreEqual(DICOMObject dicomObject,RISObject risObject);
        protected override RISObject GetRISObject(DICOMObject dicomObject)
        {
            StudyObject risStudy = new StudyObject();
            DICOMStudyObject dicomStudy = (DICOMStudyObject)dicomObject;
            risStudy.StudyStatusId.Value = Constants.StudyStatusTypes.PreRelease;
            risStudy.StudyInstance.Value = dicomStudy.StudyInstance.Value;
            risStudy.AccessionNumber.Value = dicomStudy.AccessionNumber.Value;
            if (((string)dicomStudy.StudyInstance.Value).Equals("1.2.840.113619.2.115.6319156.1266579799.0.2"))
            {
                int debug = 0;
            }
            risStudy.StudyDate.Value = DatabaseUtility.GetDateTime(dicomStudy.StudyDate.Value,dicomStudy.StudyTime.Value);

            //risStudy.Description.Value = dicomStudy.StudyDescription.Value;
            //SetReferringPhysician(dicomStudy, risStudy);
            AssignHospital(dicomStudy, risStudy);

            risStudy.PatientWeight.Value = dicomStudy.PatientsWeight.Value;

            ModalityObject modality = new ModalityObject();
            modality.Name.Value = dicomStudy.StudyModal.Value;
            modality.Load();
            if (!modality.IsLoaded)
            {
                modality.Save();
            }
            risStudy.ModalityId.Value = modality.ModalityId.Value;

            /*if (dicomStudy.StationName.Value != null)
            {
                StationObject station = new StationObject();
                station.ModalityId.Value = modality.GetPrimaryKey().Value;
                station.StationName.Value = dicomStudy.StationName.Value;
                station.Instituition.Value = dicomStudy.Instituition.Value;
                station.Load();
                if (!station.IsLoaded)
                {
                    station.Save();
                }
                risStudy.StationId.Value = station.GetPrimaryKey().Value;
            }*/

            if (dicomStudy.StudyDescription.Value != null)
            {
                ProcedureObject procedure = new ProcedureObject();
                procedure.Name.Value = dicomStudy.StudyDescription.Value;
                procedure.ModalityId.Value = modality.ModalityId.Value;
                procedure.Load();
                if (procedure.IsLoaded == false)
                {
                    procedure.Save();
                }
                risStudy.ProcedureId.Value = procedure.ProcedureId.Value;
            }

            PatientObject patient = new PatientObject();
            patient.ExternalPatientId.Value = dicomStudy.PatientID.Value;
            patient.Load();
            if (patient.IsLoaded)
            {
                risStudy.PatientId.Value = patient.GetPrimaryKey().Value;
            }
            else
            {
                patient.Name.Value = dicomStudy.PatientName.Value;
                patient.DateOfBirth.Value = dicomStudy.PatientDateOfBirth.Value;
                patient.Gender.Value = dicomStudy.PatientSex.Value;
                patient.Save();
                risStudy.PatientId.Value = patient.GetPrimaryKey().Value;
            }
            return risStudy;
        }
 protected override bool AreEqual(DICOMObject dicomObject, RISObject risObject)
 {
     DICOMPatientObject dicomPatient = (DICOMPatientObject)dicomObject;
     PatientObject risPatient = (PatientObject)risObject;
     return dicomPatient.PatientID.Value.Equals(risPatient.ExternalPatientId.Value);
 }
 protected override void UpdateDICOMObject(DICOMObject dicomObject)
 {
     DICOMStudyObject study = (DICOMStudyObject)dicomObject;
     study.SyncTime.Value = DateTime.Now;
     study.Update(Constants.Database.SystemUserId);
 }
 protected override bool AreEqual(DICOMObject dicomObject, RISObject risObject)
 {
     DICOMStudyObject dicomStudy = (DICOMStudyObject)dicomObject;
     StudyObject risStudy = (StudyObject)risObject;
     return dicomStudy.StudyInstance.Value.Equals(risStudy.StudyInstance.Value);
 }
 protected override void UpdateDICOMObject(DICOMObject dicomObject)
 {
     DICOMPatientObject patient = (DICOMPatientObject)dicomObject;
     patient.SyncTime.Value = DateTime.Now;
     patient.Update(Constants.Database.SystemUserId);
 }
 protected abstract void UpdateDICOMObject(DICOMObject dicomObject);
 protected void PerformPostSaveDICOMTasks(DICOMObject dicomObject)
 {
 }
        protected override RISObject GetRISObject(DICOMObject dicomObject)
        {
            SeriesObject risSeries = new SeriesObject();
            DICOMSeriesObject dicomSeries = (DICOMSeriesObject)dicomObject;
            risSeries.SeriesInstance.Value = dicomSeries.SeriesInstance.Value;
            risSeries.SeriesNumber.Value = dicomSeries.SeriesNumber.Value;
            risSeries.SeriesDate.Value = DatabaseUtility.GetDateTime(dicomSeries.SeriesDate.Value, dicomSeries.SeriesTime.Value);
            risSeries.Description.Value = dicomSeries.Description.Value;
            risSeries.PatientPosition.Value = dicomSeries.PatientPosition.Value;
            risSeries.Contrast.Value = dicomSeries.ContrastBo.Value;
            risSeries.ProtocolName.Value = dicomSeries.ProtocolNa.Value;
            risSeries.FrameOfReference.Value = dicomSeries.FrameOfRef.Value;
            risSeries.BodyPartExamined.Value = dicomSeries.BodyPartEx.Value;

            ModalityObject risModality = new ModalityObject();
            risModality.Name.Value = dicomSeries.Modality.Value;
            risModality.Load();
            if (!risModality.IsLoaded)
            {
                risModality.Save();
            }
            ModalityDetailObject modalityDetail = new ModalityDetailObject();
            modalityDetail.ModalityId.Value = risModality.GetPrimaryKey().Value;
            modalityDetail.Manufacturer.Value = dicomSeries.Manufactur.Value;
            modalityDetail.ModelName.Value = dicomSeries.ModelName.Value;
            modalityDetail.Load();
            if (!modalityDetail.IsLoaded)
            {
                modalityDetail.Save();
            }

            risSeries.ModalityDetailId.Value = modalityDetail.GetPrimaryKey().Value;

            risStudy = new StudyObject();
            risStudy.StudyInstance.Value = dicomSeries.StudyInsta.Value;
            risStudy.Load();
            if (risStudy.IsLoaded)
            {
                risSeries.StudyId.Value = risStudy.StudyId.Value;
                if (dicomSeries.StationName.Value != null)
                {
                    StationObject station = new StationObject();
                    station.ModalityId.Value = risModality.GetPrimaryKey().Value;
                    station.StationName.Value = dicomSeries.StationName.Value;
                    station.Instituition.Value = dicomSeries.Instituition.Value;
                    station.Load();
                    if (!station.IsLoaded)
                    {
                        station.Save();
                    }
                    risStudy.StationId.Value = station.GetPrimaryKey().Value;
                    if (station.HospitalId.Value != null)
                    {
                        risStudy.HospitalId.Value = station.HospitalId.Value;
                    }
                    if (station.ClientId.Value != null)
                    {
                        risStudy.ClientId.Value = station.ClientId.Value;
                    }
                    risStudy.Save();
                }
            }
            else
            {
                risSeries = null;
            }
            return risSeries;
        }
 protected override bool AreEqual(DICOMObject dicomObject, RISObject risObject)
 {
     DICOMSeriesObject dicomSeries = (DICOMSeriesObject)dicomObject;
     SeriesObject risSeries = (SeriesObject)risObject;
     return dicomSeries.SeriesInstance.Value.Equals(risSeries.SeriesInstance.Value);
 }