Beispiel #1
0
        protected override void OnExecute(CommandProcessor theProcessor, IUpdateContext updateContext)
        {
            string seriesUid = _file.DataSet[DicomTags.SeriesInstanceUid].GetString(0, String.Empty);
            string sopUid = _file.DataSet[DicomTags.SopInstanceUid].GetString(0, String.Empty);
            ImageSetDescriptor imageSet = new ImageSetDescriptor(_file.DataSet);
            ReconcileStudyQueueDescription queueDesc = GetQueueEntryDescription(_storageLocation, _file);
			ReconcileStudyWorkQueueData detailsData = new ReconcileStudyWorkQueueData
			{
				StoragePath = _reconcileImageStorage.GetFolderPath(),
				Details = new ImageSetDetails(_file.DataSet)
			};
			detailsData.Details.InsertFile(_file);
			
            IInsertStudyIntegrityQueue broker = updateContext.GetBroker<IInsertStudyIntegrityQueue>();
            InsertStudyIntegrityQueueParameters parameters = new InsertStudyIntegrityQueueParameters
                         	{
                         		Description = queueDesc.ToString(),
                         		StudyInstanceUid = _storageLocation.StudyInstanceUid,
                         		ServerPartitionKey = _storageLocation.ServerPartition.Key,
                         		StudyStorageKey = _storageLocation.Key,
                         		StudyIntegrityReasonEnum = _reason,
                         		SeriesInstanceUid = seriesUid,
                         		SeriesDescription = sopUid,
                         		SopInstanceUid =
                         			_file.DataSet[DicomTags.SopInstanceUid].GetString(0,
                         			                                                  String
                         			                                                  	.
                         			                                                  	Empty),
                         		StudyData = XmlUtils.SerializeAsXmlDoc(imageSet),
                         		Details = XmlUtils.SerializeAsXmlDoc(detailsData),
                         		GroupID = _uidGroup,
                         		UidRelativePath =
                         			_reconcileImageStorage.GetSopRelativePath(
                         			_file.DataSet[DicomTags.SopInstanceUid].ToString())
                         	};

        	StudyIntegrityQueue item = broker.FindOne(parameters);
            if (item == null)
            {
                throw new ApplicationException("Unable to update reconcile queue");
            }

            _siqItem = item;
            if (!parameters.Inserted)
            {
                // Need to re-use the path that's already assigned for this entry
                ReconcileStudyWorkQueueData data = XmlUtils.Deserialize<ReconcileStudyWorkQueueData>(item.Details);
                data.Details.InsertFile(_file);

                XmlDocument updatedQueueDataXml = XmlUtils.SerializeAsXmlDoc(data);
                IStudyIntegrityQueueEntityBroker updateBroker = updateContext.GetBroker<IStudyIntegrityQueueEntityBroker>();
                StudyIntegrityQueueUpdateColumns columns = new StudyIntegrityQueueUpdateColumns
                                                           	{Details = updatedQueueDataXml};
            	updateBroker.Update(item.GetKey(), columns);
            }
        }
 static public StudyIntegrityQueue Insert(IUpdateContext update, StudyIntegrityQueue entity)
 {
     var broker = update.GetBroker<IStudyIntegrityQueueEntityBroker>();
     var updateColumns = new StudyIntegrityQueueUpdateColumns();
     updateColumns.ServerPartitionKey = entity.ServerPartitionKey;
     updateColumns.StudyStorageKey = entity.StudyStorageKey;
     updateColumns.InsertTime = entity.InsertTime;
     updateColumns.StudyData = entity.StudyData;
     updateColumns.StudyIntegrityReasonEnum = entity.StudyIntegrityReasonEnum;
     updateColumns.GroupID = entity.GroupID;
     updateColumns.Details = entity.Details;
     updateColumns.Description = entity.Description;
     StudyIntegrityQueue newEntity = broker.Insert(updateColumns);
     return newEntity;
 }