Пример #1
0
        public void Update(int editEval, int asstID)
        {
            Assignments assts = new Assignments(Globals.CurrentIdentity);
            Evaluations evals = new Evaluations(Globals.CurrentIdentity);

            Evaluation.EvaluationList allevals = assts.GetAutoEvals(asstID);
            foreach (ListItem item in Items)
            {
                int iid = Convert.ToInt32(item.Value);
                foreach (Evaluation eval in allevals)
                {
                    if (iid == eval.ID)
                    {
                        bool dependence = evals.DependsOn(editEval, iid);
                        if (dependence && !item.Selected)
                        {
                            evals.DeleteDependency(editEval, iid);
                        }
                        else if (!dependence && item.Selected)
                        {
                            if (!evals.CreateDependency(editEval, iid))
                            {
                                item.Selected = false;
                                throw new DataAccessException("Cannot create a circular dependency: " +
                                                              eval.Name);
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        public void BindData(AutoEvaluation eval)
        {
            int asstID = eval.AsstID;

            Assignments assts = new Assignments(Globals.CurrentIdentity);
            Evaluations evals = new Evaluations(Globals.CurrentIdentity);

            Evaluation.EvaluationList allevals = assts.GetAutoEvals(asstID);
            Evaluation.EvaluationList deps     = evals.GetDependencies(eval.ID);

            chkDeps.Items.Clear();
            foreach (Evaluation e in allevals)
            {
                if (e.ID == eval.ID)
                {
                    continue;
                }
                ListItem eitem = new ListItem(e.Name, e.ID.ToString());
                foreach (Evaluation d in deps)
                {
                    if (d.ID == e.ID)
                    {
                        eitem.Selected = true;
                        break;
                    }
                }
                chkDeps.Items.Add(eitem);
            }
        }
Пример #3
0
        /// <summary>
        /// Get all evaluations for the assignment
        /// </summary>
        public Evaluation.EvaluationList GetEvals(int asstID)
        {
            Evaluation.EvaluationList evals = new Evaluation.EvaluationList();
            evals.AddRange(GetAutoEvals(asstID));

            return(evals);
        }
Пример #4
0
 /// <summary>
 /// Check to see if an evaluation depends on another
 /// </summary>
 public bool DependsOn(int evalID, int depID)
 {
     Evaluation.EvaluationList evals = GetDependencies(evalID);
     foreach (Evaluation eval in evals)
     {
         if (eval.ID == depID)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #5
0
 /// <summary>
 /// Get all evaluations for the assignment that are competitive
 /// </summary>
 public Evaluation.EvaluationList GetCompetitions(int asstID)
 {
     Evaluation.EvaluationList evals = GetEvals(asstID);
     Evaluation.EvaluationList comps = new Evaluation.EvaluationList();
     foreach (Evaluation eval in evals)
     {
         if (eval.Competitive)
         {
             comps.Add(eval);
         }
     }
     return(comps);
 }
Пример #6
0
 /// <summary>
 /// Get auto evals that are to be run during submission
 /// </summary>
 public Evaluation.EvaluationList GetSubmitAutoEvals(int asstID)
 {
     Evaluation.EvaluationList allevals = GetAutoEvals(asstID);
     Evaluation.EvaluationList sevals   = new Evaluation.EvaluationList();
     foreach (Evaluation eval in allevals)
     {
         if (eval.RunOnSubmit)
         {
             sevals.Add(eval);
         }
     }
     return(sevals);
 }
Пример #7
0
 private bool CheckDepLoop(int oevalID, int depID)
 {
     Evaluation.EvaluationList deps = GetDependencies(depID);
     foreach (Evaluation dep in deps)
     {
         if (dep.ID == oevalID)
         {
             return(false);
         }
         else if (!CheckDepLoop(oevalID, dep.ID))
         {
             return(false);
         }
     }
     return(true);
 }
Пример #8
0
        protected string RunDependencies(Zone tzone, ZoneService testsvc,
                                         Evaluations.DependencyGraph dg)
        {
            Evaluation.EvaluationList border = dg.GetBuildOrder();
            bool suc;

            //Copy zones first
            foreach (AutoEvaluation eval in border)
            {
                Zone ezone = testsvc.Synchronize(eval);
                testsvc.CopyZone(tzone, ezone);
            }

            //Run the deps
            foreach (AutoEvaluation eval in border)
            {
                m_logger.Log("Running Dep: " + eval.Name);
                if (eval.IsBuild)
                {
                    RunBuildTest(tzone, eval, out suc);
                }
                else
                {
                    string xmlout = RunTest(tzone, eval);
                    if (eval.ResultType == Result.AUTO_TYPE)
                    {
                        AutoResult res = new AutoResult();
                        res.XmlResult = xmlout;

                        suc = (res.Success != AutoResult.CRITICALLYFLAWED);
                    }
                    else
                    {
                        suc = true;
                    }
                }

                if (!suc)
                {
                    return(eval.Name);
                }
            }

            return(null);
        }
Пример #9
0
		private void lstTests_SelectedIndexChanged(object sender, System.EventArgs e) {
			
			ArrayList evals = GetTests();
			Evaluations aevals = new Evaluations(Globals.CurrentIdentity);

			lstOrder.Items.Clear();
			foreach (int evalID in evals) {
				Evaluation eval = aevals.GetInfo(evalID);
				Evaluations.DependencyGraph dg = 
					new Evaluations.DependencyGraph(eval, Globals.CurrentIdentity);
				
				Evaluation.EvaluationList order = dg.GetBuildOrder();
				foreach (Evaluation oeval in order) 
					lstOrder.Items.Add(oeval.Name);
			
				lstOrder.Items.Add(eval.Name);
			}
		}
Пример #10
0
        private void AddBrowserAttr(LinkButton link, AutoEvaluation eval)
        {
            Evaluation.EvaluationList evals =
                (new Assignments(Globals.CurrentIdentity)).GetAutoEvals(eval.AsstID);

            int    i;
            string roots = "";

            for (i = 0; i < evals.Count; i++)
            {
                AutoEvaluation aeval = evals[i] as AutoEvaluation;
                if (aeval.ZoneID > 0)
                {
                    roots += aeval.ZoneID + "|";
                }
            }

            link.Attributes.Add("onClick",
                                @"window.open('filebrowser.aspx?Roots=" + roots +
                                @"', '" + 8 + @"', 'width=730, height=630')");
        }
Пример #11
0
            public Evaluation.EvaluationList GetBuildOrder()
            {
                //Build graph
                Hashtable graph = new Hashtable();
                Node      root  = BuildGraph(new Evaluations(m_ident), m_eval, graph);

                //Order
                ArrayList sort = new ArrayList();

                SortGraph(root, graph, sort);

                //Convert
                int i;

                Evaluation.EvaluationList border = new Evaluation.EvaluationList();
                for (i = sort.Count - 1; i > 0; i--)
                {
                    border.Add(((Node)sort[i]).Eval);
                }

                return(border);
            }
Пример #12
0
            private Node BuildGraph(Evaluations evals, Evaluation eval, Hashtable adjlists)
            {
                //Create node in graph if not there
                Node enode = new Node(eval, false);

                if (!adjlists.ContainsKey(enode))
                {
                    adjlists.Add(enode, new ArrayList());
                }

                //Create edges
                Evaluation.EvaluationList deps = evals.GetDependencies(eval.ID);
                foreach (Evaluation dep in deps)
                {
                    //Get node in graph
                    Node dnode = BuildGraph(evals, dep, adjlists);

                    //Create edge
                    ((ArrayList)adjlists[enode]).Add(dnode);
                }

                return(enode);
            }
Пример #13
0
        /// <summary>
        /// Delete the assignment
        /// </summary>
        public bool Delete(int asstID)
        {
            FileSystem  fs       = new FileSystem(m_ident);
            Submissions subda    = new Submissions(m_ident);
            Evaluations evalda   = new Evaluations(m_ident);
            Results     resultda = new Results(m_ident);
            Groups      groupda  = new Groups(m_ident);
            AutoJobs    jobda    = new AutoJobs(m_ident);

            Assignment asst = GetInfo(asstID);

            //Check permission
            Authorize(asst.CourseID, "delete", asstID, null);

            //Take auto jobs
            IProviderTransaction tran = m_dp.BeginTransaction();

            AutoJob.AutoJobList jobs = GetAutoJobs(asstID, tran);
            foreach (AutoJob job in jobs)
            {
                jobda.Finish(job.ID, tran);
            }
            m_dp.CommitTransaction(tran);

            //Take submissions and results
            Components.Submission.SubmissionList allsubs = GetSubmissions(asstID);
            foreach (Components.Submission sub in allsubs)
            {
                subda.Delete(sub.ID);
            }

            //Take rubric
            Rubric rub = GetRubric(asstID);

            new Rubrics(m_ident).Delete(rub.ID);

            //Take evaluations
            Evaluation.EvaluationList allevals = GetEvals(asstID);
            foreach (Evaluation eval in allevals)
            {
                evalda.Delete(eval.ID);
            }

            //Take groups
            Group.GroupList groups = GetGroups(asstID);
            foreach (Group group in groups)
            {
                groupda.Delete(group.PrincipalID, asstID);
            }

            //Take assignment
            m_dp.DeleteAssignment(asstID);

            //Take content
            CFile content = fs.GetFile(asst.ContentID);

            fs.DeleteFile(content);

            //Log
            Log("Deleted assignment: " + asst.Description, asst.ID);

            return(true);
        }