Esempio n. 1
0
        public ExportRow GetAsstExport(Components.Submission sub, int asstID, out double totpoints)
        {
            Rubrics   rubda = new Rubrics(m_ident);
            ExportRow row   = new ExportRow();

            //Get all rubric entries for the assignment
            Rubric rub = new Assignments(m_ident).GetRubric(asstID);

            Rubric.RubricList rublist = rubda.Flatten(rub);

            //Tally
            //Cats
            double points = 0;

            foreach (Rubric rubent in rublist)
            {
                if (sub == null)
                {
                    row.Fields.Add("0");
                }
                else
                {
                    double catpoints = rubda.GetPoints(rubent.ID, sub.ID);
                    points += catpoints;
                    row.Fields.Add(catpoints.ToString());
                }
            }

            //Total
            row.Fields.Insert(0, points.ToString());
            totpoints = points;

            return(row);
        }
Esempio n. 2
0
        private void BindAuto(Rubric rub)
        {
            Result.ResultList ress =
                new Rubrics(Globals.CurrentIdentity).GetResults(rub.ID, GetCurrentSub());

            if (ress.Count == 0) {
                divAuto.InnerHtml = "<i>There are no results for this evaluation item</i>";
                return;
            }

            AutoResult res = ress[0] as AutoResult;
            MemoryStream xmlstr = new MemoryStream(Encoding.ASCII.GetBytes(res.XmlResult));

            XslTransform xslt = new XslTransform();

            XPathDocument xpathdoc = new XPathDocument(xmlstr);
            XPathNavigator nav = xpathdoc.CreateNavigator();

            XPathDocument xsldoc = new XPathDocument(
                Path.Combine(Globals.WWWDirectory, "Xml/reshtml.xslt"));

            StringBuilder strb = new StringBuilder();
            xslt.Load(xsldoc, null, null);
            xslt.Transform(xpathdoc, null, new XmlTextWriter(new StringWriter(strb)) , (XmlResolver)null);

            divAuto.InnerHtml = strb.ToString();
        }
Esempio n. 3
0
        private void BindSubj(Rubric rub)
        {
            Result.ResultList ress =
                new Rubrics(Globals.CurrentIdentity).GetResults(rub.ID, GetCurrentSub());

            dgSubj.DataSource = ress;
            dgSubj.DataBind();
        }
Esempio n. 4
0
        /// <summary>
        /// Get the results of a competitive evaluation
        /// </summary>
        public Result.ResultList GetCompetitionResults(int evalID, out Hashtable subhash)
        {
            subhash = new Hashtable();
            Evaluation eval  = GetInfo(evalID);
            int        rubID = GetRubric(evalID).ID;

            //Get all results for the evaluation
            Result.ResultList ress = new Rubrics(m_ident).GetResults(rubID);

            //Get all subs for the assignment
            Components.Submission.SubmissionList subs = new Assignments(m_ident).GetSubmissions(eval.AsstID);

            //Load unique subs into hash table
            Principals prinda = new Principals(m_ident);

            foreach (Components.Submission sub in subs)
            {
                if (!subhash.Contains(sub.PrincipalID) &&
                    prinda.GetLatestSubmission(sub.PrincipalID, eval.AsstID).ID == sub.ID)
                {
                    subhash[sub.PrincipalID] = sub;
                }
            }
            Components.Submission[] usubs = new Components.Submission[subhash.Count];
            subhash.Values.CopyTo(usubs, 0);
            subhash.Clear();
            foreach (Components.Submission sub in usubs)
            {
                subhash[sub.ID] = sub;
            }

            //Run through results and delete any repetitive ones
            Result.ResultList fress = new Result.ResultList();
            foreach (Result res in ress)
            {
                if (((AutoResult)res).Success != AutoResult.CRITICALLYFLAWED &&
                    ((AutoResult)res).Success != AutoResult.DEPFAIL &&
                    subhash.Contains(res.SubmissionID))
                {
                    fress.Add(res);
                }
            }

            //Sort by competitive score
            fress.Sort(new CompResultComparer());

            return(fress);
        }
