Ejemplo n.º 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);
                            }
                        }
                    }
                }
            }
        }