コード例 #1
0
ファイル: frmTestimonial.cs プロジェクト: robertfall/LAD
        private void button1_Click(object sender, EventArgs e)
        {
            var report = new rptTestimonial();

            ParameterValues pvValues = new ParameterValues();

            ParameterDiscreteValue pdvDiscreteValue = new ParameterDiscreteValue();

            pdvDiscreteValue.Value = textBox1.Text;

            pvValues.Add(pdvDiscreteValue);

            ParameterFieldDefinitions pfdDefinitions = report.DataDefinition.ParameterFields;

            ParameterFieldDefinition prdDefinition = pfdDefinitions["textThing"];

            prdDefinition.ApplyCurrentValues(pvValues);
            /*var data =
                Database.Row("learner_details a, enrollments b, enrollmentscourses c, courses d",
                             "a.Division = '" + clsGlobal.loggedOnUserDivison + "' AND a.LearnerNumber = '" +
                             number.Selection +
                             "' AND b.LearnerKey = a.LearnerKey AND c.idEnrollments = b.idEnrollments AND" +
                             " d.idCourses = c.idCourses");*/
            report.DataDefinition.FormulaFields["mainText"].Text = "\"" + textBox1.Text + "\"";
            report.DataDefinition.FormulaFields["principle"].Text = "\"" + GlobalProperties.DivisionPrinciple + "\"";
            report.DataDefinition.FormulaFields["name"].Text = "\"" +  learner["Surname"] + ", " + learner["name"]+ "\"";
            report.DataDefinition.FormulaFields["learnerNumber"].Text = "\"" + number + "\"";
            //report.DataDefinition.FormulaFields["respParty"].Text = "\"" + clsGlobal.loggedOnUser + "\"";
            //report.DataDefinition.FormulaFields["course"].Text = "\"" + Convert.ToString(data["Name1"]) + "\"";

            //logs.WriteXml(@"C:\tmpXml.xml");
            var frmReport = new frmReport(report) { Text = "Testimonial" };
            frmReport.ShowDialog();
        }
コード例 #2
0
ファイル: frmMainRibbon.cs プロジェクト: robertfall/LAD
        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();
        }
コード例 #3
0
ファイル: frmMainRibbon.cs プロジェクト: robertfall/LAD
        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();
        }
コード例 #4
0
ファイル: frmMainRibbon.cs プロジェクト: robertfall/LAD
 private void barButtonItem13_ItemClick(object sender, ItemClickEventArgs e)
 {
     var books = Database.Query("driversserials d JOIN learner_details l ON d.LearnerKey = l.LearnerKey",
                                "division = '" + GlobalProperties.loggedOnUserDivisionAbrev + "'");
     //books.WriteXmlSchema("C:\\temp_schema.xml");
     var report = new rptDriversSerials();
     report.SetDataSource(books);
     report.DataDefinition.FormulaFields["college"].Text = "\"" + GlobalProperties.LoggedOnUserDivision + "\"";
     var frmReport = new frmReport(report) { Text = "Learner's\\Driver's Serial Numbers" };
     frmReport.ShowDialog();
 }
コード例 #5
0
ファイル: frmMainRibbon.cs プロジェクト: robertfall/LAD
 private void barButtonItem5_ItemClick_1(object sender, ItemClickEventArgs e)
 {
     var numbers = Database.Query("learner_details", "Division = '" + GlobalProperties.loggedOnUserDivison + "' AND NOT SecNumber =''");
     if (numbers.Tables[0].Rows.Count == 0)
     {
         MessageBox.Show("No Security Numbers found for this college");
         return;
     }
     var report = new rptSecNum();
     report.SetDataSource(numbers);
     report.DataDefinition.FormulaFields["Division"].Text = "\"" + GlobalProperties.LoggedOnUserDivision + "\"";
     var frmReport = new frmReport(report) { Text = "Security Numbers" };
     frmReport.ShowDialog();
 }