Esempio n. 5
0
        /// <summary>
        /// Get the heading row for an export
        /// </summary>
        public ExportRow GetAsstExportHeading(int asstID)
        {
            Rubrics   rubda = new Rubrics(m_ident);
            ExportRow row   = new ExportRow();

            //Get all rubric entries for the assignment
            Assignment asst = new Assignments(m_ident).GetInfo(asstID);
            Rubric     rub  = new Assignments(m_ident).GetRubric(asstID);

            Rubric.RubricList rublist = rubda.Flatten(rub);

            //Total
            row.Fields.Add(asst.Description + " Total");
            foreach (Rubric rubent in rublist)
            {
                row.Fields.Add(rubent.Name);
            }

            return(row);
        }
        private DataTable TabulateUsers(User.UserList users)
        {
            DataTable resulttab = new DataTable();
            int asstID = GetAsstID();
            Rubrics rubda = new Rubrics(Globals.CurrentIdentity);
            Principals prinda = new Principals(Globals.CurrentIdentity);
            Rubric asstrub = new Assignments(Globals.CurrentIdentity).GetRubric(asstID);

            //Add rubric columns to data grid
            Rubric.RubricList flatrub = rubda.Flatten(asstrub);
            resulttab.Columns.Add("UserName");
            resulttab.Columns.Add("Status");
            resulttab.Columns.Add("Total");
            foreach (Rubric rub in flatrub) {
                AddRubricColumn(rub.Name, rub.Name);
                resulttab.Columns.Add(rub.Name);
            }

            //Add user data to the datatable
            foreach (User user in users) {
                Components.Submission sub = prinda.GetLatestSubmission(user.PrincipalID, asstID);
                DataRow row = resulttab.NewRow();

                if (sub == null) continue;

                row["UserName"] = user.UserName;
                row["Status"] = sub.Status;
                row["Total"] = rubda.GetPoints(asstrub.ID, sub.ID).ToString() + "/" + asstrub.Points.ToString();
                foreach (Rubric rub in flatrub)
                    row[rub.Name] = GetRubricPoints(rub, sub.ID) + "/" + rub.Points.ToString();

                resulttab.Rows.Add(row);
            }

            return resulttab;
        }
 private string GetRubricPoints(Rubric rub, int subID)
 {
     Rubrics rubda = new Rubrics(Globals.CurrentIdentity);
     Result.ResultList ress = rubda.GetResults(rub.ID, subID);
     if (ress.Count == 0 && rub.EvalID >= 0)
         return "??";
     else
         return rubda.GetPoints(rub.ID, subID).ToString();
 }
Esempio n. 8
0
        private void ucRubric_RubricSelect(object sender, RubricViewSelectEventArgs args)
        {
            Rubrics rubda = new Rubrics(Globals.CurrentIdentity);
            Rubric rub = args.SelectedRubric;

            ddlType.Items.Clear();
            ddlComments.Items.Clear();
            txtLines.Text = ""; txtCustom.Text = ""; txtPoints.Text = "";
            if (rubda.IsHeading(rub))
                cmdCreate.Enabled = false;
            else {
                CannedResponse.CannedResponseList cans = rubda.GetCannedResponses(rub.ID);
                foreach (CannedResponse can in cans) {
                    string canstr = can.Comment.Substring(0, Math.Min(80, can.Comment.Length));
                    if (canstr.Length == 80)
                        canstr += " ...";
                    ListItem item = new ListItem(canstr, can.ID.ToString());
                    ddlComments.Items.Add(item);
                }
                ddlComments.Items.Add(new ListItem("Custom", "-1"));
                cmdCreate.Enabled = true;

                ddlType.Items.Add(new ListItem("Error", Rubric.ERROR.ToString()));
                ddlType.Items.Add(new ListItem("Warning", Rubric.WARNING.ToString()));
                ddlType.Items.Add(new ListItem("Good", Rubric.GOOD.ToString()));
            }

            BindData(GetWindow());
        }
