public override void ExecuteCmdlet()
        {
            string jobName = InputObject == null ? this.Name : InputObject.Name;
            JobOperationParameters parameters = new JobOperationParameters(this.BatchContext, this.WorkItemName,
                this.Name, this.InputObject, this.AdditionalBehaviors);

            ConfirmAction(
                Force.IsPresent,
                string.Format(Resources.RBJ_RemoveConfirm, jobName),
                Resources.RBJ_RemoveJob,
                jobName,
                () => BatchClient.DeleteJob(parameters));
        }
예제 #2
0
        /// <summary>
        /// Deletes the specified job
        /// </summary>
        /// <param name="parameters">The parameters indicating which job to delete</param>
        public void DeleteJob(JobOperationParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            if (parameters.Job != null)
            {
                parameters.Job.omObject.Delete(parameters.AdditionalBehaviors);
            }
            else
            {
                using (IWorkItemManager wiManager = parameters.Context.BatchOMClient.OpenWorkItemManager())
                {
                    wiManager.DeleteJob(parameters.WorkItemName, parameters.JobName, parameters.AdditionalBehaviors);
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Deletes the specified job
        /// </summary>
        /// <param name="parameters">The parameters indicating which job to delete</param>
        public void DeleteJob(JobOperationParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            if (parameters.Job != null)
            {
                parameters.Job.omObject.Delete(parameters.AdditionalBehaviors);
            }
            else
            {
                using (IWorkItemManager wiManager = parameters.Context.BatchOMClient.OpenWorkItemManager())
                {
                    wiManager.DeleteJob(parameters.WorkItemName, parameters.JobName, parameters.AdditionalBehaviors);
                }
            }
        }