示例#1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            FrmReport frmReport = new FrmReport();

            if (cboReport.SelectedIndex == 0)   //  exam result
            {
                ExamineeTakeBLL         examineeTakeBLL  = new ExamineeTakeBLL();
                List <ExamResultReport> examResult       = new List <ExamResultReport>();
                ReportParameter[]       reportParameters = new ReportParameter[1];

                if (rdbIn.Checked)
                {
                    examResult          = examineeTakeBLL.GetExamResultList(chkInclude.Checked, dtpIn.Value, null);
                    reportParameters[0] = new ReportParameter("ExamResultDate", "Exam result in " + dtpIn.Value.ToShortDateString());
                }
                else if (rdbFrom.Checked)
                {
                    examResult          = examineeTakeBLL.GetExamResultList(chkInclude.Checked, dtpFrom.Value, dtpTo.Value);
                    reportParameters[0] = new ReportParameter("ExamResultDate", "Exam result from " + dtpFrom.Value.ToShortDateString() + " to " + dtpTo.Value.Date.ToShortDateString());
                }

                frmReport.LoadReport("ExamResultDS", examResult, "PresentationLayer.Reports.ExamResultReport.rdlc", reportParameters);
            }
            else if (cboReport.SelectedIndex == 1)  //  examinee list
            {
                ExamineeBLL           examineeBLL      = new ExamineeBLL();
                List <ExamineeReport> examineeReport   = new List <ExamineeReport>();
                ReportParameter[]     reportParameters = new ReportParameter[1];

                if (rdbIn.Checked)
                {
                    examineeReport      = examineeBLL.GetExamineeList(dtpIn.Value, null);
                    reportParameters[0] = new ReportParameter("ExamineeDate", "Examinees registered/added in " + dtpIn.Value.ToShortDateString());
                }
                else if (rdbFrom.Checked)
                {
                    examineeReport      = examineeBLL.GetExamineeList(dtpFrom.Value, dtpTo.Value);
                    reportParameters[0] = new ReportParameter("ExamineeDate", "Examinees registered/added from " + dtpFrom.Value.ToShortDateString() + " to " + dtpTo.Value.Date.ToShortDateString());
                }

                frmReport.LoadReport("ExamineeDS", examineeReport, "PresentationLayer.Reports.ExamineeReport.rdlc", reportParameters);
            }

            frmReport.ShowDialog(this);
        }
示例#2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (!rdbIn.Checked && !rdbFrom.Checked)
            {
                lblPrintStatus.Text = "  Please choose date.";
            }
            else
            {
                lblPrintStatus.Text = string.Empty;

                //string exeFolder = Application.StartupPath;
                //string reportPath = Path.Combine(exeFolder, @"Reports\ExamineeCodeReport.rdlc");

                IList <ExamineeCodeReport> codeReports;
                ReportParameter[]          reportParameters = new ReportParameter[1];

                FrmReport frmReport = new FrmReport();

                if (rdbIn.Checked)
                {
                    //reportParameters[0] = new ReportParameter("ExamCodeDate", "Exam codes issued in " + dtpIn.Value.Date.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture));
                    reportParameters[0] = new ReportParameter("ExamCodeDate", "Exam codes issued in " + dtpIn.Value.ToShortDateString());
                    codeReports         = _examineeTakeBLL.GetExamineeCodeReport(dtpIn.Value, null);

                    frmReport.LoadReport("ExamineeCodeReport", codeReports, "PresentationLayer.Reports.ExamineeCodeReport.rdlc", reportParameters);
                    frmReport.ShowDialog(this);
                }
                else
                {
                    if (dtpFrom.Value.Date >= dtpTo.Value.Date)
                    {
                        lblPrintStatus.Text = "  Invalid start date/end date.";
                    }
                    else
                    {
                        //reportParameters[0] =  new ReportParameter("ExamCodeDate", "Exam codes issued in " + dtpFrom.Value.Date.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture) + " to " + dtpTo.Value.Date.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture));
                        reportParameters[0] = new ReportParameter("ExamCodeDate", "Exam codes issued from " + dtpFrom.Value.ToShortDateString() + " to " + dtpTo.Value.Date.ToShortDateString());
                        codeReports         = _examineeTakeBLL.GetExamineeCodeReport(dtpFrom.Value, dtpTo.Value);

                        frmReport.LoadReport("ExamineeCodeReport", codeReports, "PresentationLayer.Reports.ExamineeCodeReport.rdlc", reportParameters);
                        frmReport.ShowDialog(this);
                    }
                }
            }
        }