Beispiel #1
0
        private async Task UpdateRedactionCountFieldValueAsync(Guid countFieldGuid)
        {
            var countFieldName = await GetCountFieldNameAsync(countFieldGuid);

            var countFieldValue = await GetCountFieldValueAsync(countFieldGuid);

            RaiseMessage($"Retrieving current {countFieldName}");

            //retrieve imported redaction count field on import job
            var currentRedactionCount = await ArtifactQueries.RetrieveImportJobRedactionCountFieldValueAsync(
                AgentHelper.GetServicesManager(),
                _executionIdentity,
                WorkspaceArtifactId,
                _importJobArtifactId,
                countFieldGuid);

            RaiseMessage($"Current {countFieldName} = {currentRedactionCount}");
            var newRedactionCount = currentRedactionCount + countFieldValue;

            RaiseMessage($"New {countFieldName} = {newRedactionCount}");
            RaiseMessage($"Updating current {countFieldName}");

            //update imported redaction count field on import job
            await ArtifactQueries.UpdateImportJobRedactionCountFieldValueAsync(
                AgentHelper.GetServicesManager(),
                _executionIdentity,
                WorkspaceArtifactId,
                _importJobArtifactId,
                countFieldGuid,
                newRedactionCount);

            RaiseMessage($"Updated {countFieldName}");
        }
        private async Task <Boolean> AfterProcessingAllLinesAsync()
        {
            string errorContext = $"An error occured when updating total redaction count on the import job. [ImportJobArtifactId: {_importJobArtifactId}]";

            try
            {
                //update import file redaction count field on import job
                await ArtifactQueries.UpdateImportJobRedactionCountFieldValueAsync(
                    AgentHelper.GetServicesManager(),
                    ExecutionIdentity.CurrentUser,
                    WorkspaceArtifactId,
                    _importJobArtifactId,
                    Constant.Guids.Field.MarkupUtilityImportJob.ImportFileRedactionCount,
                    _importFileRedactionCount);

                RaiseMessage($"Updated import file redaction count ({_importFileRedactionCount})");

                //update expected redaction count field on import job
                await ArtifactQueries.UpdateImportJobRedactionCountFieldValueAsync(
                    AgentHelper.GetServicesManager(),
                    ExecutionIdentity.CurrentUser,
                    WorkspaceArtifactId,
                    _importJobArtifactId,
                    Constant.Guids.Field.MarkupUtilityImportJob.ExpectedRedactionCount,
                    _expectedRedactionCount);

                RaiseMessage($"Updated expected redaction count ({_expectedRedactionCount})");
            }
            catch (Exception ex)
            {
                throw new MarkupUtilityException(errorContext, ex);
            }

            return(true);
        }