public WorkItemInsertResponse Insert(WorkItemInsertRequest request) { // TODO (CR Jun 2012): The fact that there is special processing in here for particular types of work items // indicates there is something wrong with the design that may make adding custom work item types difficult. // Maybe the different "processors" need to perform the insert, or at least have some kind of method (rule) // for processing the insert? var response = new WorkItemInsertResponse(); var now = DateTime.Now; var item = new Interface.WorkItem { Request = request.Request, Progress = request.Progress, Type = request.Request.WorkItemType, Priority = request.Request.Priority, ScheduledTime = now.AddSeconds(WorkItemServiceSettings.Default.InsertDelaySeconds), ProcessTime = now.AddSeconds(WorkItemServiceSettings.Default.InsertDelaySeconds), DeleteTime = now.AddMinutes(WorkItemServiceSettings.Default.DeleteDelayMinutes), ExpirationTime = now.AddSeconds(WorkItemServiceSettings.Default.ExpireDelaySeconds), RequestedTime = now, Status = WorkItemStatusEnum.Pending }; IoC.Get <IWorkItemOperation>().AddWorkItem(item); WorkItemPublishSubscribeHelper.PublishWorkItemChanged(WorkItemsChangedEventType.Update, response.Item); if (WorkItemProcessor.Instance != null) { WorkItemProcessor.Instance.SignalThread(); } return(response); }
public static WorkItemData FromWorkItem(Interface.WorkItem item) { return(new WorkItemData { Type = item.Type, Status = item.Status, Priority = item.Priority, DeleteTime = item.DeleteTime, ExpirationTime = item.ExpirationTime, ScheduledTime = item.ScheduledTime, RequestedTime = item.RequestedTime, FailureCount = item.FailureCount, Identifier = item.Oid, ProcessTime = item.ProcessTime, StudyInstanceUid = item.StudyInstanceUid, Request = item.Request, Progress = item.Progress }); }