Example #1
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);
            }
        }
Example #2
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);
                            }
                        }
                    }
                }
            }
        }