protected void btnAddCourseOffering_Click1(object sender, EventArgs e) { string studentNumber = txtStudentName.Text; string studentName = txtStudentName.Text; List <CourseOffering> coursesOffered = CourseOfferingsDataAccess.retreiveAllCourses(); int j = ddlCourseOffering.SelectedIndex; string test = rblStudentStatus.SelectedValue; if (rblStudentStatus.SelectedValue == "Full-Time") { Student ourStudents = new FullTimeStudent(studentNumber, studentName); StudentDataAccess.AddStudent(ourStudents); int selectedIndex = ddlCourseOffering.SelectedIndex; coursesOffered[selectedIndex].AddStudent(ourStudents); RegistrationDataAccess.addRegistration(ourStudents, coursesOffered[selectedIndex]); txtStudentName.Text = ""; txtStudentNumber.Text = ""; } else if (rblStudentStatus.SelectedValue == "Part-Time") { Student ourStudents = new PartTimeStudent(studentNumber, studentName); StudentDataAccess.AddStudent(ourStudents); int selectedIndex = ddlCourseOffering.SelectedIndex; coursesOffered[selectedIndex].AddStudent(ourStudents); RegistrationDataAccess.addRegistration(ourStudents, coursesOffered[selectedIndex]); txtStudentName.Text = ""; txtStudentNumber.Text = ""; } else if (rblStudentStatus.SelectedValue == "Co-op") { Student ourStudents = new CoopStudent(studentNumber, studentName); StudentDataAccess.AddStudent(ourStudents); int selectedIndex = ddlCourseOffering.SelectedIndex; coursesOffered[selectedIndex].AddStudent(ourStudents); RegistrationDataAccess.addRegistration(ourStudents, coursesOffered[selectedIndex]); txtStudentName.Text = ""; txtStudentNumber.Text = ""; } }
protected void btnAddCourse_Click(object sender, EventArgs e) { string studentNumber = txtStudentNumber.Text; string studentName = txtStudentName.Text; List <CourseOffering> coursesOffered = CourseOfferingsDataAccess.retreiveAllCourses(); int j = coursesOffered.Count - 1; if (rblSortOptions.SelectedValue == "fullTime") { Student ourStudents = new FullTimeStudent(studentNumber, studentName); StudentDataAccess.AddStudent(ourStudents); List <Course> userCourse = CourseDataAccess.retreiveAllCourses(); int i = userCourse.Count() - 1; CourseOffering courseOfferedCourses = new CourseOffering(userCourse[i], coursesOffered[j].Year, coursesOffered[j].Semester); courseOfferedCourses.AddStudent(ourStudents); courseOfferedCourses.GetStudents().Sort(sortBy); RegistrationDataAccess.addRegistration(ourStudents, courseOfferedCourses); txtStudentName.Text = ""; txtStudentNumber.Text = ""; Response.Redirect(Request.RawUrl); } else if (rblSortOptions.SelectedValue == "partTime") { Student ourStudents = new PartTimeStudent(studentNumber, studentName); StudentDataAccess.AddStudent(ourStudents); List <Course> userCourse = CourseDataAccess.retreiveAllCourses(); int i = userCourse.Count() - 1; CourseOffering courseOfferedCourses = new CourseOffering(userCourse[i], coursesOffered[j].Year, coursesOffered[j].Semester); courseOfferedCourses.AddStudent(ourStudents); courseOfferedCourses.GetStudents().Sort(sortBy); txtStudentName.Text = ""; txtStudentNumber.Text = ""; Response.Redirect(Request.RawUrl); } else if (rblSortOptions.SelectedValue == "coop") { Student ourStudents = new CoopStudent(studentNumber, studentName); StudentDataAccess.AddStudent(ourStudents); List <Course> userCourse = CourseDataAccess.retreiveAllCourses(); int i = userCourse.Count() - 1; CourseOffering courseOfferedCourses = new CourseOffering(userCourse[i], coursesOffered[j].Year, coursesOffered[j].Semester); courseOfferedCourses.AddStudent(ourStudents); courseOfferedCourses.GetStudents().Sort(sortBy); txtStudentName.Text = ""; txtStudentNumber.Text = ""; Response.Redirect(Request.RawUrl); } }