Esempio n. 9
0
 private void RemoveResults(AutoEvaluation eval)
 {
     Rubric rub = new Evaluations(Globals.CurrentIdentity).GetRubric(eval.ID);
     Result.ResultList ress = new Rubrics(Globals.CurrentIdentity).GetResults(rub.ID);
     Results resda = new Results(Globals.CurrentIdentity);
     foreach (Result res in ress)
         resda.Delete(res.ID);
 }
Esempio n. 10
0
        public int GetCurrentID()
        {
            TreeNode cur = GetCurrentNode();

            int rubID = Convert.ToInt32(cur.NodeData);
            Rubric rub = new Rubrics(Globals.CurrentIdentity).GetInfo(rubID);

            return rub.ID;
        }
Esempio n. 11
0
        public ExportRow GetAsstExport(Components.Submission sub, int asstID, out double totpoints)
        {
            Rubrics rubda = new Rubrics(m_ident);
            ExportRow row = new ExportRow();

            //Get all rubric entries for the assignment
            Rubric rub = new Assignments(m_ident).GetRubric(asstID);
            Rubric.RubricList rublist = rubda.Flatten(rub);

            //Tally
            //Cats
            double points=0;
            foreach (Rubric rubent in rublist) {
                if (sub == null)
                    row.Fields.Add("0");
                else {
                    double catpoints = rubda.GetPoints(rubent.ID, sub.ID);
                    points += catpoints;
                    row.Fields.Add(catpoints.ToString());
                }
            }

            //Total
            row.Fields.Insert(0, points.ToString());
            totpoints = points;

            return row;
        }
Esempio n. 12
0
        private void CreateRubricEntry(int type)
        {
            TreeNode par = tvRubric.GetNodeFromIndex(tvRubric.SelectedNodeIndex);
            int parentID = Convert.ToInt32(par.NodeData.Split(" ".ToCharArray())[1]);
            int evalID=-1;
            double points=0;
            string ename="New Entry";

            Rubric rubpar = new Rubrics(Globals.CurrentIdentity).GetInfo(parentID);
            AutoEvaluation eval = new AutoEvaluation();
            string[] tools;
            try {
                switch (type) {
                case AUTOMATIC:
                    eval.Name = "New Automatic Entry";
                    eval.AsstID = rubpar.AsstID;
                    eval.Competitive = false;
                    eval.Creator = Globals.CurrentUserName;
                    eval.RunOnSubmit = false;
                    eval.Manager = Evaluation.NO_MANAGER;

                    tools = ExternalToolFactory.GetInstance().ListKeys();
                    if (tools.Length > 0)
                        eval.RunTool = tools[0];
                    else
                        eval.RunTool = "No tools installed";

                    eval.ToolVersioning = (int) ExternalToolFactory.VersionCompare.NONE;
                    eval.ToolVersion = "";
                    eval.RunToolArgs = "";
                    eval.TimeLimit = 60;
                    eval.IsBuild = false;
                    eval.ResultType = Result.AUTO_TYPE;

                    new Evaluations(Globals.CurrentIdentity).CreateAuto(eval, new EmptySource());
                    evalID = eval.ID;
                    ename = eval.Name;
                    break;

                case CHECKSTYLE:
                    eval = new AutoEvaluation();
                    eval.Name = "New CheckStyle Entry";
                    eval.AsstID = rubpar.AsstID;
                    eval.Competitive = false;
                    eval.Creator = Globals.CurrentUserName;
                    eval.RunOnSubmit = false;
                    eval.Manager = Evaluation.CHECKSTYLE_MANAGER;
                    eval.RunTool = "Java";
                    eval.ToolVersion = "1.4";
                    eval.ToolVersioning = (int) ExternalToolFactory.VersionCompare.ATLEAST;
                    eval.RunToolArgs = "CheckStyle";
                    eval.TimeLimit = 280;
                    eval.IsBuild = false;
                    eval.ResultType = Result.SUBJ_TYPE;

                    new Evaluations(Globals.CurrentIdentity).CreateAuto(eval, new EmptySource());

                    evalID = eval.ID;
                    ename = eval.Name;
                    break;

                case JUNIT:
                    eval = new AutoEvaluation();
                    eval.Name = "New JUnit Entry";
                    eval.AsstID = rubpar.AsstID;
                    eval.Competitive = false;
                    eval.Creator = Globals.CurrentUserName;
                    eval.RunOnSubmit = false;
                    eval.Manager = Evaluation.JUNIT_MANAGER;
                    eval.RunTool = "Perl";
                    eval.ToolVersion = "5.0";
                    eval.ToolVersioning = (int) ExternalToolFactory.VersionCompare.ATLEAST;
                    eval.RunToolArgs = "jdisco.pl r 0";
                    eval.TimeLimit = 0;
                    eval.IsBuild = false;
                    eval.ResultType = Result.AUTO_TYPE;

                    new Evaluations(Globals.CurrentIdentity).CreateAuto(
                        eval, new EmptySource());

                    evalID = eval.ID;
                    ename = eval.Name;
                    break;

                case CANNED:
                    evalID=-1;
                    ename = "New Human/Subjective Entry";
                    break;
                case HEADING:
                    points=-1;
                    ename = "New Folder Heading";
                    break;
                }

                new Rubrics(Globals.CurrentIdentity).CreateItem(parentID,
                    ename, "Hit modify and enter a description", points, evalID);

            } catch (CustomException er) {
                PageError(er.Message);
            }

            LoadRubricNode(par, parentID);
            par.Expanded = true;
        }
