BO.Course courseDoBoAdapter(DO.Course courseDO) { BO.Course courseBO = new BO.Course(); int id = courseDO.ID; courseDO.CopyPropertiesTo(courseBO); courseBO.Lecturers = from lic in dl.GetLecturersInCourseList(lic => lic.CourseId == id) let course = dl.GetCourse(lic.CourseId) select(BO.CourseLecturer) course.CopyPropertiesToNew(typeof(BO.CourseLecturer)); return(courseBO); }
private void btRegisterCourse_Click(object sender, RoutedEventArgs e) { if (curStu == null) { MessageBox.Show("You must select a student first", "Attention", MessageBoxButton.OK, MessageBoxImage.Warning); return; } try { BO.Course cBO = ((sender as Button).DataContext as BO.Course); bl.AddStudentInCourse(curStu.ID, cBO.ID); RefreshAllRegisteredCoursesGrid(); RefreshAllNotRegisteredCoursesGrid(); } catch (BO.BadStudentIdCourseIDException ex) { MessageBox.Show(ex.Message, "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error); } }