protected void _btnAbortSelected_Click(object sender, EventArgs e) { // Iterate through the Session variable, get the primary key and then abort the // relevant jobs. if (Session["tblSelected"] != null) { DataTable tblSelected = (DataTable)Session["tblSelected"]; for (int i = 0; i < tblSelected.Rows.Count; i++) { for (int j = 0; j < _gridViewClientJobs.Rows.Count; j++) { Label lblJobID = (Label)_gridViewClientJobs.Rows[j].FindControl("_lblJobID"); if (lblJobID != null) { if (lblJobID.Text == tblSelected.Rows[i]["id"].ToString()) { AbortJobRequest abortRequest = new AbortJobRequest(); abortRequest.ID = tblSelected.Rows[i]["id"].ToString(); abortRequest.Reason = "Aborted by client"; _jobService.AbortJob(abortRequest); break; } } } } GetClientJobs(); } else { UpdateUIState(); } }
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(); }
public void AbortJob(string jobId) { _CurrentOperationName = "getJobs"; var req = new AbortJobRequest { jobId = jobId }; base.abortJob(req); }
static AbortJobResponse AbortJob(HttpRequestMessageProperty httpRequest, string jobId) { try { BulkDataExchangeServicePortClient client = new BulkDataExchangeServicePortClient(BDXconfigName); using (OperationContextScope scope = new OperationContextScope(client.InnerChannel)) { OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, httpRequest); //Create the request AbortJobRequest req = new AbortJobRequest(); req.jobId = jobId; //Get the response AbortJobResponse resp = client.abortJob(req); if (resp.ack == BDX.AckValue.Success) { } else { throw new Exception(resp.errorMessage[0].message); } return resp; } } catch (Exception ex) { AbortJobResponse errResp = null; return errResp; } }