コード例 #6
0
ファイル: frmMainRibbon.cs プロジェクト: robertfall/LAD
        private void barButtonItem30_ItemClick(object sender, ItemClickEventArgs e)
        {
            var dateSelect = new frmCoverSheet("Select Date", "Select Date");
            dateSelect.ShowDialog();

            if (dateSelect.status)
            {

                //dateSelect.status = false;

                if (!dateSelect.creditBearing)
                {
                    var cover = Database.Query("enrollments e, learner_details l, results r, components c, enrollmentcomponents z",
                                   "e.LearnerKey = l.LearnerKEy AND r.idEnrollments = e.idEnrollments AND c.idCourseComponents = r.idCourseComponents " +
                                   "AND z.idCourseComponents = LEFT(r.idCourseComponents,(LOCATE('-EX',r.idCourseComponents)-1)) " +
                                   "AND z.idEnrollments = e.idEnrollments AND c.ComponentAbrev = 'EX' AND active is Null" +
                                   " AND capturedDate = '" + dateSelect.Selection.ToString("yyyyMMdd") +
                                   "' AND l.Division = '" + GlobalProperties.loggedOnUserDivison + "' AND c.Name NOT LIKE '%Pre%' AND  (( NOT z.Status = 'Inactive') OR z.Status IS Null)",
                                   "l.Surname, l.LearnerNumber, r.idCourseComponents, z.serialNumber, c.Name, r.FinalMark, r.PracMark, z.Result", true, "enrollments e, learner_details l, results r, components c");
                    //cover.WriteXmlSchema(@"C:\temp_schema.xml");
                    var report = new rptAssessmentCoverSheet();
                    report.SetDataSource(cover);

                    report.DataDefinition.FormulaFields["ExamDate"].Text = "\"" + dateSelect.Selection.ToString("dd/MM/yyyy") + "\"";
                    report.DataDefinition.FormulaFields["College"].Text = "\"" + GlobalProperties.LoggedOnUserDivision + "\"";
                    report.DataDefinition.FormulaFields["totalNumber"].Text = "\"" + cover.Tables[0].Rows.Count + "\"";

                    var frmReport = new frmReport(report) { Text = "Assessment Cover Sheet" };
                    frmReport.ShowDialog();
                    dateSelect.ShowDialog();
                }
                else
                {
                    var cover = Database.Query(
                                        "enrollments e, learner_details l, enrollmentComponents r, components c",
                                        "e.LearnerKey = l.LearnerKEy AND r.idEnrollments = e.idEnrollments AND c.idCourseComponents = r.idCourseComponents AND c.ComponentAbrev = 'PROJ' " +
                                        " AND resultDate = '" + dateSelect.Selection.ToString("yyyyMMdd") +
                                        "' AND l.Division = '" + GlobalProperties.loggedOnUserDivison + "'",
                                        "l.Surname, l.LearnerNumber, r.idCourseComponents, r.serialNumber, c.Name, r.Result, r.resultDate");
                    var report = new rptAssessmentCoverSheetCredit();
                    report.SetDataSource(cover);

                    report.DataDefinition.FormulaFields["ExamDate"].Text = "\"" + dateSelect.Selection.ToString("dd/MM/yyyy") + "\"";
                    report.DataDefinition.FormulaFields["College"].Text = "\"" + GlobalProperties.LoggedOnUserDivision + "\"";
                    report.DataDefinition.FormulaFields["totalNumber"].Text = "\"" + cover.Tables[0].Rows.Count + "\"";

                    var frmReport = new frmReport(report) { Text = "Assessment Cover Sheet" };
                    frmReport.ShowDialog();
                    dateSelect.ShowDialog();

                }

            }
        }
コード例 #7
0
ファイル: frmMainRibbon.cs プロジェクト: robertfall/LAD
        private void barButtonItem26_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 forwithdrawel");
            reason.ShowDialog();
            if (reason.Selection == "***")
                return;
            var Data = Database.Row("learner_details", "LearnerNumber = '" + number.Selection + "' AND Division = '" +
                                                       GlobalProperties.loggedOnUserDivison + "'");
            var report = new rptWithdrawn();
            report.DataDefinition.FormulaFields["college"].Text = "\"" + GlobalProperties.LoggedOnUserDivision + "\"";
            report.DataDefinition.FormulaFields["clerk"].Text = "\"" + GlobalProperties.loggedOnUser + "\"";
            report.DataDefinition.FormulaFields["Name"].Text = "\"" + Data["Name"] + " " + Data["Surname"] + "\"";
            report.DataDefinition.FormulaFields["learnerNumber"].Text = "\"" + number.Selection + "\"";
            report.DataDefinition.FormulaFields["Reason"].Text = "\"" + reason.Selection + "\"";

            var frmReport = new frmReport(report) { Text = "Withdrawel Request" };
            frmReport.ShowDialog();
        }
コード例 #8
0
ファイル: frmMainRibbon.cs プロジェクト: robertfall/LAD
        private void barButtonItem25_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();
            }
            string reactivate =
                MessageBox.Show("Would you like to request a re-activation?", "Re-Activation Request",
                                MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes
                    ? "Yes"
                    : "No";
            var Data = Database.Row("learner_details", "LearnerNumber = '" + number.Selection + "' AND Division = '" +
                                                       GlobalProperties.loggedOnUserDivison + "'");
            var report = new rptEnquiry();
            report.DataDefinition.FormulaFields["college"].Text = "\"" + GlobalProperties.LoggedOnUserDivision + "\"";
            report.DataDefinition.FormulaFields["clerk"].Text = "\"" + GlobalProperties.loggedOnUser + "\"";
            report.DataDefinition.FormulaFields["learnerName"].Text = "\"" + Data["Name"] + " " + Data["Surname"] + "\"";
            report.DataDefinition.FormulaFields["learnerNumber"].Text = "\"" + number.Selection + "\"";
            report.DataDefinition.FormulaFields["reactivate"].Text = "\"" + reactivate + "\"";

            var frmReport = new frmReport(report) { Text = "Enquiry on Handover / Re-Activation" };
            frmReport.ShowDialog();
        }
