コード例 #1
0
ファイル: results.cs プロジェクト: padilhalino/FrontDesk
        /// <summary>
        /// Create a subjective result
        /// </summary>
        public bool CreateSubj(int subID, int rubricID, string comment, int fileid, int line, 
            double points, ArrayList lines, int type)
        {
            //Check permission
            Components.Submission sub =
                new Submissions(m_ident).GetInfo(subID);
            Assignment asst = new Assignments(m_ident).GetInfo(sub.AsstID);
            Authorize(asst.CourseID, "createsubj", asst.ID, null);

            SubjResult res = new SubjResult();
            res.SubjType = type; res.RubricID = rubricID;
            res.Comment = comment; res.FileID = fileid; res.Line = line;
            res.Grader = m_ident.Name; res.SubmissionID = subID;
            res.Points = points;

            //Create result
            m_dp.CreateSubjResult(res);

            //Attach lines
            foreach (int l in lines)
                m_dp.CreateSubjLineAffect(res.ID, l);

            return true;
        }
コード例 #2
0
 private TreeNode AddSubjResultNode(TreeNodeCollection par, SubjResult res, string imgPrefix)
 {
     string name = String.Format("{0} ({1} points)", res.Comment, res.Points);
     return AddNode(par, name, imgPrefix + "attributes/book.gif", imgPrefix + "attributes/book.gif", "Result " + res.ID,
         false);
 }
コード例 #3
0
        private void dgResults_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            TextBox txtGridComment, txtPoints;
            DropDownList ddlTypes;

            if (null != (txtGridComment = (TextBox) e.Item.FindControl("txtGridComment"))) {
                txtPoints = (TextBox) e.Item.FindControl("txtPoints");
                ddlTypes = (DropDownList) e.Item.FindControl("ddlTypes");

                Results resda = new Results(Globals.CurrentIdentity);
                SubjResult res = new SubjResult();
                res.ID = Convert.ToInt32(dgResults.DataKeys[e.Item.ItemIndex]);
                res = (SubjResult) resda.GetInfo(res.ID);
                res.Points = Convert.ToDouble(txtPoints.Text);
                res.Comment = txtGridComment.Text;
                res.SubjType = Convert.ToInt32(ddlTypes.SelectedIndex);

                try {
                    resda.UpdateSubj(res);
                } catch (DataAccessException er) {
                    PageError(er.Message);
                }
            }

            dgResults.Columns[2].Visible = dgResults.Columns[5].Visible = true;
            dgResults.EditItemIndex = -1;
            BindSubj(new Rubrics(Globals.CurrentIdentity).GetInfo(Convert.ToInt32(lblRubID.Text)));
            ucRubric.UpdateRubric();
        }
コード例 #4
0
ファイル: testcenter.cs プロジェクト: padilhalino/FrontDesk
        protected SubjResult.SubjResultList ParseSubjXmlResults(string xmlresults, Submission sub)
        {
            SubjResult.SubjResultList ress = new SubjResult.SubjResultList();
            XPathNavigator xnav = new XmlWizard().GetXPathNavigator(xmlresults);
            FileSystem fs = new FileSystem(m_ident);
            CFile zone = fs.GetFile(sub.LocationID);

            xnav.MoveToFirstChild(); xnav.MoveToFirstChild();
            XPathNavigator comments = xnav.Clone();
            while (comments.MoveToNext()) {
                SubjResult res = new SubjResult();
                XPathNavigator comment = comments.Clone();
                comment.MoveToFirstChild();

                string subjtype = comment.Value; comment.MoveToNext();
                switch (subjtype) {
                case "Warning":
                    res.SubjType = Rubric.WARNING;
                    break;
                case "Error":
                    res.SubjType = Rubric.ERROR;
                    break;
                case "Good":
                    res.SubjType = Rubric.GOOD;
                    break;
                };

                res.Points = Convert.ToDouble(comment.Value); comment.MoveToNext();
                res.Comment = comment.Value; comment.MoveToNext();

                string filename = comment.Value; comment.MoveToNext();
                if (filename.StartsWith(@".\"))
                    filename = filename.Substring(2, filename.Length-2);
                CFile file = fs.GetFile(Path.Combine(zone.FullPath, filename));
                if (file != null) {
                    res.FileID = file.ID;
                    res.Line = Convert.ToInt32(comment.Value);
                    ress.Add(res);
                }
            }

            return ress;
        }
コード例 #5
0
        private string BuildCommentHtml(SubjResult res)
        {
            string html="<br><TABLE STYLE=\"font-size: 8pt;\" WIDTH=\"300\" BGCOLOR=\"lightgrey\" BORDERCOLOR=\"black\" "+
                        "BORDER=\"1\" CELLSPACING=\"1\" CELLPADDING=\"1\">";
            string image = "<img src=\"";
            string color="#000000";

            switch (res.SubjType) {
            case Rubric.ERROR:
                image += "../../attributes/error.gif\"";
                break;
            case Rubric.WARNING:
                image += "../../attributes/warning.gif\"";
                break;
            case Rubric.GOOD:
                image += "../../attributes/good.gif\"";
                break;
            };
            if (res.Points < 0)
                color = "#ff0000";
            else if (res.Points > 0)
                color = "#008800";

            image += " Align=\"AbsMiddle\">";

            html += "<TR>";
            html += "<TD>";

            html += image + "<b>[Grader: " + res.Grader + "] " +
                            "[Points: <font color=\"" + color + "\">" +
                            res.Points + "</font>]</b><br>";
            html += "<i>" + res.Comment + "</i>";

            html += "</TD>";
            html += "</TR>";
            html += "</TABLE>";

            return html;
        }
コード例 #6
0
ファイル: results.cs プロジェクト: padilhalino/FrontDesk
        /// <summary>
        /// Update a subjective result
        /// </summary>
        public bool UpdateSubj(SubjResult res)
        {
            //Check permission
            Components.Submission sub =
                new Submissions(m_ident).GetInfo(res.SubmissionID);
            Assignment asst = new Assignments(m_ident).GetInfo(sub.AsstID);
            Authorize(asst.CourseID, "updatesubj", asst.ID, null);

            return m_dp.UpdateSubjResult(res);
        }