Esempio n. 13
0
        private void LoadTreeView(TreeNode node, string imgPrefix)
        {
            Rubric.RubricList rubs =
                new Rubrics(Globals.CurrentIdentity).GetChildren(GetRubricID(node));
            foreach (Rubric rub in rubs) {
                TreeNode rnode;
                if (RepressAutos && rub.EvalID >= 0)
                    continue;
                else
                    rnode = AddRubricNode(node.Nodes, rub, imgPrefix);
                LoadTreeView(rnode, imgPrefix);
            }

            //Add subjective results in under books
            if (ExpandSubj) {
                Result.ResultList ress = new Rubrics(Globals.CurrentIdentity).GetResults(GetRubricID(node), GetSubID());
                foreach (Result res in ress)
                    if (res is SubjResult)
                        AddSubjResultNode(node.Nodes, (SubjResult)res, imgPrefix);
            }
        }
Esempio n. 14
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);
        }
Esempio n. 15
0
        /// <summary>
        /// Get the results of a competitive evaluation
        /// </summary>
        public Result.ResultList GetCompetitionResults(int evalID, out Hashtable subhash)
        {
            subhash = new Hashtable();
            Evaluation eval = GetInfo(evalID);
            int rubID = GetRubric(evalID).ID;

            //Get all results for the evaluation
            Result.ResultList ress = new Rubrics(m_ident).GetResults(rubID);

            //Get all subs for the assignment
            Components.Submission.SubmissionList subs = new Assignments(m_ident).GetSubmissions(eval.AsstID);

            //Load unique subs into hash table
            Principals prinda = new Principals(m_ident);
            foreach (Components.Submission sub in subs)
                if (!subhash.Contains(sub.PrincipalID) &&
                    prinda.GetLatestSubmission(sub.PrincipalID, eval.AsstID).ID == sub.ID) {
                    subhash[sub.PrincipalID] = sub;
                }
            Components.Submission[] usubs = new Components.Submission[subhash.Count];
            subhash.Values.CopyTo(usubs, 0);
            subhash.Clear();
            foreach (Components.Submission sub in usubs)
                subhash[sub.ID] = sub;

            //Run through results and delete any repetitive ones
            Result.ResultList fress = new Result.ResultList();
            foreach (Result res in ress)
                if (((AutoResult)res).Success != AutoResult.CRITICALLYFLAWED &&
                    ((AutoResult)res).Success != AutoResult.DEPFAIL &&
                    subhash.Contains(res.SubmissionID))
                    fress.Add(res);

            //Sort by competitive score
            fress.Sort(new CompResultComparer());

            return fress;
        }
