예제 #1
0
        public async Task ExecuteAsync()
        {
            try
            {
                switch (ButtonName)
                {
                case Constant.Buttons.SUBMIT:
                    Logger.LogDebug($"{Constant.Names.ApplicationName} - {Constant.Buttons.SUBMIT} button clicked.");
                    var recordExists = await DoesRecordExistAsync();

                    if (recordExists == false)
                    {
                        await DeleteJobErrors(SvcManager, IdentityCurrentUser, WorkspaceArtifactId, CurrentArtifactId);

                        //Add the record to the Export Manager queue table
                        var resourceGroupId = await ArtifactQueries.GetResourcePoolArtifactIdAsync(SvcManager, IdentitySystem, WorkspaceArtifactId);

                        await SqlQueryHelper.InsertRowIntoExportManagerQueueAsync(DbContextEdds, WorkspaceArtifactId, Priority, CurrentArtifactId, resourceGroupId, SelectedObjectType);

                        //Clear reset Job Statistics
                        await ResetJobStatisticsAsync(SvcManager, WorkspaceArtifactId, IdentityCurrentUser, CurrentArtifactId);

                        //Set the Export Job RDO status to Validating
                        await UpdateJobStatusAsync(SvcManager, WorkspaceArtifactId, IdentityCurrentUser, Constant.Guids.ObjectType.ExportUtilityJob, CurrentArtifactId, Constant.Guids.Field.ExportUtilityJob.Status, Constant.Status.Job.SUBMITTED);
                    }
                    break;

                case Constant.Buttons.CANCEL:
                    Logger.LogDebug($"{Constant.Names.ApplicationName} - {Constant.Buttons.CANCEL} button clicked.");
                    var artifactId = await RetrieveIdByArtifactIdAsync();

                    //Clear reset Job Statistics
                    await ResetJobStatisticsAsync(SvcManager, WorkspaceArtifactId, IdentityCurrentUser, CurrentArtifactId);

                    if (artifactId > 0)
                    {
                        //Set the Export Job RDO status to Cancel Requested
                        await UpdateJobStatusAsync(SvcManager, WorkspaceArtifactId, IdentityCurrentUser, Constant.Guids.ObjectType.ExportUtilityJob, CurrentArtifactId, Constant.Guids.Field.ExportUtilityJob.Status, Constant.Status.Job.CANCELREQUESTED);

                        //Set the Export Job record in the Manager Queue to Cancel Requested
                        await UpdateJobStatusInManagerQueueAsync(DbContextEdds, WorkspaceArtifactId, CurrentArtifactId, Constant.Status.Queue.CANCELLATION_REQUESTED);
                    }
                    break;
                }
            }
            catch (AdminMigrationUtilityException ex)
            {
                throw new AdminMigrationUtilityException(ex.Message);
            }
        }
예제 #2
0
        public async Task ExecuteAsync()
        {
            try
            {
                bool recordExists;

                switch (ButtonName)
                {
                case Constant.Buttons.VALIDATE:
                    Logger.LogDebug($"{Constant.Names.ApplicationName} - {Constant.Buttons.VALIDATE} button clicked.");
                    recordExists = await DoesRecordExistAsync();

                    if (recordExists == false)
                    {
                        await DeleteJobErrors(SvcManager, IdentityCurrentUser, WorkspaceArtifactId, CurrentArtifactId);

                        //Add the record to the Import Manager queue table
                        var resourceGroupId = await ArtifactQueries.GetResourcePoolArtifactIdAsync(SvcManager, IdentitySystem, WorkspaceArtifactId);

                        await SqlQueryHelper.InsertRowIntoImportManagerQueueAsync(DbContextEdds, WorkspaceArtifactId, 1, CurrentUserArtifactId, CurrentArtifactId, resourceGroupId, SelectedObjectType, Constant.ImportUtilityJob.JobType.VALIDATE);

                        //Set the Import Job RDO status to Validating
                        await UpdateJobStatusAsync(SvcManager, WorkspaceArtifactId, IdentityCurrentUser, Constant.Guids.ObjectType.ImportUtilityJob, CurrentArtifactId, Constant.Guids.Field.ImportUtilityJob.Status, Constant.Status.Job.SUBMITTED);
                    }
                    break;

                case Constant.Buttons.SUBMIT:
                    Logger.LogDebug($"{Constant.Names.ApplicationName} - {Constant.Buttons.SUBMIT} button clicked.");
                    recordExists = await DoesRecordExistAsync();

                    if (recordExists == false)
                    {
                        await DeleteJobErrors(SvcManager, IdentityCurrentUser, WorkspaceArtifactId, CurrentArtifactId);

                        //Add the record to the Import Manager queue table
                        Int32 resourceGroupId = await ArtifactQueries.GetResourcePoolArtifactIdAsync(SvcManager, IdentitySystem, WorkspaceArtifactId);

                        await SqlQueryHelper.InsertRowIntoImportManagerQueueAsync(DbContextEdds, WorkspaceArtifactId, 1, CurrentUserArtifactId, CurrentArtifactId, resourceGroupId, SelectedObjectType, Constant.ImportUtilityJob.JobType.VALIDATE_SUBMIT);

                        //Set the Import Job RDO status to Validating
                        await UpdateJobStatusAsync(SvcManager, WorkspaceArtifactId, IdentityCurrentUser, Constant.Guids.ObjectType.ImportUtilityJob, CurrentArtifactId, Constant.Guids.Field.ImportUtilityJob.Status, Constant.Status.Job.SUBMITTED);

                        //Mark job as being submitted for migration
                        await ArtifactQueries.MarkImportJobAsSubmittedForMigration(SvcManager, IdentityCurrentUser, WorkspaceArtifactId, CurrentArtifactId);
                    }
                    break;

                case Constant.Buttons.CANCEL:
                    Logger.LogDebug($"{Constant.Names.ApplicationName} - {Constant.Buttons.CANCEL} button clicked.");
                    var id = await RetrieveIdByArtifactIdAsync();

                    if (id > 0)
                    {
                        //Set the Import Job RDO status to Cancel Requested
                        await ArtifactQueries.UpdateRdoJobTextFieldAsync(SvcManager, WorkspaceArtifactId, IdentityCurrentUser, Constant.Guids.ObjectType.ImportUtilityJob, CurrentArtifactId, Constant.Guids.Field.ImportUtilityJob.Status, Constant.Status.Job.CANCELREQUESTED);

                        //Set the Import Job record in the Manager Queue to Cancel Requested
                        await UpdateJobStatusInManagerQueueAsync(DbContextEdds, WorkspaceArtifactId, CurrentArtifactId, Constant.Status.Queue.CANCELLATION_REQUESTED);
                    }
                    break;
                }
            }
            catch (AdminMigrationUtilityException ex)
            {
                throw new AdminMigrationUtilityException(ex.Message);
            }
        }