/// <summary> /// Method for generating the DRR chart /// </summary> private void generateDrrChart() { if (DbConnector.OpenSQLConnection()) // Open connection to the database { ReportsGenerator reportGen = new ReportsGenerator(); var chartValues = new List <DRRAnalysis>(); foreach (var d in reportGen.DrrAnalysis()) { if (d.Tester == txtSearchDRR.Text) { chartValues.Add(new DRRAnalysis { ProjectName = d.ProjectName, DRR = d.DRR }); } } drrPointChart.DataSource = chartValues; drrPointChart.Series["DRR"].XValueMember = "ProjectName"; drrPointChart.Series["DRR"].YValueMembers = "DRR"; drrPointChart.Series["DRR"].YValueType = ChartValueType.Int32; } else { // Connection could not be opened MessageBox.Show("Connection to the database could not be established", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } DbConnector.CloseSQLConnection(); // Close connection to the database }
/// <summary> /// Method for populating the DataDridViews /// </summary> public void populateDataGridDRRAnalysis() { if (DbConnector.OpenSQLConnection()) // Open connection to the database { // Connection opened ReportsGenerator reportGen = new ReportsGenerator(); dgvDRRAnalysis.AutoGenerateColumns = false; // To only show the columns needed dgvDRRAnalysis.DataSource = reportGen.DrrAnalysis(); txtSearchDRE.Text = ""; } else { // Connection could not be opened MessageBox.Show("Connection to the database could not be established", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } DbConnector.CloseSQLConnection(); // Close connection to the database }