Пример #1
0
        // Adding a student method
        private void AddStudent()
        {
            string studentNumber  = studnumbox.Text;
            string lastName       = lastNameBox.Text;
            string firstName      = firstNameBox.Text;
            string middleInitials = midNameBox.Text;
            int    gender         = GetGender();
            string courseCode     = course.Text;

            if (AddStudentValidations.Validate(studentNumber, firstName, lastName, middleInitials, gender, courseCode))
            {
                try
                {
                    StudentsController.AddStudentRecord(studentNumber, lastName, firstName, middleInitials, gender, courseCode);
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Пример #2
0
        //=====================================
        //
        // <Sumarry>
        //      Method to Add Student records
        //
        //=====================================
        private void AddStudent()
        {
            string studentNumber = StudentNumber.Text;
            string lastName      = LastName.Text;
            string firstName     = FirstName.Text;
            string middleName    = MiddleName.Text;
            int    gender        = GetGender();
            string course        = "";

            if (Courses.SelectedItem != null)
            {
                course = Courses.SelectedItem.ToString();
            }

            // For the contacts field
            string phone = PhoneNumber.Text;
            string email = EmailAddress.Text;

            if (AddStudentValidations.Validate(studentNumber, firstName, lastName, middleName, gender, course))
            {
                StudentsController.AddStudentRecord(studentNumber, lastName, firstName, middleName, gender, course, phone, email);
                this.DialogResult = DialogResult.OK;
            }
        }