Example #1
0
        private void _menuItemAbortJob_Click(object sender, EventArgs e)
        {
            try
            {
                using (JobServiceClient jobService = new JobServiceClient())
                {
                    string address = string.Format("{0}/JobService.svc", _wcfAddress);
                    jobService.Endpoint.Address = new System.ServiceModel.EndpointAddress(address);

                    //Abort each selected job using the AbortJob WCF Service
                    foreach (DataGridViewRow selectedJob in _dgvJobs.SelectedRows)
                    {
                        AbortJobRequest abortJobRequest = new AbortJobRequest();
                        abortJobRequest.ID = (string)selectedJob.Cells[JobProcessorConstants.Database.GuidColumn].Value; //"cGuid" is the ID (Guid) column name in the database
                        jobService.AbortJob(abortJobRequest);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }

            GetClientJobs();
        }