Esempio n. 1
0
        private void cmdJUnitUpload_Click(object sender, System.EventArgs e)
        {
            //Import tester data
            AutoEvaluation  eval;
            Evaluations     evalda = new Evaluations(Globals.CurrentIdentity);
            Rubrics         rubda  = new Rubrics(Globals.CurrentIdentity);
            IExternalSource esrc;

            if (fiJUnit.PostedFile.ContentLength == 0)
            {
                PageJUnitError("You must specify a tester suite to upload");
                return;
            }
            else
            {
                esrc = CreateSource(fiJUnit.PostedFile);
                eval = (AutoEvaluation) new Evaluations(Globals.CurrentIdentity).GetInfo(
                    Convert.ToInt32(lblEvalID.Text));
            }

            //Load files
            try {
                evalda.UpdateAuto(eval, esrc);
            } catch (CustomException er) {
                PageJUnitError(er.Message);
                return;
            }

            //Discover JUnit test
            double points = 0;
            int    time = 0, count = 0;

            try {
                new JUnitTool().Discover(eval, out points, out time, out count);
            } catch (CustomException er) {
                PageJUnitError(er.Message);
            }

            //Update points and time
            Rubric rub = rubda.GetInfo(GetCurrentID());

            eval.TimeLimit = time;
            rub.Points     = points;
            try {
                evalda.UpdateAuto(eval, new EmptySource());
                rubda.Update(rub);
                PageJUnitError("Upload successful!");
            } catch (CustomException er) {
                PageJUnitError(er.Message);
            }

            UpdateRightSide();
        }
Esempio n. 2
0
        private void cmdCSUpload_Click(object sender, System.EventArgs e)
        {
            //Import tester data
            AutoEvaluation  eval;
            Evaluations     evalda = new Evaluations(Globals.CurrentIdentity);
            IExternalSource esrc;

            //Get all necessary info
            if (fuCS.PostedFile.ContentLength == 0)
            {
                PageCSError("You must specify a tester suite to upload");
                return;
            }
            else
            {
                esrc = CreateSource(fuCS.PostedFile);
                eval = (AutoEvaluation) new Evaluations(Globals.CurrentIdentity).GetInfo(
                    Convert.ToInt32(lblEvalID.Text));
            }

            //Load files
            try {
                evalda.UpdateAuto(eval, esrc);
                new CheckStyleTool().CopySupportFiles(eval);
                PageCSError("Upload successful!");
            } catch (CustomException er) {
                PageCSError(er.Message);
            }

            UpdateRightSide();
        }
Esempio n. 3
0
        private void cmdJUnitUpdate_Click(object sender, System.EventArgs e)
        {
            int            evalID = Convert.ToInt32(lblEvalID.Text);
            Evaluations    evalda = new Evaluations(Globals.CurrentIdentity);
            AutoEvaluation eval   = (AutoEvaluation)evalda.GetInfo(evalID);

            try {
                eval.RunOnSubmit = chkJUnitPreTest.Checked;
                eval.Competitive = chkJUnitCompete.Checked;
                evalda.UpdateAuto(eval, new EmptySource());
            } catch (CustomException er) {
                PageJUnitError(er.Message);
            }

            UpdateRightSide();
        }
Esempio n. 4
0
        private void PercolateModified(CFile file, DateTime mod)
        {
            if (file != null && file.FullPath != @"c:\")
            {
                file.FileModified = mod;
                m_dp.SyncFile(file);

                //Check special directories
                if (file.SpecType == CFile.SpecialType.SUBMISSION)
                {
                    Submissions           subda = new Submissions(Globals.CurrentIdentity);
                    Components.Submission sub   = subda.GetInfoByDirectoryID(file.ID);
                    if (sub != null)
                    {
                        //Check to see if a staff member modded
                        CourseRole role = new Courses(Globals.CurrentIdentity).GetRole(
                            m_ident.Name, new Assignments(Globals.CurrentIdentity).GetInfo(sub.AsstID).CourseID, null);

                        //Student mods update the submission time, staff mods don't...
                        if (!role.Staff)
                        {
                            sub.Creation = mod;
                            sub.Status   = Components.Submission.UNGRADED;
                            subda.Update(sub, new EmptySource());

                            //Log this in sub log
                            new Activities(m_ident).Create(m_ident.Name, Activity.SUBMISSION, sub.ID,
                                                           "Updated submission time due to student modification of files");
                        }
                    }
                }
                else if (file.SpecType == CFile.SpecialType.TEST)
                {
                    Evaluations    evalda = new Evaluations(Globals.CurrentIdentity);
                    AutoEvaluation eval   = evalda.GetAutoInfoByZone(file.ID);
                    if (eval != null)
                    {
                        eval.ZoneModified = mod;
                        evalda.UpdateAuto(eval, new EmptySource());
                    }
                }

                CFile par = GetFile(file.Path);
                PercolateModified(par, mod);
            }
        }