private void cmdSubmit_Click(object sender, EventArgs e) { ArrayList prins = ucSectionExpl.Principals; ArrayList tests = GetTests(); string warnings=""; int asstID = Convert.ToInt32(HttpContext.Current.Request.Params["AsstID"]); AutoJobs jobs = new AutoJobs(Globals.CurrentIdentity); Principals aprins = new Principals(Globals.CurrentIdentity); foreach (int prin in prins) { foreach (int evalid in tests) { try { Components.Submission sub = aprins.GetLatestSubmission(prin, asstID); if (sub == null) { warnings += aprins.GetInfo(prin).Name + " "; break; } else jobs.Create(txtName.Text, evalid, sub.ID); } catch (DataAccessException er) { PageError(er.Message); return; } } } PageError("Job: " + txtName.Text + " created successfully. Refer to the " + "job status page to monitor its progress through the testing centers. Users/Groups: " + warnings + " do not have any submissions and tests will not be run on them."); }
/// <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); }
/// <summary> /// Returns the users in this section who are already graded /// </summary> public User.UserList GetStudentsBySubStatus(int sectionID, int asstID, int status) { Principals prinda = new Principals(Globals.CurrentIdentity); User.UserList users = m_dp.GetSectionMembers(sectionID); User.UserList retList = new User.UserList(); foreach (User user in users) { Components.Submission sub = prinda.GetLatestSubmission(user.PrincipalID, asstID); if (sub != null) { if (sub.Status == status) { retList.Add(user); } } } return(retList); }
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 void cmdSubmit_Click(object sender, EventArgs e) { ArrayList prins = GetPrincipals(); ArrayList tests = GetTests(); AutoJobs jobs = new AutoJobs(Globals.CurrentIdentity); Principals aprins = new Principals(Globals.CurrentIdentity); //Check for nothing if (tests.Count == 0 || prins.Count == 0) { PageAutoError("Must select at least one user and one test to create an auto job"); return; } AutoJob job = jobs.Create(txtName.Text, GetAsstID()); foreach (int prin in prins) { foreach (int evalid in tests) { try { Components.Submission sub = aprins.GetLatestSubmission(prin, GetAsstID()); if (sub != null) jobs.CreateTest(job.ID, sub.ID, evalid, false); } catch (DataAccessException er) { PageAutoError(er.Message); return; } } } mpViews.SelectedIndex = 1; }
private void BindUserItem(User user, Label lblName, Label numSubmissions, LinkButton lnkProgress, System.Web.UI.WebControls.Image imgStatus, System.Web.UI.WebControls.Image imgType, CheckBox chkSelect) { imgType.ImageUrl = "../../attributes/user.gif"; lblName.Text = user.FullName + "(" + user.UserName + ")"; if (lnkProgress == null) lnkProgress = new LinkButton(); Principals prinda = new Principals(Globals.CurrentIdentity); Components.Submission sub = prinda.GetLatestSubmission(user.PrincipalID, GetAsstID()); int numsubs = prinda.GetSubmissions(user.PrincipalID, GetAsstID()).Count; numSubmissions.Text = numsubs.ToString(); if (sub == null) { imgStatus.ImageUrl = "../../attributes/nosub.gif"; lnkProgress.Text = "N/A"; chkSelect.Enabled = false; } else { switch (sub.Status) { case Components.Submission.GRADED: imgStatus.ImageUrl = "../../attributes/subgrade.gif"; lnkProgress.Text = "100%"; break; case Components.Submission.INPROGRESS: imgStatus.ImageUrl = "../../attributes/clock.gif"; lnkProgress.Text = "??%"; break; case Components.Submission.UNGRADED: imgStatus.ImageUrl = "../../attributes/sub.gif"; lnkProgress.Text = "0%"; break; } } }
/// <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; }
/// <summary> /// Returns the users in this section who are already graded /// </summary> public User.UserList GetStudentsBySubStatus(int sectionID, int asstID, int status) { Principals prinda = new Principals(Globals.CurrentIdentity); User.UserList users = m_dp.GetSectionMembers(sectionID); User.UserList retList=new User.UserList(); foreach (User user in users) { Components.Submission sub = prinda.GetLatestSubmission(user.PrincipalID, asstID); if (sub != null) { if (sub.Status == status) { retList.Add(user); } } } return retList; }
private void LoadEvaluationNode(TreeNode par, int asstID) { string[] tokens = par.NodeData.Split(" ".ToCharArray()); par.Nodes.Clear(); if (tokens.Length > 2 && tokens[2].Length > 0) { User.UserList users = GetFeedbackUsers(tokens[2]); Principals prinda = new Principals(Globals.CurrentIdentity); AddAggregateNode(par.Nodes, asstID, tokens[2]); // Aggregate node foreach (User user in users) { Components.Submission sub = prinda.GetLatestSubmission(user.PrincipalID, asstID); if (sub != null) AddSubjUserNode(par.Nodes, user, asstID, sub, true); } par.Expandable = ExpandableValue.Always; par.Expanded = true; } else { par.Expandable = ExpandableValue.Auto; par.Expanded = false; } }