Exemplo n.º 1
0
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     rptCancellation rpt = new rptCancellation();
     rpt.Site = this.Site;
     return rpt;
 }
Exemplo n.º 2
0
        private void barButtonItem18_ItemClick(object sender, ItemClickEventArgs e)
        {
            var number = new frmSubmitText("Learner Number", "Please enter learner number");
            number.ShowDialog();
            var reason = new frmSubmitText("Reason", "Please enter reason for cancellation");
            reason.ShowDialog();
            while (Database.Count("learner_details", "LearnerNumber = '" + number.Selection + "' AND Division = '" +
                GlobalProperties.loggedOnUserDivison + "'") == 0)
            {
                if (number.Selection == "***" || reason.Selection == "***")
                    return;
                MessageBox.Show("Invalid Learner Number", "Error");
                number.ShowDialog();
            }
            var report = new rptCancellation();
            var dataList =
                Database.Query(@"SELECT *
            FROM learner_details a JOIN enrollments b ON b.LearnerKey = a.LearnerKey
            JOIN enrollmentscourses c ON c.idEnrollments = b.idEnrollments
            LEFT JOIN
            (
            SELECT * FROM courses d
            WHERE d.type<> 'CC'
            ) as e on e.idCourses = c.idCourses
            WHERE a.Division = '" + GlobalProperties.loggedOnUserDivison +
                      "' AND a.LearnerNumber = '" + number.Selection + "'");
            var data = dataList.Tables[0].Rows[0];

            report.DataDefinition.FormulaFields["date"].Text = "\"" + DateTime.Now.ToLongDateString() + "\"";
            report.DataDefinition.FormulaFields["college"].Text = "\"" + GlobalProperties.LoggedOnUserDivision + "\"";
            report.DataDefinition.FormulaFields["principle"].Text = "\"" + GlobalProperties.DivisionPrinciple + "\"";
            report.DataDefinition.FormulaFields["learnerNumber"].Text = "\"" + number.Selection + "\"";
            report.DataDefinition.FormulaFields["reason"].Text = "\"" + reason.Selection + "\"";
            report.DataDefinition.FormulaFields["currentProgram"].Text = String.Format("\"{0}\"", (data == null ? "Custom Course" : Convert.ToString(data["Name1"])));
            report.DataDefinition.FormulaFields["name"].Text = "\"" + Convert.ToString(data["Name"]) + " " +
                                                                      Convert.ToString(data["Surname"]) + "\"";

            //report.DataDefinition.FormulaFields["course"].Text = "\"" + Convert.ToString(data["Name1"]) + "\"";

            //logs.WriteXml(@"C:\tmpXml.xml");
            var frmReport = new frmReport(report) { Text = "Cancellation Request" };
            frmReport.ShowDialog();
        }