Example #1
0
        private void reRegistraionsButton_ItemClick(object sender, ItemClickEventArgs e)
        {
            MonthInputDialogResult theResults = MonthInputDialog.Show();
            //int month;
            if (theResults.Result == DialogResult.OK)
            {
                GlobalProperties.monthInt = clsFunctions.getMonthInt(theResults.Submission);
            }
            else
            {
                return;
            }
            bool allColleges = MessageBox.Show("Do you want to generate the data for all colleges?",
                "College Criteria", MessageBoxButtons.YesNo) == DialogResult.Yes;
            bool activeOnly = MessageBox.Show("Do you want to generate the data for active learners only?",
                "Learner Criteria", MessageBoxButtons.YesNo) == DialogResult.Yes;
            bool includeECD = MessageBox.Show("Do you want to Include ECD students?",
                "ECD", MessageBoxButtons.YesNo) == DialogResult.Yes;

            var criteria = new List<String>();

            if (!allColleges)
                criteria.Add("division = '" + GlobalProperties.loggedOnUserDivison + "' ");

            if (activeOnly)
                criteria.Add("learnerStatus = 'Active' OR learnerStatus = 'Handover_Attending'");

            if (!includeECD)
                criteria.Add("division NOT LIKE '%ECD%'");

            GlobalProperties.tempQuery = String.Join(" AND ", criteria);

            BackgroundWorker bw = GlobalProperties.bw = new BackgroundWorker();
            bw.DoWork += new DoWorkEventHandler(registrationsWorker);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler
                            (bw_RunWorkerCompleted);
            bw.WorkerSupportsCancellation = true;
            // Create a progress form on the UI thread

            myProgressForm = new frmProgress();

            // Kick off the Async thread

            bw.RunWorkerAsync();

            // Lock up the UI with this modal progress form.

            myProgressForm.Show(this);
            myProgressForm = null;
        }
Example #2
0
        private void barButtonItem50_ItemClick_1(object sender, ItemClickEventArgs e)
        {
            bool allColleges = DevExpress.XtraEditors.XtraMessageBox.Show("Do you want to generate data for all colleges?", "College Criteria",MessageBoxButtons.YesNo) == DialogResult.Yes;
            bool activeOnly = DevExpress.XtraEditors.XtraMessageBox.Show("Do you want to generate data for active students only?", "Learner Criteria", MessageBoxButtons.YesNo) == DialogResult.Yes;

            string query = null;

            if (allColleges && !activeOnly)
                query = @"SELECT ld.division, ld.learnerNumber, CONCAT(ld.Name,' ',ld.surname) as name, ec.idCourseComponents, ec.idEnrollments, c.Name, ld.learnerStatus
            FROM enrollmentComponents ec
            JOIN enrollments e on ec.idEnrollments = e.idEnrollments
            JOIN learner_details ld on ld.learnerKey = e.learnerKey
            JOIN components c on c.idCourseComponents = ec.idCourseComponents
            WHERE ec.outcome = 'N.Y.C.'";
            else if (allColleges && activeOnly)
                query = @"SELECT ld.division, ld.learnerNumber, CONCAT(ld.Name,' ',ld.surname) as name, ec.idCourseComponents, ec.idEnrollments, c.Name, ld.learnerStatus
            FROM enrollmentComponents ec
            JOIN enrollments e on ec.idEnrollments = e.idEnrollments
            JOIN learner_details ld on ld.learnerKey = e.learnerKey
            JOIN components c on c.idCourseComponents = ec.idCourseComponents
            WHERE ec.outcome = 'N.Y.C.' AND (ld.learnerStatus = 'Active' OR ld.learnerStatus = 'Handover_Attending')";
            else if (!allColleges && activeOnly)
                query = @"SELECT ld.division, ld.learnerNumber, CONCAT(ld.Name,' ',ld.surname) as name, ec.idCourseComponents, ec.idEnrollments, c.Name, ld.learnerStatus
            FROM enrollmentComponents ec
            JOIN enrollments e on ec.idEnrollments = e.idEnrollments
            JOIN learner_details ld on ld.learnerKey = e.learnerKey
            JOIN components c on c.idCourseComponents = ec.idCourseComponents
            WHERE ec.outcome = 'N.Y.C.' AND (ld.learnerStatus = 'Active' OR ld.learnerStatus = 'Handover_Attending') AND
            ld.division = '" + GlobalProperties.loggedOnUserDivison + "'";
            else if (!allColleges && !activeOnly)
                query = @"SELECT ld.division, ld.learnerNumber, CONCAT(ld.Name,' ',ld.surname) as name, ec.idCourseComponents, ec.idEnrollments, c.Name, ld.learnerStatus
            FROM enrollmentComponents ec
            JOIN enrollments e on ec.idEnrollments = e.idEnrollments
            JOIN learner_details ld on ld.learnerKey = e.learnerKey
            JOIN components c on c.idCourseComponents = ec.idCourseComponents
            WHERE ec.outcome = 'N.Y.C.' AND
            ld.division = '" + GlobalProperties.loggedOnUserDivison + "'";

            GlobalProperties.tempQuery = query;

            BackgroundWorker bw = GlobalProperties.bw = new BackgroundWorker();
            bw.DoWork += new DoWorkEventHandler(resubsOnlyWorker);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler
                            (bw_RunWorkerCompleted);
            bw.WorkerSupportsCancellation = true;
            // Create a progress form on the UI thread

            myProgressForm = new frmProgress();

            // Kick off the Async thread

            bw.RunWorkerAsync();

            // Lock up the UI with this modal progress form.

            myProgressForm.ShowDialog(this);
            myProgressForm = null;
            var report = new rptResubs();
            report.DataSource = learners;
            report.ShowPreviewDialog();
            learners = null;
            //learners.WriteXml("C:\\LAD_DATA_DUMP\\resubs.xml", XmlWriteMode.WriteSchema);
        }