private void btnShowReport_Click(object sender, EventArgs e) { this.Hide(); string[] input = new string[2]; frmReportViewer frm = new frmReportViewer(); string query = ""; if (cboGroupBy.Text == "Gender") { input[0] = "TraineeSummaryByGender"; query += " SELECT Gender, Count(*) AS Counter FROM View_TraineeSummaryByGender GROUP BY Gender HAVING 1=1 "; } else if (cboGroupBy.Text == "Academic Level") { input[0] = "TraineeSummaryByAcademicLevel"; query += " SELECT AcademicLevel, Count(*) AS Counter FROM View_TraineeSummaryByAcademicLevel GROUP BY AcademicLevel HAVING 1=1 "; } else if (cboGroupBy.Text == "Registration Date") { input[0] = "TraineeSummaryByRegistrationDate"; query += " SELECT RegistrationDate, Count(*) AS Counter FROM View_TraineeSummaryByRegistrationDate GROUP BY RegistrationDate HAVING 1=1 "; } else if (cboGroupBy.Text == "Course") { input[0] = "TraineeSummaryByCourse"; query += " SELECT Course, Count(*) AS Counter FROM View_TraineeSummaryByCourse GROUP BY Course HAVING 1=1 "; } if (chkRegistrationDateFrom.Checked) { query += " AND RegistrationDate >= '" + dtpRegistrationDateFrom.Value.ToShortDateString() + "'"; } if (chkRegistrationDateTo.Checked) { query += " AND RegistrationDate <= '" + dtpRegistrationDateTo.Value.ToShortDateString() + "'"; } input[1] = query; frm.Tag = input; frm.ShowDialog(); }
private void btnShowReport_Click(object sender, EventArgs e) { this.Hide(); string[] input = new string[2]; if (this.Tag.ToString() == "TraineeList") { frmReportViewer frm = new frmReportViewer(); string query = "SELECT * FROM View_TraineeList WHERE 1=1 "; if (chkBirthDateFrom.Checked) { query += " AND BirthDate >= '" + dtpBirthDateFrom.Value.ToShortDateString() + "'"; } if (chkBirthDateTo.Checked) { query += " AND BirthDate <= '" + dtpBirthDateTo.Value.ToShortDateString() + "'"; } if (cboGender.Text != "All") { query += " AND Gender = '" + cboGender.Text + "'"; } if (cboAcademicLevel.Text != "All") { query += " AND AcademicLevel = '" + cboAcademicLevel.Text + "'"; } input[0] = "TraineeList"; input[1] = query; frm.Tag = input; frm.ShowDialog(); } else if (this.Tag.ToString() == "TraineeCourseList") { frmReportViewer frm = new TIMS.frmReportViewer(); string query = "SELECT * FROM View_TraineeCourseList WHERE 1=1 "; if (chkBirthDateFrom.Checked) { query += " AND RegistrationDate >= '" + dtpRegistrationDateFrom.Value.ToShortDateString() + "'"; } if (chkBirthDateTo.Checked) { query += " AND RegistrationDate <= '" + dtpRegistrationDateTo.Value.ToShortDateString() + "'"; } if (cboTrainee.Text != "All") { query += " AND Fullname = '" + cboTrainee.Text + "'"; } if (cboCourse.Text != "All") { query += " AND Course = '" + cboCourse.Text + "'"; } input[0] = "TraineeCourseList"; input[1] = query; frm.Tag = input; frm.ShowDialog(); } else if (this.Tag.ToString() == "TraineePaymentList") { frmReportViewer frm = new TIMS.frmReportViewer(); string query = "SELECT * FROM View_TraineePaymentList WHERE 1=1 "; if (chkTraineePaymentFrom.Checked) { query += " AND PaymentDate >= '" + dtpTraineePaymentFrom.Value.ToShortDateString() + "'"; } if (chkTraineePaymentTo.Checked) { query += " AND PaymentDate <= '" + dtpTraineePaymentTo.Value.ToShortDateString() + "'"; } if (cboTraineePayment.Text != "All") { query += " AND Fullname = '" + cboTraineePayment.Text + "'"; } if (cboCoursePayment.Text != "All") { query += " AND Course = '" + cboCoursePayment.Text + "'"; } input[0] = "TraineePaymentList"; input[1] = query; frm.Tag = input; frm.ShowDialog(); } }
private void toolStripButtonReport_Click(object sender, EventArgs e) { frmReportViewer frmReportViewer = new frmReportViewer(); frmReportViewer.ShowDialog(); }