public void Execute(Task task) { Debug.WriteLine("Fujitsu.AFC.Operations.ArchiveCase.cs -> Processing Started."); var prfMonMethod = new PrfMon(); if (task.Pin == null) { var message = string.Format(TaskResources.OperationsTaskRequest_InvalidRequestNoPin, task.Name); _taskService.CompleteUnrecoverableTaskException(task, message); throw new UnRecoverableErrorException(message); } if (task.CaseId == null) { var message = string.Format(TaskResources.OperationsTaskRequest_InvalidRequestNoCaseId, task.Name, task.Pin.Value); _taskService.CompleteUnrecoverableTaskException(task, message); throw new UnRecoverableErrorException(message); } if (!_siteService.Query(x => x.Pin == task.Pin.Value).Any()) { var message = string.Format(TaskResources.OperationsTaskRequest_PinDoesNotExist, task.Name, task.Pin.Value); _taskService.CompleteUnrecoverableTaskException(task, message); throw new UnRecoverableErrorException(message); } if (!_libraryService.Query(x => x.CaseId == task.CaseId.Value).Any()) { var message = string.Format(TaskResources.OperationsTaskRequest_CaseIdDoesNotExist, task.Name, task.Pin.Value, task.CaseId.Value); _taskService.CompleteUnrecoverableTaskException(task, message); throw new UnRecoverableErrorException(message); } if (!_libraryService.Query(x => x.CaseId == task.CaseId.Value && x.Site.Pin == task.Pin.Value).Any()) { var message = string.Format(TaskResources.OperationsTaskRequest_PinDoesNotExistForTheSpecifiedCase, task.Name, task.Pin.Value, task.CaseId.Value); _taskService.CompleteUnrecoverableTaskException(task, message); throw new UnRecoverableErrorException(message); } task.SiteId = _caseService.ArchiveCase(task); Debug.WriteLine("Fujitsu.AFC.Operations.ArchiveCase.cs -> Completed Processing - PIN: {0} CaseId: {1} Duration: {2:0.000}s", task.Pin.Value, task.CaseId.Value, prfMonMethod.Stop()); }