Esempio n. 16
0
        private bool tb_Delete(object sender, EventArgs e)
        {
            TreeNode node;
            int ty = GetNodeType(node = GetCurrentNode());

            switch (ty) {
            case USER:
                try {
                    new Courses(Globals.CurrentIdentity).RemoveUser(
                        node.NodeData.Split(" ".ToCharArray())[1], GetCourseID());
                } catch (DataAccessException er) {
                    PageError(er.Message);
                } catch (FileOperationException er) {
                    PageError(er.Message);
                }
                break;
            case USERSUB:
                try {
                    int subID = Convert.ToInt32(node.NodeData.Split(" ".ToCharArray())[2]);
                    new Submissions(Globals.CurrentIdentity).Delete(subID);
                } catch (DataAccessException er) {
                    PageError(er.Message);
                } catch (FileOperationException er) {
                    PageError(er.Message);
                }
                break;
            case ASSIGNMENT:
                try {
                    new Assignments(Globals.CurrentIdentity).Delete(GetNodeIndex(node));
                } catch (DataAccessException er) {
                    PageError(er.Message);
                } catch (FileOperationException er) {
                    PageError(er.Message);
                }
                break;
            case ANNOUNCEMENT:
                try {
                    new Announcements(Globals.CurrentIdentity).Delete(GetNodeIndex(node));
                } catch (DataAccessException er) {
                    PageError(er.Message);
                }
                break;
            case SECTION:
                try {
                    new Sections(Globals.CurrentIdentity).Delete(GetNodeIndex(node));
                } catch (DataAccessException er) {
                    PageError(er.Message);
                }
                break;
            case HEADING:
            case CANNED:
            case AUTOMATIC:
                Rubric rub = new Rubrics(Globals.CurrentIdentity).GetInfo(GetNodeIndex(node));
                if (rub.ParentID < 0)
                    PageError("Cannot delete the root rubric");
                else {
                    try {
                        new Rubrics(Globals.CurrentIdentity).Delete(rub.ID);
                    } catch (DataAccessException er) {
                        PageError(er.Message);
                    } catch (FileOperationException er) {
                        PageError(er.Message);
                    }
                }
                break;
            case FOLDER:
            case DOCUMENT:
                FileSystem fs = new FileSystem(Globals.CurrentIdentity);
                CFile file = fs.GetFile(GetNodeIndex(node));

                try {
                    fs.DeleteFile(file);
                } catch (DataAccessException er) {
                    PageError(er.Message);
                } catch (FileOperationException er) {
                    PageError(er.Message);
                }
                break;
            }

            LoadNode((TreeNode)node.Parent);
            ActivateNodeView((TreeNode)node.Parent);

            return true;
        }
