Beispiel #1
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;
 }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="share"></param>
        /// <returns></returns>
        public async Task <bool> UpdateAsync(Evaluation evaluation)
        {
            if (evaluation == null)
            {
                throw new ArgumentNullException(nameof(evaluation));
            }

            Evaluations.Update(evaluation);
            try
            {
                await SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                return(false);
            }

            return(true);
        }