public void ReprocessWorkQueueItem(ServerEntityKey itemKey) { if (itemKey != null) { Model.WorkQueue item = Model.WorkQueue.Load(itemKey); var controller = new WorkQueueController(); try { if (controller.ReprocessWorkQueueItem(item)) { InformationDialog.Message = SR.ReprocessOK; InformationDialog.MessageType = MessageBox.MessageTypeEnum.INFORMATION; InformationDialog.Show(); } else { InformationDialog.Message = SR.ReprocessFailed; InformationDialog.MessageType = MessageBox.MessageTypeEnum.ERROR; InformationDialog.Show(); } } catch(InvalidStudyStateOperationException ex) { ShowErrorMessage(ex.Message); } } }
protected void ApplyChanges() { if (WorkQueues != null) { var toBeUpdatedList = new List<Model.WorkQueue>(); foreach (Model.WorkQueue item in WorkQueues) { if (item != null) { toBeUpdatedList.Add(item); } } if (toBeUpdatedList.Count > 0) { DateTime newScheduleTime = Platform.Time; if (WorkQueueSettingsPanel.NewScheduledDateTime != null && WorkQueueSettingsPanel.ScheduleNow == false) { newScheduleTime = WorkQueueSettingsPanel.NewScheduledDateTime.Value; } if (newScheduleTime < Platform.Time && WorkQueueSettingsPanel.ScheduleNow == false) { MessageDialog.MessageType = MessageBox.MessageTypeEnum.ERROR; MessageDialog.Message = HttpContext.GetGlobalResourceObject("SR","WorkQueueRescheduleFailed_MustBeInFuture") as string; MessageDialog.Show(); ModalDialog.Show(); } else { DateTime expirationTime = newScheduleTime.AddSeconds(WorkQueueSettings.Default.WorkQueueExpireDelaySeconds); WorkQueuePriorityEnum priority = WorkQueueSettingsPanel.SelectedPriority; try { var controller = new WorkQueueController(); bool result = controller.RescheduleWorkQueueItems(toBeUpdatedList, newScheduleTime, expirationTime, priority); if (result) { if (WorkQueueUpdated != null) WorkQueueUpdated(toBeUpdatedList); } else { Platform.Log(LogLevel.Error, "Unable to reschedule work queue items for user"); MessageDialog.MessageType = MessageBox.MessageTypeEnum.ERROR; MessageDialog.Message = "Unable to reschedule this/these work queue items"; MessageDialog.Show(); } } catch (Exception e) { Platform.Log(LogLevel.Error, "Unable to reschedule work queue items for user : {0}", e.StackTrace); MessageDialog.MessageType = MessageBox.MessageTypeEnum.ERROR; MessageDialog.Message = String.Format(HttpContext.GetGlobalResourceObject("SR", "WorkQueueRescheduleFailed_Exception") as string, e.Message); MessageDialog.Show(); } } } } }
private void PreResetConfirmDialog_Confirmed(object data) { Hide(); var key = data as ServerEntityKey; if (key != null) { var adaptor = new WorkQueueAdaptor(); Model.WorkQueue item = adaptor.Get(key); if (item == null) { String errorMessage = SR.WorkQueueNotAvailable; EventsHelper.Fire(Error, this, new WorkQueueItemResetErrorEventArgs(errorMessage, null)); } else { var controller = new WorkQueueController(); DateTime scheduledTime = item.ScheduledTime; if (scheduledTime < Platform.Time) scheduledTime = Platform.Time.AddSeconds(WorkQueueSettings.Default.WorkQueueProcessDelaySeconds); DateTime expirationTime = item.ExpirationTime; if (expirationTime < scheduledTime) expirationTime = scheduledTime.AddSeconds(WorkQueueSettings.Default.WorkQueueExpireDelaySeconds); try { var items = new List<Model.WorkQueue>(); items.Add(item); controller.ResetWorkQueueItems(items, scheduledTime, expirationTime); Platform.Log(LogLevel.Info, "{0} Work Queue item reset: Key={1}.", item.WorkQueueTypeEnum, item.GetKey()); if (WorkQueueItemReseted != null) WorkQueueItemReseted(item); if (OnHide != null) OnHide(); } catch (Exception e) { Platform.Log(LogLevel.Error, e, "Unable to reset {0} work queue item. Key={1}.", item.WorkQueueTypeEnum, item.GetKey()); String errorMessage = String.Format(SR.WorkQueueResetFailed, e.Message); EventsHelper.Fire(Error, this, new WorkQueueItemResetErrorEventArgs(errorMessage, e)); } } } }
private void PreDeleteConfirmDialog_Confirmed(object data) { Hide(); var key = data as ServerEntityKey; if (key != null) { var adaptor = new WorkQueueAdaptor(); Model.WorkQueue item = adaptor.Get(key); if (item == null) { MessageBox.Message = SR.WorkQueueNotAvailable; MessageBox.MessageType = MessageBox.MessageTypeEnum.ERROR; MessageBox.Show(); } else { if (item.WorkQueueStatusEnum == WorkQueueStatusEnum.InProgress) { MessageBox.Message = SR.WorkQueueBeingProcessed_CannotDelete; MessageBox.MessageType = MessageBox.MessageTypeEnum.ERROR; MessageBox.Show(); return; } try { bool successful; var controller = new WorkQueueController(); var items = new List<Model.WorkQueue>(); items.Add(item); successful = controller.DeleteWorkQueueItems(items); if (successful) { Platform.Log(LogLevel.Info, "Work Queue item deleted by user : Item Key={0}", item.GetKey().Key); if (WorkQueueItemDeleted != null) WorkQueueItemDeleted(item); if (OnHide != null) OnHide(); } else { Platform.Log(LogLevel.Error, "PreResetConfirmDialog_Confirmed: Unable to delete work queue item. GUID={0}", item.GetKey().Key); MessageBox.Message = SR.WorkQueueDeleteFailed; MessageBox.MessageType = MessageBox.MessageTypeEnum.ERROR; MessageBox.Show(); } } catch (Exception e) { Platform.Log(LogLevel.Error, "PreResetConfirmDialog_Confirmed: Unable to delete work queue item. GUID={0} : {1}", item.GetKey().Key, e.StackTrace); MessageBox.Message = String.Format(SR.WorkQueueDeleteFailed_WithException, e.Message); MessageBox.MessageType = MessageBox.MessageTypeEnum.ERROR; MessageBox.Show(); } } } }
private void ReprocessWorkQueueItem(Model.WorkQueue item) { try { var controller = new WorkQueueController(); if (controller.ReprocessWorkQueueItem(item)) { MessageBox.Message = SR.ReprocessOK; MessageBox.MessageType = MessageBox.MessageTypeEnum.INFORMATION; MessageBox.Show(); } else { ShowErrorMessage(SR.ReprocessFailed); } } catch(InvalidStudyStateOperationException ex) { ShowErrorMessage(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { WorkQueueController controller = new WorkQueueController(); WorkQueueDataList.DataSource = controller.GetWorkQueueOverview(); DataBind(); }