Esempio n. 17
0
        private int GetNodeType(TreeNode node)
        {
            Rubrics rubda = new Rubrics(Globals.CurrentIdentity);

            string[] tokens = node.NodeData.Split(" ".ToCharArray());
            if (tokens[0] == "Course")
                return COURSE;
            else if (tokens[0] == "Asst")
                return ASSIGNMENT;
            else if (tokens[0] == "Rubric") {
                Rubric rub = rubda.GetInfo(Convert.ToInt32(tokens[1]));
                if (new Rubrics(Globals.CurrentIdentity).IsHeading(rub))
                    return HEADING;
                else if (rub.EvalID >= 0)
                    return AUTOMATIC;
                else
                    return CANNED;
            }
            else if (tokens[0] == "Folder")
                return FOLDER;
            else if (tokens[0] == "Document")
                return DOCUMENT;
            else if (tokens[0] == "AnnFolder")
                return ANNFOLDER;
            else if (tokens[0] == "Ann")
                return ANNOUNCEMENT;
            else if (tokens[0] == "SubFolder")
                return SUBFOLDER;
            else if (tokens[0] == "GroupFolder")
                return GROUPFOLDER;
            else if (tokens[0] == "ResFolder")
                return RESULTFOLDER;
            else if (tokens[0] == "ResSub")
                return RESSUB;
            else if (tokens[0] == "Feedback")
                return FEEDBACK;
            else if (tokens[0] == "Evaluation")
                return EVALUATION;
            else if (tokens[0] == "Competition")
                return COMPETITION;
            else if (tokens[0] == "SubjUser")
                return SUBJUSER;
            else if (tokens[0] == "AutoSys")
                return AUTOSYS;
            else if (tokens[0] == "AutoJob")
                return AUTOJOB;
            else if (tokens[0] == "SectionFolder")
                return SECTIONFOLDER;
            else if (tokens[0] == "Section")
                return SECTION;
            else if (tokens[0] == "Backups")
                return BACKUPS;
            else if (tokens[0] == "UserGroup")
                return USERGROUP;
            else if (tokens[0] == "User")
                return USER;
            else if (tokens[0] == "Report")
                return REPORT;
            else if (tokens[0] == "AllUsers")
                return ALLUSERS;
            else if (tokens[0] == "Perm")
                return PERMISSION;
            else if (tokens[0] == "UserSub")
                return USERSUB;
            else if (tokens[0] == "Aggregate")
                return AGGREGATE;

            return -1;
        }
Esempio n. 18
0
 private TreeNode GetCurrentRubric(TreeNode node)
 {
     if (node == null)
         return null;
     else if (GetNodeType(node) == HEADING) {
         Rubric rub = new Rubrics(Globals.CurrentIdentity).GetInfo(
             Convert.ToInt32(node.NodeData.Split(" ".ToCharArray())[1]));
         if (rub.ParentID == -1)
             return node;
         else
             return GetCurrentRubric((TreeNode)node.Parent);
     } else
         return GetCurrentRubric((TreeNode)node.Parent);
 }
Esempio n. 19
0
        private void BindAuto(Rubric rub)
        {
            Rubrics rubda = new Rubrics(Globals.CurrentIdentity);
            Result.ResultList ress = rubda.GetResults(rub.ID, GetSubID());

            lblEvalID.Text = rub.EvalID.ToString();
            if (ress.Count == 0)
                if (!IsStudent())
                    mpViews.SelectedIndex = 2;
                else
                    mpViews.SelectedIndex = 5;
            else {
                AutoResult res = ress[0] as AutoResult;

                XmlWizard xmlwiz = new XmlWizard();
                xmlwiz.DisplayDivXslt(res.XmlResult, Path.Combine(Globals.WWWDirectory, "Xml/reshtml.xslt"), divAuto);

                mpViews.SelectedIndex = 3;
            }
        }
Esempio n. 20
0
        public int GetCurrentParentID()
        {
            TreeNode par = GetCurrentParent();
            if (par == null) return -1;

            int rubID = Convert.ToInt32(par.NodeData);
            Rubric rub = new Rubrics(Globals.CurrentIdentity).GetInfo(rubID);

            return rub.ID;
        }