コード例 #9
0
ファイル: frmMainRibbon.cs プロジェクト: robertfall/LAD
        private void barButtonItem22_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 reasonDe = new frmSubmitText("Learner Number", "Please enter reason for deactivation");
            reasonDe.ShowDialog();
            var reasonRe = new frmSubmitText("Learner Number", "Please enter reason for reactivation");
            reasonRe.ShowDialog();
            var report = new rptReactivation();
            var data =
                Database.Row("learner_details a, enrollments b, enrollmentscourses c, courses d",
                               "a.Division = '" + GlobalProperties.loggedOnUserDivison + "' AND a.LearnerNumber = '" +
                               number.Selection + "' AND b.LearnerKey = a.LearnerKey AND c.idEnrollments = b.idEnrollments AND" +
                               " d.idCourses = c.idCourses");
            report.DataDefinition.FormulaFields["date"].Text = "\"" + DateTime.Now.ToLongDateString() + "\"";
            report.DataDefinition.FormulaFields["college"].Text = "\"" + GlobalProperties.LoggedOnUserDivision + "\"";
            report.DataDefinition.FormulaFields["learnerNumber"].Text = "\"" + number.Selection + "\"";
            report.DataDefinition.FormulaFields["principle"].Text = "\"" + GlobalProperties.DivisionPrinciple + "\"";
            report.DataDefinition.FormulaFields["learnerName"].Text = "\"" + Convert.ToString(data["Name"]) + " " +
                                                                      Convert.ToString(data["Surname"]) + "\"";
            report.DataDefinition.FormulaFields["regDate"].Text = "\"" + (Convert.ToDateTime(data["regDate1"])).ToLongDateString() + "\"";
            report.DataDefinition.FormulaFields["reasonDe"].Text = "\"" + reasonDe.Selection + "\"";
            report.DataDefinition.FormulaFields["reasonRe"].Text = "\"" + reasonRe.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();
        }
コード例 #10
0
ファイル: frmMainRibbon.cs プロジェクト: robertfall/LAD
        private void barButtonItem21_ItemClick(object sender, ItemClickEventArgs e)
        {
            var number = new frmSubmitText("Please enter Learner Number:", "Please enter Learner Number:");
            number.ShowDialog();
            var learner = new frmSubmitText("Please enter amount:", "Please enter amount");
            learner.ShowDialog();
            if (learner.Selection == "***" || number.Selection == "***")
                return;
            DataRow data;
            try
            {
                data = Database.Row("learner_details a, enrollments b, enrollmentscourses c, courses d",
                                   "a.Division = '" + GlobalProperties.loggedOnUserDivison + "' AND a.LearnerNumber = '" +
                                   number.Selection +
                                   "' AND b.LearnerKey = a.LearnerKey AND c.idEnrollments = b.idEnrollments AND" +
                                   " d.idCourses = c.idCourses");
            }
            catch
            {
                MessageBox.Show("Error Finding Student.");
                return;
            }
            var report = new rptSny();
            report.DataDefinition.FormulaFields["college"].Text = "\"" + GlobalProperties.LoggedOnUserDivision + "\"";
            report.DataDefinition.FormulaFields["ClientNr"].Text = "\"" + Database.Retrieve("division", "DivisionAbrev = '" +
                                                                          GlobalProperties.loggedOnUserDivison + "'", "SnyVen") + "\"";
            report.DataDefinition.FormulaFields["RespSurname"].Text = "\"" + data["RespPartySurname"] + "\"";
            report.DataDefinition.FormulaFields["Employer"].Text = "\"" + data["RespPartyEmployer"] + "\"";
            report.DataDefinition.FormulaFields["RespName"].Text = "\"" + data["RespPartyName"] + "\"";
            report.DataDefinition.FormulaFields["Title"].Text = "\"" + data["RespPartyTitle"] + "\"";
            report.DataDefinition.FormulaFields["HandOverDate"].Text = "\"" + DateTime.Now.ToLongDateString() + "\"";
            report.DataDefinition.FormulaFields["Amount"].Text = "\"" + learner.Selection + "\"";
            report.DataDefinition.FormulaFields["RespID"].Text = "\"" + data["RespPartyID"] + "\"";
            report.DataDefinition.FormulaFields["Name"].Text = "\"" + data["Name"] + "\"";
            report.DataDefinition.FormulaFields["Surname"].Text = "\"" + data["Surname"] + "\"";
            report.DataDefinition.FormulaFields["ID"].Text = "\"" + data["ID"] + "\"";
            report.DataDefinition.FormulaFields["LearnerNr"].Text = "\"" + number.Selection + "\"";
            try
            {
                report.DataDefinition.FormulaFields["startDate"].Text = "\"" + Convert.ToDateTime(data["regDate1"]).ToString("dd/MM/yyyy") + "\"";
            }
            catch
            {
                MessageBox.Show("This learner does not have a valid registration date. Please correct this!");
                return;
            }
            report.DataDefinition.FormulaFields["RespPartyAdd"].Text = "\"" + data["respPartyStreet"] + "\"+Chr(13)+\"    " +
                data["RespPartySubburb"] + "\"+Chr(13)+\"    " + data["RespPartyCity"] + "\"+Chr(13)+\"    " +
                data["RespPartyCountry"] + "\"+Chr(13)+\"    " + data["RespPartyCode"] + "\"";
            report.DataDefinition.FormulaFields["Add"].Text = "\"" + data["Street"] + "\"+Chr(13)+\"    " +
                data["Subburb"] + "\"+Chr(13)+\"    " + data["City"] + "\"+Chr(13)+\"    " +
                data["Country"] + "\"+Chr(13)+\"    " + data["postCode"] + "\"";
            report.DataDefinition.FormulaFields["PostalAdd"].Text = "\"" + data["PostalStreet"] + "\"+Chr(13)+\"    " +
                data["PostalSubburb"] + "\"+Chr(13)+\"    " + data["PostalCity"] + "\"+Chr(13)+\"    " +
                data["PostalCountry"] + "\"+Chr(13)+\"    " + data["PostalCode"] + "\"";
            report.DataDefinition.FormulaFields["RespTelWork"].Text = "\"" + data["RespPartyTel2"] + "\"";
            report.DataDefinition.FormulaFields["RespTel"].Text = "\"" + data["RespPartyTel1"] + "\"";
            report.DataDefinition.FormulaFields["RespCell"].Text = "\"" + data["RespPartyCell"] + "\"";
            report.DataDefinition.FormulaFields["TelWork"].Text = "\"" + data["Tel1"] + "\"";
            report.DataDefinition.FormulaFields["Tel"].Text = "\"" + data["Tel2"] + "\"";
            report.DataDefinition.FormulaFields["Cell"].Text = "\"" + data["Cell"] + "\"";

            var frmReport = new frmReport(report) { Text = "Hand Over Request" };
            frmReport.ShowDialog();
        }
