Exemplo n.º 1
0
        /// <summary>The selected Def from the grid will be copied into a brand new Evaluation and saved to the DB. This includes all EvaluationCriterion as well. Used when creating a new Evaluation.</summary>
        private void CopyDefToEvaluation()
        {
            EvaluationDef evalDef = EvaluationDefs.GetOne(PIn.Long(gridMain.Rows[gridMain.GetSelectedIndex()].Tag.ToString()));
            Evaluation    evalNew = new Evaluation();

            evalNew.DateEval        = DateTime.Today;
            evalNew.EvalTitle       = evalDef.EvalTitle;
            evalNew.GradingScaleNum = evalDef.GradingScaleNum;
            evalNew.InstructNum     = Security.CurUser.ProvNum;
            evalNew.SchoolCourseNum = evalDef.SchoolCourseNum;
            evalNew.EvaluationNum   = Evaluations.Insert(evalNew);
            List <EvaluationCriterionDef> evalCritDefs = EvaluationCriterionDefs.GetAllForEvaluationDef(evalDef.EvaluationDefNum);
            EvaluationCriterion           evalCrit;

            for (int i = 0; i < evalCritDefs.Count; i++)
            {
                evalCrit = new EvaluationCriterion();
                evalCrit.CriterionDescript = evalCritDefs[i].CriterionDescript;
                evalCrit.EvaluationNum     = evalNew.EvaluationNum;
                evalCrit.GradingScaleNum   = evalCritDefs[i].GradingScaleNum;
                evalCrit.IsCategoryName    = evalCritDefs[i].IsCategoryName;
                evalCrit.ItemOrder         = evalCritDefs[i].ItemOrder;
                evalCrit.MaxPointsPoss     = evalCritDefs[i].MaxPointsPoss;
                EvaluationCriterions.Insert(evalCrit);
            }
            evalNew.IsNew = true;
            FormEvaluationEdit FormEE = new FormEvaluationEdit(evalNew);

            FormEE.ShowDialog();
        }