Esempio n. 21
0
        private void BindSubj(Rubric rub)
        {
            Rubrics rubda = new Rubrics(Globals.CurrentIdentity);
            Result.ResultList ress = rubda.GetResults(rub.ID, GetSubID());

            //Update the rubric
            ucRubric.UpdateRubric();

            //Reset to 0 if page index greater than numpages
            if (dgResults.CurrentPageIndex >= dgResults.PageCount)
                dgResults.CurrentPageIndex = 0;

            dgResults.DataSource = ress;
            dgResults.DataBind();

            if (!IsStudent()) {

                ddlCanned.Visible = true;
                lnkCreate.Visible = true;
                dgResults.Columns[0].Visible = true;
                dgResults.Columns[6].Visible = true;

                dgResults.Style["TOP"] = "58px";

                CannedResponse.CannedResponseList cans = rubda.GetCannedResponses(rub.ID);
                ddlCanned.Items.Clear();

                foreach (CannedResponse can in cans) {
                    string canstr = can.Comment.Substring(0, Math.Min(80, can.Comment.Length));
                    if (canstr.Length == 80)
                        canstr += " ...";
                    ListItem item = new ListItem(canstr, can.ID.ToString());

                    ddlCanned.Items.Add(item);
                }
                ddlCanned.Items.Add(new ListItem("Custom", "-1"));
            } else {
                ddlCanned.Visible = false;
                lnkCreate.Visible = false;
                dgResults.Columns[0].Visible = false;
                dgResults.Columns[6].Visible = false;

                lnkRefresh.Style["TOP"] = "0px";
                imgRefresh.Style["TOP"] = "0px";
                dgResults.Style["TOP"] = "20px";
            }

            lblRubID.Text = rub.ID.ToString();
            mpViews.SelectedIndex = 0;
        }
Esempio n. 22
0
        private void views_Refresh(object sender, RefreshEventArgs args)
        {
            TreeNode node = GetCurrentNode();

            if (args.Auxiliary.Length > 0 && args.Auxiliary != REFRESH_RESET)
                node.NodeData += " " + args.Auxiliary;
            else if (args.Auxiliary == REFRESH_RESET) {
                string[] tokens = node.NodeData.Split(" ".ToCharArray());
                node.NodeData = tokens[0] + " " + tokens[1];
            }
            LoadNode(node);
            string nd = node.NodeData;

            TreeNode par = GetCurrentParent();
            if (par != null && args.LoadParent)
                LoadNode(par);

            if (args.LoadRubric) {
                TreeNode rubnode = GetCurrentRubric(node);
                if (rubnode != null) {
                    Rubric rub = new Rubrics(Globals.CurrentIdentity).GetInfo(
                        Convert.ToInt32(rubnode.NodeData.Split(" ".ToCharArray())[1]));
                    rubnode.Text = String.Format("Rubric - {0} Points", rub.Points);
                }
            }

            if (par != null) {
                bool seled = false;
                foreach (TreeNode c in par.Nodes)
                    if (c.NodeData == nd) {
                        tvRubric.SelectedNodeIndex = c.GetNodeIndex(); seled = true; break;
                    }
                if (!seled) {
                    tvRubric.SelectedNodeIndex = par.GetNodeIndex();
                    ActivateNodeView(par);
                }
            }
        }
Esempio n. 23
0
        private string GetResultPoints(Rubric rub)
        {
            Result.ResultList ress =
                new Rubrics(Globals.CurrentIdentity).GetResults(rub.ID, GetSubID());
            if (ress.Count == 0 && rub.EvalID >= 0)
                return String.Format("{0} (Ungraded, {1} points)", rub.Name, rub.Points);

            return String.Format("{0} ({1}/{2} points)", rub.Name,
                new Rubrics(Globals.CurrentIdentity).GetPoints(rub.ID, GetSubID()), rub.Points);
        }
Esempio n. 24
0
        private void BindCannedResponses(int rubID)
        {
            CannedResponse.CannedResponseList cans =
                new Rubrics(Globals.CurrentIdentity).GetCannedResponses(rubID);

            dgCanned.DataSource = cans;
            dgCanned.DataBind();
        }
