Esempio n. 1
0
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     rptCourseChange rpt = new rptCourseChange();
     rpt.Site = this.Site;
     return rpt;
 }
Esempio n. 2
0
        private void barButtonItem19_ItemClick(object sender, ItemClickEventArgs e)
        {
            var number = new frmSubmitText("Learner Number", "Please enter learner number");
            number.ShowDialog();
            while (Database.Count("learner_details", "LearnerNumber = '" + number.Selection + "' AND Division = '" +
                GlobalProperties.loggedOnUserDivison + "'") == 0)
            {
                if (number.Selection == "***")
                    return;
                MessageBox.Show("Invalid Learner Number", "Error");
                number.ShowDialog();
            }
            var reason = new frmSubmitText("Reason", "Please enter reason for course change");
            reason.ShowDialog();
            var list = new ArrayList();
            var courses = Database.Query("courses", "Not Type = 'CC'");
            foreach (DataRow theRow in courses.Tables["courses"].Rows)
            {
                list.Add(theRow["Name"]);
            }
            var frmSelect = new frmSelectSingle("Select Course", "New Course to Enroll In", list);
            frmSelect.ShowDialog();
            if (frmSelect.Selection == "***" || reason.Selection == "***")
                return;
            var report = new rptCourseChange();
            var data =
                Database.Row(@"SELECT *
            FROM learner_details a JOIN enrollments b ON b.LearnerKey = a.LearnerKey
            LEFT JOIN  enrollmentscourses c ON c.idEnrollments = b.idEnrollments
            LEFT JOIN courses d ON d.idCourses = c.idCourses
            WHERE a.Division = '" + GlobalProperties.loggedOnUserDivison + "' AND a.LearnerNumber = '" +
                               number.Selection + "' AND d.Type <> 'CC'");
            if (data == null)
            {
                data =
                Database.Row(@"SELECT *
            FROM learner_details a JOIN enrollments b ON b.LearnerKey = a.LearnerKey
            LEFT JOIN  enrollmentscourses c ON c.idEnrollments = b.idEnrollments
            LEFT JOIN courses d ON d.idCourses = c.idCourses
            WHERE a.Division = '" + GlobalProperties.loggedOnUserDivison + "' AND a.LearnerNumber = '" +
                               number.Selection + "'");
            }

            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["currentProgramme"].Text = "\"" + Convert.ToString(data["Name1"]) + "\"";
            report.DataDefinition.FormulaFields["learnerName"].Text = "\"" + Convert.ToString(data["Name"]) + " " +
                                                                      Convert.ToString(data["Surname"]) + "\"";
            report.DataDefinition.FormulaFields["newProgram"].Text = "\"" + frmSelect.Selection + "\"";
            //report.DataDefinition.FormulaFields["course"].Text = "\"" + Convert.ToString(data["Name1"]) + "\"";

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