Exemplo n.º 1
0
        public void UpdateRubric()
        {
            TreeNode node  = tvRubric.GetNodeFromIndex(tvRubric.SelectedNodeIndex);
            Rubrics  rubda = new Rubrics(Globals.CurrentIdentity);

            Rubric rub = rubda.GetInfo(GetRubricID(node));

            node.Text = GetResultPoints(rub);

            TreeNode root = tvRubric.Nodes[0];

            rub       = rubda.GetInfo(GetRubricID(root));
            root.Text =
                String.Format("Total - {0}/{1} Points",
                              new Submissions(Globals.CurrentIdentity).GetPoints(GetSubID()),
                              rub.Points);
        }
Exemplo n.º 2
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();
        }