Esempio n. 25
0
 private void tvRubric_SelectedIndexChange(object sender, TreeViewSelectEventArgs e)
 {
     TreeNode node = tvRubric.GetNodeFromIndex(e.NewNode);
     if (node.NodeData.Split(" ".ToCharArray())[0] == "Rubric") {
         int rubID = GetRubricID(node);
         Rubric rub = new Rubrics(Globals.CurrentIdentity).GetInfo(rubID);
         if (RubricSelect != null)
             RubricSelect(this, new RubricViewSelectEventArgs(rub));
     } else {
         int resID = GetResultID(node);
         Result res = new Results(Globals.CurrentIdentity).GetInfo(resID);
         if (ResultSelect != null)
             ResultSelect(this, new RubricViewSelectResultEventArgs(res));
     }
 }
Esempio n. 26
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. 27
0
        private void cmdSave_Click(object sender, System.EventArgs e)
        {
            Rubric rub = new Rubrics(Globals.CurrentIdentity).GetInfo(GetCurrentID());

            rub.Name = txtName.Text; rub.Description = txtDescription.Text;
            rub.AllowNegativePoints = chkAllowNeg.Checked;
            if (!txtPoints.Visible)
                rub.Points = -1;
            else
                rub.Points = Convert.ToDouble(txtPoints.Text);

            try {
                new Rubrics(Globals.CurrentIdentity).Update(rub);
            } catch (DataAccessException er) {
                PageError(er.Message);
            }

            Refresh(this, new RefreshEventArgs("", true, true));
            UpdateRightSide();
        }
Esempio n. 28
0
        private void UpdateRightSide()
        {
            int rubID = GetCurrentID();
            Rubric rub = new Rubrics(Globals.CurrentIdentity).GetInfo(rubID);

            txtDescription.Text = rub.Description;
            txtName.Text = rub.Name;
            txtPoints.Enabled = true;
            chkAllowNeg.Checked = rub.AllowNegativePoints;
            if (!IsHeading(rub)) {
                txtPoints.Visible = true;
                txtPoints.Text = rub.Points.ToString();
                if (rub.EvalID >= 0) {
                    Evaluation eval = new Evaluations(Globals.CurrentIdentity).GetInfo(rub.EvalID);
                    if (eval.Manager == Evaluation.JUNIT_MANAGER) {
                        BindJUnitView((AutoEvaluation)eval);
                    //	txtPoints.Enabled = false;
                        mpViews.SelectedIndex = JUNITVIEW;
                    } else if (eval.Manager == Evaluation.CHECKSTYLE_MANAGER) {
                        BindCSView((AutoEvaluation)eval);
                        mpViews.SelectedIndex = CHECKSTYLEVIEW;
                    } else {
                        BindAutoView((AutoEvaluation)eval);
                        mpViews.SelectedIndex = AUTOVIEW;
                    }
                }
                else {
                    BindCannedResponses(rubID);
                    mpViews.SelectedIndex = SUBJVIEW;
                }
            }
            else {
                txtPoints.Visible = false;
                mpViews.SelectedIndex = NOVIEW;
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Get the heading row for an export
        /// </summary>
        public ExportRow GetAsstExportHeading(int asstID)
        {
            Rubrics rubda = new Rubrics(m_ident);
            ExportRow row = new ExportRow();

            //Get all rubric entries for the assignment
            Assignment asst = new Assignments(m_ident).GetInfo(asstID);
            Rubric rub = new Assignments(m_ident).GetRubric(asstID);
            Rubric.RubricList rublist = rubda.Flatten(rub);

            //Total
            row.Fields.Add(asst.Description + " Total");
            foreach (Rubric rubent in rublist)
                row.Fields.Add(rubent.Name);

            return row;
        }
Esempio n. 30
0
        private void LoadRubricNode(TreeNode node, int rubID)
        {
            Rubrics rubda = new Rubrics(Globals.CurrentIdentity);

            Rubric.RubricList rubs = rubda.GetChildren(rubID);
            node.Nodes.Clear();
            foreach (Rubric rub in rubs)
                AddRubricNode(node.Nodes, rub);
        }