private void LoadJobs() { Facade.IJob facJob = new Facade.Job(); DataSet ds = null; int controlAreaId = 0; ConfigureDisplay(); if (Orchestrator.Globals.Configuration.UseControlAreaToFilterPCVsForReport && int.TryParse(cboControlAreas.SelectedValue, out controlAreaId)) { ds = facJob.GetJobsThatCanTakePCVs(controlAreaId); } else if (!Orchestrator.Globals.Configuration.UseControlAreaToFilterPCVsForReport) { ds = facJob.GetJobsThatCanTakePCVs(null); } if (ds != null && ds.Tables.Count > 0) { List <DataRow> jobDetails = null; DataView dv = new DataView(ds.Tables[0]); string sortExpression = JobSortCriteria + " " + JobSortDirection; dv.Sort = sortExpression.Trim(); if (m_jobId > 0) { //dgJobs.Columns[7].Visible = false; //dv.RowFilter = "JobId = " + m_jobId.ToString() + " AND DeliveryPointId = " + m_deliveryPointId.ToString(); jobDetails = ds.Tables[0].Rows.Cast <DataRow>().Where(dr => (int)dr["JobID"] == m_jobId && (int)dr["DeliveryPointID"] == m_deliveryPointId).ToList(); LoadJobDetails(jobDetails); LoadReport(m_jobId); dgJobs.Visible = false; } else { if (m_PointId > 0) { dv.RowFilter = "DeliveryPointId = " + m_PointId.ToString(); } else { dgJobs.Columns[7].Visible = true; } dgJobs.Visible = true; dgJobs.DataSource = dv; dgJobs.DataBind(); } dgPCVs.Visible = m_jobId > 0; reportViewer.Visible = m_jobId > 0 && m_job.PCVs.Count > 0; btnTakeOnJob.Enabled = m_jobId > 0; btnGenerateRedemptionForm.Enabled = m_jobId > 0; } else { PopulateStaticControls(); } }