Esempio n. 1
0
		protected override void OnExecute(CommandProcessor theProcessor, IUpdateContext updateContext)
		{
			var parms = new UpdateArchiveQueueParameters
			{
				ArchiveQueueKey = _archiveQueueKey,
				ArchiveQueueStatusEnum = _status,
				ScheduledTime = Platform.Time,
				StudyStorageKey = _studyStorageKey
			};


			var broker = updateContext.GetBroker<IUpdateArchiveQueue>();

			if (!broker.Execute(parms))
				throw new ApplicationException("UpdateArchiveQueueItemCommand failed");
		}
		/// <summary>
		/// Execute the command
		/// </summary>
		/// <param name="updateContext">Database update context.</param>
		/// <param name="theProcessor">The processor executing the command.</param>
		protected override void OnExecute(CommandProcessor theProcessor, IUpdateContext updateContext)
		{
		    var columns = new ArchiveStudyStorageUpdateColumns
		                      {
		                          ArchiveTime = Platform.Time,
		                          PartitionArchiveKey = _partitionArchiveKey,
		                          StudyStorageKey = _studyStorageKey,
		                          ArchiveXml = _archiveXml,
		                          ServerTransferSyntaxKey = _serverTransferSyntaxKey
		                      };


		    var insertBroker = updateContext.GetBroker<IArchiveStudyStorageEntityBroker>();

			ArchiveStudyStorage storage = insertBroker.Insert(columns);


		    var parms = new UpdateArchiveQueueParameters
		                    {
		                        ArchiveQueueKey = _archiveQueueKey,
		                        ArchiveQueueStatusEnum = ArchiveQueueStatusEnum.Completed,
		                        ScheduledTime = Platform.Time,
		                        StudyStorageKey = _studyStorageKey
		                    };


		    var broker = updateContext.GetBroker<IUpdateArchiveQueue>();

            if (!broker.Execute(parms))
                throw new ApplicationException("InsertArchiveStudyStorageCommand failed");
		}
		/// <summary>
		/// Update an <see cref="ArchiveQueue"/> entry.
		/// </summary>
		/// <param name="item">The item to update.</param>
		/// <param name="status">The status to set the entry to.</param>
		/// <param name="scheduledTime">The scheduled time to set the entry to.</param>
		/// <param name="updateContext">The update context</param>
		public bool UpdateArchiveQueue(IUpdateContext updateContext, ArchiveQueue item, ArchiveQueueStatusEnum status, DateTime scheduledTime)
		{
			UpdateArchiveQueueParameters parms = new UpdateArchiveQueueParameters();
			parms.ArchiveQueueKey = item.GetKey();
			parms.ArchiveQueueStatusEnum = status;
			parms.ScheduledTime = scheduledTime;
			parms.StudyStorageKey = item.StudyStorageKey;
			if (!String.IsNullOrEmpty(item.FailureDescription))
				parms.FailureDescription = item.FailureDescription;

			IUpdateArchiveQueue broker = updateContext.GetBroker<IUpdateArchiveQueue>();

			if (broker.Execute(parms))
			{
				return true;
			}

			Platform.Log(LogLevel.Error, "Unexpected failure updating ArchiveQueue entry {0}", item.GetKey());
			return false;
		}