private StudyHistoryUpdateColumns CreateStudyHistoryRecord(ImageSetDetails details)
        {
            var columns = new StudyHistoryUpdateColumns
                                                	{
                                                		InsertTime = Platform.Time,
                                                		StudyHistoryTypeEnum = StudyHistoryTypeEnum.Duplicate,
                                                		StudyStorageKey = StorageLocation.GetKey(),
                                                		DestStudyStorageKey = StorageLocation.GetKey(),
                                                		StudyData = XmlUtils.SerializeAsXmlDoc(_currentStudyInfo)
                                                	};

            var changeLog = new ProcessDuplicateChangeLog
                                                  	{
                                                  		Action = _processDuplicateEntry.QueueData.Action,
                                                        DuplicateDetails = details,
                                                  		StudySnapShot = _currentStudyInfo,
                                                  		StudyUpdateCommands = _studyUpdateCommands,
                                                        UserName = _processDuplicateEntry.QueueData.UserName
                                                  	};
        	XmlDocument doc = XmlUtils.SerializeAsXmlDoc(changeLog);
            columns.ChangeDescription = doc;
            return columns;
        }
        private ImageSetDetails LoadDuplicateDetails()
        {
            IList<WorkQueueUid> uids = LoadAllWorkQueueUids();
            ImageSetDetails details = null;
            foreach(WorkQueueUid uid in  uids)
            {
                DicomFile file = LoadDuplicateDicomFile(uid, true);

                if (details == null)
                    details = new ImageSetDetails(file.DataSet);

                details.InsertFile(file);
            }

            return details;
        }
        private void LogHistory(ImageSetDetails details)
        {
            IPersistentStore store = PersistentStoreRegistry.GetDefaultStore();
            using (IUpdateContext ctx = store.OpenUpdateContext(UpdateContextSyncMode.Flush))
            {
                Platform.Log(LogLevel.Info, "Logging study history record...");
                IStudyHistoryEntityBroker broker = ctx.GetBroker<IStudyHistoryEntityBroker>();
                StudyHistoryUpdateColumns recordColumns = CreateStudyHistoryRecord(details);
                StudyHistory entry = broker.Insert(recordColumns);
                if (entry != null)
                    ctx.Commit();
                else
                    throw new ApplicationException("Unable to log study history record");
            }

            HistoryLogged = true;
        }
Ejemplo n.º 4
0
 public InconsistentDataSIQRecord(StudyIntegrityQueue queue)
 {
     _queueItem = queue;
     ReconcileStudyWorkQueueData data = XmlUtils.Deserialize<ReconcileStudyWorkQueueData>(queue.Details);
     _conflictingImageDetails = data.Details;
     _conflictingImageDescriptor = XmlUtils.Deserialize<ImageSetDescriptor>(queue.StudyData);
     StudyStorage storage = StudyStorage.Load(HttpContextData.Current.ReadContext, queue.StudyStorageKey);
     Study study = storage.LoadStudy(HttpContextData.Current.ReadContext);
     _existingStudyInfo = new StudyInformation(new ServerEntityAttributeProvider(study));
 }