示例#1
0
 public WorkItemQueryResponse Query(WorkItemQueryRequest request)
 {
     try
     {
         return WorkItemService.Instance.Query(request);
     }
     catch (Exception e)
     {
         Platform.Log(LogLevel.Error, e);
         var message = SR.ExceptionErrorProcessingQuery;
         var exceptionMessage = String.Format("{0}\nDetail:{1}", message, e.Message);
         throw new WorkItemServiceException(exceptionMessage);
     }
 }
示例#2
0
        private void UpdateReindexing()
        {
            if (_activityMonitor == null || !_activityMonitor.IsConnected)
            {
                Reindexing = false;
                return;
            }
            
            var request = new WorkItemQueryRequest { Type = ReindexRequest.WorkItemTypeString };
            IEnumerable<WorkItemData> reindexItems = null;
            
            try
            {
                Platform.Log(LogLevel.Debug, "Querying for a re-index work item that is in progress.");

                Platform.GetService<IWorkItemService>(s => reindexItems = s.Query(request).Items);
                Reindexing = reindexItems != null && reindexItems.Any(item => item.Status == WorkItemStatusEnum.InProgress);
            }
            catch (Exception e)
            {
                Reindexing = false;
                Platform.Log(LogLevel.Debug, e);
            }
        }
示例#3
0
        public WorkItemQueryResponse Query(WorkItemQueryRequest request)
        {
            var response = new WorkItemQueryResponse();
            using (var context = new DataAccessContext())
            {
                var broker = context.GetWorkItemBroker();
 
                var dbList = broker.GetWorkItems(request.Type, request.Status, request.StudyInstanceUid, request.Identifier);

                var results = new List<WorkItemData>();

                foreach (var dbItem in dbList)
                {
                    results.Add(WorkItemDataHelper.FromWorkItem(dbItem));
                }

                response.Items = results.ToArray();
            }
            return response;
        }
示例#4
0
		public void OpenStudy()
		{
			try
			{
			    int numberOfSelectedStudies = Context.SelectedStudies.Count;
                if (Context.SelectedStudies.Count == 0)
					return;

				if (!PermissionsHelper.IsInRole(ImageViewer.AuthorityTokens.Study.Open))
				{
					Context.DesktopWindow.ShowMessageBox(SR.MessageOpenStudyPermissionDenied, MessageBoxActions.Ok);
					return;
				}

				int numberOfLoadableStudies = GetNumberOfLoadableStudies();
				if (numberOfLoadableStudies != numberOfSelectedStudies)
				{
					int numberOfNonLoadableStudies = numberOfSelectedStudies - numberOfLoadableStudies;
					string message;
					if (numberOfSelectedStudies == 1)
					{
						message = SR.MessageCannotOpenNonStreamingStudy;
					}
					else
					{
						if (numberOfNonLoadableStudies == 1)
							message = SR.MessageOneNonStreamingStudyCannotBeOpened;
						else 
							message = String.Format(SR.MessageFormatXNonStreamingStudiesCannotBeOpened, numberOfNonLoadableStudies);
					}

					Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.Ok);
					return;
				}

				if (Context.SelectedServers.Count == 1 && Context.SelectedServers[0].IsLocal)
				{
					// #10746:  Workstation: the user must be warned when opening studies that are being processed
					// This implementation does not cover all the possible cases of when a study might be modified.
					// For example: if a study is being retrieved, WQI failed and deleted, the study is technically
					// not complete and user should be warned.  The risk of such cases are mitigated by the fact the
					// user is warned about the failed WQI.  This implementation is only meant to warn user if the
					// study is "being" or "about to" be modified before opening the study.
					try
					{
						Platform.Log(LogLevel.Debug, "Querying for a StudyUpdate work items that are in progress for the studies that are being opened.");

						var anyStudyBeingModified = Context.SelectedStudies.Any(study =>
						{
							var request = new WorkItemQueryRequest { StudyInstanceUid = study.StudyInstanceUid };
							IEnumerable<WorkItemData> workItems = null;

							Platform.GetService<IWorkItemService>(s => workItems = s.Query(request).Items);
							return workItems.Any(IsNonTerminalStudyUpdateItem);
						});

						if (anyStudyBeingModified)
						{
							var message = Context.SelectedStudies.Count == 1 ? SR.MessageStudyIsBeingModified : SR.MessageStudiesAreBeingModified;

							if (DialogBoxAction.No == Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo))
								return;
						}
					}
					catch (Exception e)
					{
						Platform.Log(LogLevel.Debug, e);
					}
				}

				var helper = new OpenStudyHelper
				                 {
				                     WindowBehaviour = ViewerLaunchSettings.WindowBehaviour,
				                     AllowEmptyViewer = ViewerLaunchSettings.AllowEmptyViewer
				                 };

				foreach (var study in Context.SelectedStudies)
					helper.AddStudy(study.StudyInstanceUid, study.Server);

				helper.Title = ImageViewerComponent.CreateTitle(GetSelectedPatients());
				helper.OpenStudies();
			}
			catch (Exception e)
			{
				ExceptionHandler.Report(e, Context.DesktopWindow);
			}
		}
示例#5
0
 public WorkItemQueryResponse Query(WorkItemQueryRequest request)
 {
     return(Channel.Query(request));
 }