Example #1
0
        private void deleteStudent(object sender, EventArgs e)
        {
            Student currentStudent = (Student)studentComboBox.SelectedItem;
            WarningFormWithContinue deleteStudent = new WarningFormWithContinue();
            deleteStudent.Message = "You are about to delete " + currentStudent.FirstName + " " + currentStudent.LastName + " \nFrom the class this action cannot be \nundone.  Do  you want to proceed?";
            deleteStudent.ShowDialog();

            if(deleteStudent.Proceed)
            {
                dbConnention.DeleteStudent(currentStudent);
                loadStudents(dbConnention);
            }
        }
 private bool validateNewStudent()
 {
     Int32 blank;
     if (!Int32.TryParse(comboBoxSection.SelectedItem.ToString(), out blank))
     {
         if (textFirstName.Text.Trim() == "" | textLastName.Text.Trim() == "" | textUsername.Text.Trim() == "" | textEmailAddress.Text.Trim() == "" | comboBoxSection.SelectedValue == null | textSchoolGivenID.Text.Trim() == "")
         {
             WarningFormWithContinue incompleteWarning = new WarningFormWithContinue();
             incompleteWarning.ShowDialog();
             return incompleteWarning.Proceed;
         }
         else
             return true;
     }
     else
     {
         MessageBox.Show("The Section selected is not valid.");
         return false;
     }
 }
 private bool validateNewStudent()
 {
     if (comboBoxSection.SelectedItem == null | textFirstName.Text.Trim() == "" | textLastName.Text.Trim() == "" | textUsername.Text.Trim() == "" | textEmailAddress.Text.Trim() == "" | textSchoolGivenID.Text.Trim() == "")
         {
             WarningFormWithContinue incompleteWarning = new WarningFormWithContinue();
             incompleteWarning.ShowDialog();
             return incompleteWarning.Proceed;
         }
         else
             return true;
 }