/// <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); }
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(); }
private void dgResults_ItemDataBound(object sender, DataGridItemEventArgs e) { Label lblType; System.Web.UI.WebControls.Image imgType; LinkButton lnkFile; DropDownList ddlTypes; SubjResult res = e.Item.DataItem as SubjResult; if (null != (lblType = (Label)e.Item.FindControl("lblType"))) { imgType = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgType"); switch (res.SubjType) { case Rubric.GOOD: imgType.ImageUrl = "../../attributes/good.gif"; lblType.Text = "Good"; break; case Rubric.WARNING: imgType.ImageUrl = "../../attributes/warning.gif"; lblType.Text = "Warning"; break; case Rubric.ERROR: imgType.ImageUrl = "../../attributes/error.gif"; lblType.Text = "Error"; break; } if (res.FileID >= 0) { CFile file = new FileSystem(Globals.CurrentIdentity).GetFile(res.FileID); lnkFile = (LinkButton)e.Item.FindControl("lnkFile"); lnkFile.Attributes.Add("onClick", @"window.open('Controls/Filesys/viewfile.aspx?FileID=" + file.ID + @"', '" + file.ID + @"', 'width=770, height=580')"); lnkFile.Text = file.Name + ":" + res.Line; } } if (null != (ddlTypes = (DropDownList)e.Item.FindControl("ddlTypes"))) { ddlTypes.Items.Add(new ListItem("Error", Rubric.ERROR.ToString())); ddlTypes.Items.Add(new ListItem("Warning", Rubric.WARNING.ToString())); ddlTypes.Items.Add(new ListItem("Good", Rubric.GOOD.ToString())); switch (res.SubjType) { case Rubric.ERROR: ddlTypes.SelectedIndex = 0; break; case Rubric.WARNING: ddlTypes.SelectedIndex = 1; break; case Rubric.GOOD: ddlTypes.SelectedIndex = 2; break; } } }
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)); }
/// <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)); }
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); }
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); }
private void dgSubj_ItemDataBound(object sender, DataGridItemEventArgs e) { Label lblPoints, lblType; System.Web.UI.WebControls.Image imgType; LinkButton lnkFile; if (null != (lblPoints = (Label)e.Item.FindControl("lblPoints"))) { lblType = (Label)e.Item.FindControl("lblType"); imgType = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgType"); SubjResult res = e.Item.DataItem as SubjResult; switch (res.SubjType) { case Rubric.GOOD: imgType.ImageUrl = "../attributes/good.gif"; lblType.Text = "Good"; break; case Rubric.WARNING: imgType.ImageUrl = "../attributes/warning.gif"; lblType.Text = "Warning"; break; case Rubric.ERROR: imgType.ImageUrl = "../attributes/error.gif"; lblType.Text = "Error"; break; } lblPoints.Text = res.Points.ToString(); if (res.FileID >= 0) { CFile file = FileSystem.GetInstance().GetFile(res.FileID); lnkFile = (LinkButton)e.Item.FindControl("lnkFile"); lnkFile.Attributes.Add("onClick", @"window.open('Controls/Filesys/viewfile.aspx?FileID=" + file.ID + @"', '" + file.ID + @"', 'width=770, height=580')"); lnkFile.Text = file.Name + ":" + res.Line; } } }