Ejemplo n.º 1
0
        // If the user clicks OK to save the Grade details, validate the information that the user has provided
        private void ok_Click(object sender, RoutedEventArgs e)
        {
            // Create a Grade object and use it to trap and report any data validation exceptions that are thrown
            try
            {
                Grades.DataModel.Grade testGrade = new Grades.DataModel.Grade();

                object p = testGrade.ValidateAssessmentDate(assessmentDate.SelectedDate.Value);
                testGrade.ValidateAssessmentGrade(assessmentGrade.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error creating assessment", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            // Indicate that the data is valid
            this.DialogResult = true;
        }