Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            AddData addNewStudent = new AddData(); //DAL Layer class call - no business validation for now
            int     studentId     = 0;
            int     courseId      = 0;
            string  firstName     = ucNewStudentDetails.UpdateStudent.FirstName;
            string  surname       = ucNewStudentDetails.UpdateStudent.Surname;
            string  email         = ucNewStudentDetails.UpdateStudent.Email;
            string  phone         = ucNewStudentDetails.UpdateStudent.Phone;
            string  addressLine1  = ucNewStudentDetails.UpdateStudent.AddressLine1;
            string  addressLine2  = ucNewStudentDetails.UpdateStudent.AddressLine2;
            string  city          = ucNewStudentDetails.UpdateStudent.City;
            string  county        = ucNewStudentDetails.UpdateStudent.County;
            string  studentLevel  = ucNewStudentDetails.UpdateStudent.Level;
            //from here down is for Course Table
            string courseCode  = ucCourseDetailControl1.UpdateCourse.CourseCode;
            string courseName  = ucCourseDetailControl1.UpdateCourse.CourseName;
            string courseLevel = ucCourseDetailControl1.UpdateCourse.CourseLevel;

            //use harvested object values in variables to call the add data class and save the information to Student and Course tables
            if (addNewStudent.AddNewStudent(studentId, firstName, surname, email, phone, addressLine1, addressLine2, city, county, studentLevel,
                                            courseId, courseCode, courseName, courseLevel))
            {
                MessageBox.Show("New Record Successfully Saved", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Ref: " + surname + " Course Ref: " + courseCode + "\nNew Record Save Failed - Please Revise and Try Again", "Failed Save", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Beispiel #2
0
 public void AddStudentToDb()
 {
     ad.AddNewStudent(FirstName, LastName, AddressLine1, AddressLine2, City, County.ToString(), Email, Phone, CourseId);
 }