/// <summary> /// Adds the list of stundent to the database. /// </summary> /// <param name="sender">The button is the sender object</param> /// <param name="e">The event argument for the button click event</param> protected void AddStudentListToDB(object sender, EventArgs e) { if (IsPostBack) { // If the user travels through the url to this page if (queryString == null) { lblMessage.Text = "Invalid course."; } else { // If no student is selected. if (SelectedStudentList.SelectedValue == "") { lblMessage.Text = "Select any student"; } else { WebSim.DTO.UserInCourse userNamecourseId = new WebSim.DTO.UserInCourse(); WebSim.Business.UserBusiness courseBuiCourse = new WebSim.Business.UserBusiness(); userNamecourseId.userName = SelectedStudentList.SelectedValue.ToString(); userNamecourseId.courseid = queryString; courseBuiCourse.AddUserInCourse(userNamecourseId); } } } }
/// <summary> /// add user and the course to a table in the database /// </summary> /// <param name="sender">The button is the sender object</param> /// <param name="e">The event argument for the button click event</param> protected void AddUserAndCourse_Click(object sender, EventArgs e) { WebSim.DTO.UserAndCourse userInCourse = new WebSim.DTO.UserAndCourse(); WebSim.Business.UserBusiness addUserAndCourse = new WebSim.Business.UserBusiness(); userInCourse.userName = DropDownListUser.SelectedValue.ToString(); userInCourse.courseName = DropDownListCourse.SelectedValue.ToString(); addUserAndCourse.AddUserToCourse(userInCourse); }
/// <summary> /// Sets the student list for the subject /// </summary> private void ListView_Student() { WebSim.Business.UserBusiness userBuiCourse = new WebSim.Business.UserBusiness(); WebSim.DTO.CourseID courseid = new WebSim.DTO.CourseID(); courseid.courseid = queryString; IList<WebSim.DTO.StudentDetail> studDetail = userBuiCourse.GetStudentList(courseid); // adding student name to the list foreach (var item in studDetail) { StudentList.Items.Add(new ListItem(item.userName,item.studentId.ToString())); } }