コード例 #11
0
ファイル: frmLearnersDrivers.cs プロジェクト: robertfall/LAD
 private void button14_Click(object sender, EventArgs e)
 {
     var drivers = Database.Query("drivers", "learnerKey = '" + learnerKey + "' AND NOT active IS NULL ORDER BY Date");
     //            drivers.WriteXmlSchema("C:\\temp_schema.xml");
     var report = new rptDriverPrintout();
     var data = Database.Row("learner_details", "learnerKey = '" + learnerKey + "'");
     report.DataDefinition.FormulaFields["learner"].Text = "\"" + Convert.ToString(data["Surname"]) + ", " +
                                                           Convert.ToString(data["Name"]) + "\"";
     report.DataDefinition.FormulaFields["learnerNumber"].Text = "\"" + Convert.ToString(data["learnerNumber"]) + "\"";
     report.DataDefinition.FormulaFields["ID"].Text = "\"" + Convert.ToString(data["ID"]) + "\"";
     //report.DataDefinition.FormulaFields["course"].Text = "\"" + Convert.ToString(data["Name1"]) + "\"";
     report.SetDataSource(drivers);
     //logs.WriteXml(@"C:\tmpXml.xml");
     var frmReport = new frmReport(report) { Text = "Drivers Printout" };
     frmReport.ShowDialog();
 }
