Esempio 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();
        }
 private void butOK_Click(object sender, EventArgs e)
 {
     //float result;
     //if(_gradingScale.IsPercentage) {
     //	if(!float.TryParse(textGradeNumber.Text,out result)) {
     //		MsgBox.Show(this,"Grade number must be a valid percentage. Do not include '%' in the value.");
     //		return;
     //	}
     //	_evalCritCur.GradeNumber=result;
     //	_evalCritCur.GradeShowing=textGradeShowingPercent.Text;
     //}
     _evalCritCur.Notes = textNote.Text;
     EvaluationCriterions.Update(_evalCritCur);
     DialogResult = DialogResult.OK;
 }
Esempio n. 3
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textDate.errorProvider1.GetError(textDate) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (textDate.Text == "")
     {
         MsgBox.Show(this, "Please enter a date.");
         return;
     }
     if (_provStudent == null)
     {
         MsgBox.Show(this, "Please attach a student to this evaluation.");
         return;
     }
     if (!String.IsNullOrWhiteSpace(textGradeNumberOverride.Text))
     {
         //Overrides are not saved to the database. They are found by comparing calculated grades to grades found in the database.
         //If they are identical or blank then they have not been overwritten.
         //This will need to be taken into account when reporting since it is possible to override one grade column but not the other. i.e. A->B but number stays at 4.
         float parsed = 0;
         if (!float.TryParse(textGradeNumberOverride.Text, out parsed))
         {
             MsgBox.Show(this, "The override for Overall Grade Number is not a valid number.  Please input a valid number to save the evaluation.");
             return;
         }
         _evalCur.OverallGradeNumber = parsed;
     }
     for (int i = 0; i < _listEvalCrits.Count; i++)
     {
         _listEvalCrits[i].Notes = gridCriterion.ListGridRows[i].Cells[4].Text;              //Cell 4 is the notes column
         EvaluationCriterions.Update(_listEvalCrits[i]);
     }
     _evalCur.DateEval            = DateTime.Parse(textDate.Text);
     _evalCur.StudentNum          = _provStudent.ProvNum;
     _evalCur.OverallGradeShowing = textGradeShowing.Text;
     _evalCur.OverallGradeNumber  = PIn.Float(textGradeNumber.Text);
     if (!String.IsNullOrWhiteSpace(textGradeShowingOverride.Text))
     {
         _evalCur.OverallGradeShowing = textGradeShowingOverride.Text;
     }
     Evaluations.Update(_evalCur);
     DialogResult = DialogResult.OK;
 }
Esempio n. 4
0
 private void FormEvaluationEdit_Load(object sender, EventArgs e)
 {
     //This window fills all necessary data on load. This eliminates the need for multiple calls to the database.
     textDate.Text           = _evalCur.DateEval.ToShortDateString();
     textTitle.Text          = _evalCur.EvalTitle;
     _evalGradeScale         = GradingScales.GetOne(_evalCur.GradingScaleNum);
     _listEvalGradeItems     = GradingScaleItems.Refresh(_evalCur.GradingScaleNum);
     textGradeScaleName.Text = _evalGradeScale.Description;
     _provInstructor         = Providers.GetProv(_evalCur.InstructNum);
     textInstructor.Text     = _provInstructor.GetLongDesc();
     _provStudent            = Providers.GetProv(_evalCur.StudentNum);
     if (_provStudent != null)
     {
         textStudent.Text = _provStudent.GetLongDesc();
     }
     textCourse.Text = SchoolCourses.GetDescript(_evalCur.SchoolCourseNum);
     textGradeNumberOverride.Text  = _evalCur.OverallGradeNumber.ToString();
     textGradeShowingOverride.Text = _evalCur.OverallGradeShowing;
     _listEvalCrits = EvaluationCriterions.Refresh(_evalCur.EvaluationNum);
     for (int i = 0; i < _listEvalCrits.Count; i++)
     {
         GradingScale critGradeScale = GradingScales.GetOne(_listEvalCrits[i].GradingScaleNum);
         if (!_dictCritGradeScales.ContainsKey(critGradeScale.GradingScaleNum))
         {
             _dictCritGradeScales.Add(critGradeScale.GradingScaleNum, critGradeScale);
         }
         if (!_dictCritGradeItems.ContainsKey(critGradeScale.GradingScaleNum))
         {
             _dictCritGradeItems.Add(critGradeScale.GradingScaleNum, GradingScaleItems.Refresh(critGradeScale.GradingScaleNum));
         }
     }
     FillGridCriterion();
     RecalculateGrades();
     //Since there is no override column in the database, we check for equality of the calculated grade and the grade on the evaluation.
     //If they are different then the grade was overwritten at some point.
     if (textGradeNumber.Text == textGradeNumberOverride.Text)
     {
         textGradeNumberOverride.Text = "";
     }
     if (textGradeShowing.Text == textGradeShowingOverride.Text)
     {
         textGradeShowingOverride.Text = "";
     }
 }