Example #1
0
 // Saves the students to the database.
 protected void StudentSaveButton_Click(object sender, EventArgs e)
 {
     try
     {
         studentController.InsertStudent(new Student(0, StudentLastNameTextBox.Text, StudentFirstMidNameTextBox.Text, DateTime.Now));
         studentController.GetAllStudentsAndBindToRepeater(ref StudentsRepeater);
         ShowSuccessMessage(studentController.BuildSaveSucessMessage(StudentFirstMidNameTextBox.Text, StudentLastNameTextBox.Text));
         ClearTextBoxes();
     }
     catch (DatabaseException ex)
     {
         ShowErrorMessage(ex.Message);
     }
     catch (Exception ex)
     {
         ShowErrorMessage("The system failed with the following message: " + ex.Message);
     }
 }