コード例 #12
0
ファイル: frmManageResults.cs プロジェクト: robertfall/LAD
        private void button3_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please select an enrollment");
                return;
            }
            if (listView2.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please select a subject");
                return;
            }
            var splitter = clsFunctions.SplitByString(listView1.SelectedItems[0].SubItems[1].Text, "-");
            if (listView2.SelectedItems[0].SubItems[2].Text != "PROJ")
            {
                if (listView4.Items.Count == 0)
                {
                    MessageBox.Show("Please select valid exam version and try again.", "Select Exam");
                    return;
                }
                var examsWritten = false;
                foreach (ListViewItem theItem in listView4.Items)
                {
                    if (theItem.SubItems[2].Text != "")
                        examsWritten = true;
                }
                if (!examsWritten)
                {
                    MessageBox.Show(
                        "No Exams of this version have been written. Please Enter results or choose a different version",
                        "No Exam Results");
                    return;
                }
            }
            if ((label11.Visible && label11.Text == "*This components marks have already been moderated") ||
                (label10.Visible && label10.Text == "*This components marks have already been moderated"))
            {
                if (clsFunctions.CheckRights("6") && MessageBox.Show("Do you want to send the marks for moderation again?", "Mark for Moderation", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    Database.Command("UPDATE enrollmentcomponents SET moderated = 'no' WHERE idEnrollments = '" +
                                         splitter[1] +
                                         "' and idCourseComponents = '" +
                                         listView2.SelectedItems[0].Text + "'");
                    clsFunctions.WriteLog("Subject sent for re-moderation. Learner Number: " + learnerNumberTextBox.Text + " Division: " + GlobalProperties.LoggedOnUserDivision + " Subject: " + listView2.SelectedItems[0].Text);
                }
                else
                {
                }
            }
            else
            {

                Moderate();
                if ((Database.Retrieve("components", "idCourseComponents = '" + listView2.SelectedItems[0].Text + "'", "ComponentAbrev") != "PROJ"))
                    if (
                        MessageBox.Show("Marks Processed. Would you like to view a calculation sheet?", "Calculation Sheet",
                                        MessageBoxButtons.YesNo) == DialogResult.No)
                    {
                        Database.Command("UPDATE enrollmentcomponents SET printed = 'yes' WHERE idEnrollments = '" +
                                         splitter[1] +
                                         "' and idCourseComponents = '" +
                                         listView2.SelectedItems[0].Text + "'");
                        return;
                    }
            }

            if (System.Text.RegularExpressions.Regex.IsMatch(listView2.SelectedItems[0].SubItems[1].Text, ".*Typing.*") ||
                System.Text.RegularExpressions.Regex.IsMatch(listView2.SelectedItems[0].SubItems[1].Text, ".*ATS.*"))
            {
                Database.Command("UPDATE enrollmentcomponents SET printed = 'yes' WHERE idEnrollments = '" +
                                     splitter[1] +
                                     "' and idCourseComponents = '" +
                                     listView2.SelectedItems[0].Text + "'");
                var results =
                   Database.Query(
                       "components a LEFT OUTER JOIN results b ON a.idCourseComponents=b.idCourseComponents",
                       "a.idCourseComponents LIKE '" + listView4.SelectedItems[0].SubItems[5].Text + "-%' AND idEnrollments = '" +
                       splitter[1] + "' AND b.active is Null");
                var learner = Database.Row("learner_details a, enrollments b",
                                           "a.LearnerKey = b.LearnerKey AND idEnrollments = '" + Convert.ToString(results.Tables[0].Rows[0]["idEnrollments"]) +
                                           "'");
                var course = Database.Row("components a, enrollmentcomponents b", "a.idCourseComponents = '" +
                    listView2.SelectedItems[0].Text + "' AND a.idCourseComponents = b.idCourseComponents AND idEnrollments ='" +
                    splitter[1] + "'");
                //results.WriteXmlSchema(@"c:\schema.xml");
                var report = new rptCalculationSheetTyping();
                report.SetDataSource(results);
                report.DataDefinition.FormulaFields["learnerNumber"].Text = "\"" + learnerNumberTextBox.Text + "\"";
                report.DataDefinition.FormulaFields["learnerName"].Text = "\"" + Convert.ToString(learner["Name"]) + " " + Convert.ToString(learner["Surname"]) + "\"";
                report.DataDefinition.FormulaFields["bookSerial"].Text = "\"" + textBox2.Text + "\"";
                report.DataDefinition.FormulaFields["course"].Text = "\"" + listView2.SelectedItems[0].SubItems[1].Text + "\"";
                report.DataDefinition.FormulaFields["practicalWeight"].Text = "\"" + Convert.ToString(course["practicalWeight"]) + "\"";
                report.DataDefinition.FormulaFields["assWeight"].Text = "\"" + Convert.ToString(course["finalWeight"]) + "\"";
                report.DataDefinition.FormulaFields["finalPerc"].Text = "\"" + Convert.ToString(course["result"]) + "\"";
                report.DataDefinition.FormulaFields["finalOutcome"].Text = "\"" + Convert.ToString(course["outcome"]) + "\"";
                var frmReport = new frmReport(report) { Text = "Calculation Sheet" };
                frmReport.ShowDialog();
            }
            else
            {
                if (listView2.SelectedItems[0].SubItems[2].Text == "SC")
                {
                    var results =
                        Database.Query(
                            "components a RIGHT OUTER JOIN results b ON a.idCourseComponents=b.idCourseComponents JOIN components c on c.idCourseComponents = a.myParent",
                            "((NOT(a.ComponentAbrev = 'EXV' OR a.ComponentAbrev = 'EX' OR a.ComponentAbrev = 'DIV') AND a.idCourseComponents LIKE '" +
                            listView2.SelectedItems[0].Text +
                            "-%')OR((a.ComponentAbrev = 'EXV' OR a.ComponentAbrev = 'EX' OR a.ComponentAbrev = 'DIV')AND a.idCourseComponents LIKE '" +
                            listView4.SelectedItems[0].SubItems[5].Text + "-%')) AND idEnrollments = '" +
                            splitter[1] + "' AND b.active is Null ORDER BY CONCAT(c.Name,' - ',a.Name)", @"a.idCourseComponents, a.ComponentAbrev, CONCAT(c.Name,' - ',a.Name) as Name, a.myParent,
                                                                      a.totalMark, b.result, b.`Date`, b.capturedDate, b.outcome, b.idEnrollments", true,
                                                                                                                                                  "myTable");
                    var learner = Database.Row("learner_details a, enrollments b",
                                               "a.LearnerKey = b.LearnerKey AND idEnrollments = '" +
                                               Convert.ToString(results.Tables[0].Rows[0]["idEnrollments"]) +
                                               "'");
                    var course = Database.Row("components a, enrollmentcomponents b", "a.idCourseComponents = '" +
                                                                                      listView2.SelectedItems[0].Text +
                                                                                      "' AND a.idCourseComponents = b.idCourseComponents AND idEnrollments = '" +
                                                                                      splitter[1] + "'");
                    //results.WriteXmlSchema(@"c:\schema.xml");
                    var report = new rptCalculationSheet();
                    report.SetDataSource(results);
                    report.DataDefinition.FormulaFields["learnerNumber"].Text = "\"" + learnerNumberTextBox.Text + "\"";
                    report.DataDefinition.FormulaFields["learnerName"].Text = "\"" + Convert.ToString(learner["Name"]) +
                                                                              " " + Convert.ToString(learner["Surname"]) +
                                                                              "\"";
                    report.DataDefinition.FormulaFields["bookSerial"].Text = "\"" + textBox2.Text + "\"";
                    report.DataDefinition.FormulaFields["course"].Text = "\"" +
                                                                         listView2.SelectedItems[0].SubItems[1].Text +
                                                                         " - " + listView2.SelectedItems[0].SubItems[0].Text + "\"";
                    report.DataDefinition.FormulaFields["practicalWeight"].Text = "\"" +
                                                                                  Convert.ToString(
                                                                                      course["practicalWeight"]) + "\"";
                    report.DataDefinition.FormulaFields["assWeight"].Text = "\"" +
                                                                            Convert.ToString(course["finalWeight"]) +
                                                                            "\"";
                    report.DataDefinition.FormulaFields["finalPerc"].Text = "\"" + Convert.ToString(course["result"]) +
                                                                            "\"";
                    report.DataDefinition.FormulaFields["finalOutcome"].Text = "\"" +
                                                                               Convert.ToString(course["outcome"]) +
                                                                               "\"";
                    var frmReport = new frmReport(report) {Text = "Calculation Sheet"};
                    frmReport.ShowDialog();
                }
                else if (listView2.SelectedItems[0].SubItems[2].Text == "PROJ")
                {
                    var summative = Database.Query("results_summative",
                                                   "idEnrollments = '" + splitter[1] + "' AND idCourseComponents = '" +
                                                   listView2.SelectedItems[0].Text + "'");
                    if (!label10.Visible && !label11.Visible)
                    {
                        var summativeForm = new frmSummative(listView2.SelectedItems[0].Text, Convert.ToInt32(splitter[1]));
                        summativeForm.ShowDialog();
                        if (summativeForm.status == false)
                            return;
                        summative = Database.Query("results_summative",
                                                   "idEnrollments = '" + splitter[1] + "' AND idCourseComponents = '" +
                                                   listView2.SelectedItems[0].Text + "'");

                    }

                    var results =
                        Database.Query("components a LEFT OUTER JOIN results b ON a.idCourseComponents=b.idCourseComponents",
                            "a.myParent = '" + listView2.SelectedItems[0].Text +
                            "' AND NOT a.idCourseComponents = a.MyParent AND idEnrollments = '" +
                            splitter[1] + "'","idEnrollments, Name, totalMark, Result, Attempt, if(capturedDate, capturedDate, `Date`) as `Date`");

                    var learner = Database.Row("learner_details a, enrollments b",
                                               "a.LearnerKey = b.LearnerKey AND idEnrollments = '" +
                                               Convert.ToString(results.Tables[0].Rows[0]["idEnrollments"]) +
                                               "'");
                    DataRow summativeRow;
                    try
                    {
                        summativeRow = summative.Tables[0].Rows[0];
                    }
                    catch
                    {
                        MessageBox.Show("No Summative Assessment Request has been saved. Please complete this first.");
                        return;
                    }
                    var report = new rptProjCalcSheet();
                    report.SetDataSource(results);

                    report.DataDefinition.FormulaFields["learnerNumber"].Text = "\"" + learnerNumberTextBox.Text + "\"";
                    report.DataDefinition.FormulaFields["learnerName"].Text = "\"" + Convert.ToString(learner["Name"]) +
                                                                              "\"";
                    report.DataDefinition.FormulaFields["learnerSurname"].Text = "\"" +
                                                                                 Convert.ToString(learner["Surname"]) +
                                                                                 "\"";
                    report.DataDefinition.FormulaFields["learnerID"].Text = "\"" + Convert.ToString(learner["ID"]) +
                                                                            "\"";
                    report.DataDefinition.FormulaFields["course"].Text = "\"" +
                                                                         listView2.SelectedItems[0].SubItems[1].Text +
                                                                         "\"";
                    report.DataDefinition.FormulaFields["ProjNum"].Text = "\"" +
                                                                         listView2.SelectedItems[0].SubItems[0].Text +
                                                                         "\"";
                    report.DataDefinition.FormulaFields["college"].Text = "\"" + GlobalProperties.LoggedOnUserDivision + "\"";

                    report.DataDefinition.FormulaFields["date"].Text = "\"" +
                                                                       (Convert.ToDateTime(summativeRow["date"])).
                                                                           ToString("dd/MM/yyy") + "\"";
                    report.DataDefinition.FormulaFields["assessor"].Text = "\"" +
                                                                           Convert.ToString(summativeRow["assesor"]) +
                                                                           "\"";
                    report.DataDefinition.FormulaFields["assessorReg"].Text = "\"" +
                                                                              Convert.ToString(
                                                                                  summativeRow["assesorReg"]) + "\"";
                    report.DataDefinition.FormulaFields["moderator"].Text = "\"" +
                                                                            Convert.ToString(summativeRow["moderator"]) +
                                                                            "\"";
                    report.DataDefinition.FormulaFields["moderatorReg"].Text = "\"" +
                                                                               Convert.ToString(
                                                                                   summativeRow["moderatorReg"]) + "\"";
                    report.DataDefinition.FormulaFields["comments"].Text = "\"" +
                                                                           Convert.ToString(
                                                                               summativeRow["facilitatorRemarks"]) +
                                                                           "\"";

                    report.DataDefinition.FormulaFields["projEvalDate"].Text = "\"" +
                                                                               (Convert.ToDateTime(
                                                                                   summativeRow["projEvalDate"])).
                                                                                   ToString("dd/MM/yyy") + "\"";
                    report.DataDefinition.FormulaFields["projEvalCom"].Text = "\"" +
                                                                              Convert.ToString(
                                                                                  summativeRow["projEvalComment"]) +
                                                                              "\"";
                    report.DataDefinition.FormulaFields["workbookDate"].Text = "\"" +
                                                                               (Convert.ToDateTime(
                                                                                   summativeRow["workbookErrateDate"])).
                                                                                   ToString("dd/MM/yyy") + "\"";
                    report.DataDefinition.FormulaFields["workbookCom"].Text = "\"" +
                                                                              Convert.ToString(
                                                                                  summativeRow["workbookErrataComment"]) +
                                                                              "\"";
                    report.DataDefinition.FormulaFields["recordDate"].Text = "\"" +
                                                                             (Convert.ToDateTime(
                                                                                 summativeRow["recordComDate"])).
                                                                                 ToString("dd/MM/yyy") + "\"";
                    report.DataDefinition.FormulaFields["recordCom"].Text = "\"" +
                                                                            Convert.ToString(
                                                                                summativeRow["recordComComment"]) + "\"";
                    report.DataDefinition.FormulaFields["learnerDate"].Text = "\"" +
                                                                              (Convert.ToDateTime(
                                                                                  summativeRow["learnerGuideErrataDate"]))
                                                                                  .ToString("dd/MM/yyy") + "\"";
                    report.DataDefinition.FormulaFields["learnerCom"].Text = "\"" +
                                                                             Convert.ToString(
                                                                                 summativeRow[
                                                                                     "learnerGuideErrataComment"]) +
                                                                             "\"";
                    report.DataDefinition.FormulaFields["formativeDate"].Text = "\"" +
                                                                                (Convert.ToDateTime(
                                                                                    summativeRow["formAssDate"])).
                                                                                    ToString("dd/MM/yyy") + "\"";
                    report.DataDefinition.FormulaFields["formativeCom"].Text = "\"" +
                                                                               Convert.ToString(
                                                                                   summativeRow["formAssComment"]) +
                                                                               "\"";
                    report.DataDefinition.FormulaFields["summaryDate"].Text = "\"" +
                                                                              (Convert.ToDateTime(
                                                                                  summativeRow["summaryDate"])).ToString
                                                                                  ("dd/MM/yyy") + "\"";
                    report.DataDefinition.FormulaFields["summaryCom"].Text = "\"" +
                                                                             Convert.ToString(
                                                                                 summativeRow["summaryComment"]) + "\"";
                    report.DataDefinition.FormulaFields["portfolioDate"].Text = "\"" +
                                                                                (Convert.ToDateTime(
                                                                                    summativeRow["portfolioDate"])).
                                                                                    ToString("dd/MM/yyy") + "\"";
                    report.DataDefinition.FormulaFields["portfolioCom"].Text = "\"" +
                                                                               Convert.ToString(
                                                                                   summativeRow["portfolioComment"]) +
                                                                               "\"";
                    report.DataDefinition.FormulaFields["ccfoDate"].Text = "\"" +
                                                                           (Convert.ToDateTime(summativeRow["ccfoDate"]))
                                                                               .ToString("dd/MM/yyy") + "\"";
                    report.DataDefinition.FormulaFields["ccfoCom"].Text = "\"" +
                                                                          Convert.ToString(summativeRow["ccfoComment"]) +
                                                                          "\"";
                    var frmReport = new frmReport(report) {Text = "Summative Judgement Request"};
                    frmReport.ShowDialog();

                    //results.WriteXmlSchema(@"c:\schema.xml");
                }
                Database.Command("UPDATE enrollmentcomponents SET printed = 'yes' WHERE idEnrollments = '" +
                                     splitter[1] +
                                     "' and idCourseComponents = '" +
                                     listView2.SelectedItems[0].Text + "'");

            }
        }
コード例 #13
0
ファイル: frmLearnerProfile.cs プロジェクト: robertfall/LAD
        private void previewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string[] splitter = SplitByString(cboEnrollments.Text, "-");
            if (cboEnrollments.Items.Count == 0 || Database.Count("enrollments", "idEnrollments = '" + splitter[1] + "'") == 0)
            {
                MessageBox.Show("No Enrollments for this learner.");
                return;
            }

            MySqlCommand newCommand =
                new MySqlCommand(
                    @"SELECT a.RegDate, a.DateOfFirstLesson, a.LearnerKey, e.Name, c.idComponents, e.ComponentAbrev, d.serialNumber, d.dateIssued
                     FROM enrollments a JOIN enrollmentscourses b on a.idEnrollments = b.idEnrollments
                    JOIN coursecomponents c on c.idCourses = b.idCourses LEFT OUTER JOIN enrollmentcomponents d on d.idEnrollments = a.idenrollments
                     and d.idCourseComponents = c.idComponents JOIN components e on e.idCourseComponents = c.idComponents
                    WHERE a.idEnrollments = '" +
                    splitter[1] + "'");
            MySqlCommand secondCommand =
                new MySqlCommand(@"SELECT * FROM learner_details WHERE Division = '" + GlobalProperties.loggedOnUserDivison +
                                 "' AND learnerNumber = '" + GlobalProperties.strLearnerNumber + "'");
            MySqlCommand thirdCommand = new MySqlCommand("SELECT * FROM paymentinfo WHERE idEnrollments = '" +
            splitter[1] + "'");

            var firstAdapter =
                new MySqlDataAdapter(
                    @"SELECT *
                     FROM enrollments a JOIN enrollmentscourses b on a.idEnrollments = b.idEnrollments
                    JOIN coursecomponents c on c.idCourses = b.idCourses LEFT OUTER JOIN enrollmentcomponents d on d.idEnrollments = a.idenrollments
                     and d.idCourseComponents = c.idComponents JOIN components e on e.idCourseComponents = c.idComponents
                    WHERE a.idEnrollments = '" +
                    splitter[1] + @"' AND ((NOT(isElective = '1' AND d.idEnrollments is null)) OR isElective IS NULL) AND (d.status <> 'inactive' OR d.status IS NULL)
                    ORDER BY e.Name", Database.createConnection());
            var secondAdapter = new MySqlDataAdapter(@"SELECT * FROM learner_details WHERE Division = '" + GlobalProperties.loggedOnUserDivison +
                                 "' AND learnerNumber = '" + GlobalProperties.strLearnerNumber + "'", Database.createConnection());
            var thirdAdapter = new MySqlDataAdapter("SELECT * FROM paymentinfo WHERE idEnrollments = '" +
            splitter[1] + "'", Database.createConnection());
            var division = Database.Row("division", "DivisionAbrev = '" + GlobalProperties.loggedOnUserDivison + "'");
            var thedialog = new PrintDialog();
            //thedialog.ShowDialog();

            //var learner = Database.Table("learner_details", "Division = '" + clsGlobal.loggedOnUserDivison +
            //"' AND learnerNumber = '" + clsGlobal.strLearnerNumber + "'");

            //var table = Database.Table(newCommand);
            DataSet theSet = new DataSet();
            firstAdapter.Fill(theSet, "Results");
            secondAdapter.Fill(theSet, "Learner");
            thirdAdapter.Fill(theSet, "Payment");
            //learner.WriteXmlSchema("C:\\tempSchemalearner.xml");
            //table.WriteXmlSchema("C:\\tempSchemaenrollments.xml");
            //theSet.WriteXml("C:\\LAD_DATA_DUMP\\enrollmentData.xml", XmlWriteMode.WriteSchema);
            var report = new rptEnrollment();
            report.DataDefinition.FormulaFields["college"].Text = "\"" + GlobalProperties.LoggedOnUserDivision + "\"";
            report.DataDefinition.FormulaFields["collegeStreet"].Text = "\"" + division["Street"] + "\"";
            report.DataDefinition.FormulaFields["collegeCity"].Text = "\"" + division["City"] + "\"";
            report.DataDefinition.FormulaFields["collegeSubburb"].Text = "\"" + division["Subburb"] + "\"";
            report.DataDefinition.FormulaFields["collegeFax"].Text = "\"" + division["Fax"] + "\"";
            report.DataDefinition.FormulaFields["collegeTel"].Text = "\"" + division["Tel"] + "\"";
            report.DataDefinition.FormulaFields["collegeCode"].Text = "\"" + division["Code"] + "\"";
            report.DataDefinition.FormulaFields["Course"].Text = "\"" + lblDescription.Text + "\"";
            report.DataDefinition.FormulaFields["departmentOfEducation"].Text = "\"" + division["departmentOfEducation"] + "\"";
            report.DataDefinition.FormulaFields["umalusiNumber"].Text = "\"" + division["umalusiNumber"] + "\"";
            DataRelation myRelation = new DataRelation("newRelation", theSet.Tables[1].Columns["LearnerKey"], theSet.Tables[0].Columns["LearnerKey"]);

            //DataRelation newRelation = new DataRelation("secondRelation",
            //                                            theSet.Tables["Results"].Columns["idEnrollments"],
            //                                            theSet.Tables["Payment"].Columns["idEnrollments"]);
            theSet.Relations.Add(myRelation);
            //theSet.Relations.Add(newRelation);
            //theSet.WriteXmlSchema("C:\\temp.xml");
            report.SetDataSource(theSet);
            //report.PrintOptions.PrinterName = thedialog.PrinterSettings.PrinterName;
            //report.PrintToPrinter(2, false, 0, 0);
            var reportViewer = new frmReport(report, false);
            reportViewer.Show();
        }