public static void UpdateCourse(PLCourse s) { SLCourse.Course newCourse = DTO_to_SL(s); SLCourse.ISLCourse SLCourse = new SLCourse.SLCourseClient(); string[] errors = new string[0]; SLCourse.UpdateCourseRequest request = new SLCourse.UpdateCourseRequest(newCourse, errors); SLCourse.UpdateCourse(request); }
public static void CreateCourse(PLCourse c) { SLCourse.Course newCourse = DTO_to_SL(c); SLCourse.ISLCourse SLCourse = new SLCourse.SLCourseClient(); string[] errors = new string[0]; SLCourse.InsertCourseRequest request = new SLCourse.InsertCourseRequest(newCourse, errors); SLCourse.InsertCourse(request); }
public static PLCourse GetCourseDetail(string courseTitle) { SLCourse.ISLCourse SLCourse = new SLCourse.SLCourseClient(); string[] errors = new string[0]; SLCourse.GetCourseRequest request = new SLCourse.GetCourseRequest(courseTitle, errors); SLCourse.GetCourseResponse response = SLCourse.GetCourse(request); SLCourse.Course newCourse = response.GetCourseResult; // this is the data transfer object code... return(DTO_to_PL(newCourse)); }
private static SLCourse.Course DTO_to_SL(PLCourse coursePL) { SLCourse.Course Course = new SLCourse.Course(); Course.id = coursePL.id; Course.title = coursePL.title; Course.level = coursePL.courseLevel; Course.units = coursePL.units; // we don't insert to the database return(Course); }
/// <summary> /// this is data transfer object for ScheduledCourse. /// Converting from presentation layer ScheduledCourse object to business layer ScheduledCourse object /// </summary> /// <param name="student"></param> /// <returns></returns> private static SLSchedule.ScheduledCourse DTO_to_SL(PLScheduledCourse s) { SLSchedule.ScheduledCourse SLSchedule = new SLSchedule.ScheduledCourse(); SLSchedule.id = s.schedule_id; SLCourse.Course myCourse = new SLCourse.Course(); myCourse.id = s.course.id; List <SLCourse.Course> temp = new List <SLCourse.Course>(); foreach (PLCourse course in s.course.prerequisiteList) { SLCourse.Course tmp = new SLCourse.Course(); tmp.id = course.id; tmp.level = course.courseLevel; tmp.description = course.description; tmp.title = course.title; tmp.units = course.units; temp.Add(tmp); } myCourse.prerequisite_list = temp.ToArray(); myCourse.description = s.course.description; myCourse.level = s.course.courseLevel; myCourse.title = s.course.title; myCourse.units = s.course.units; SLSchedule.year = s.year; SLSchedule.quarter = s.quarter; SLSchedule.session = s.session; SLSchedule.dayID = s.dayID; SLSchedule.day = s.day; SLSchedule.timeID = s.timeID; SLSchedule.time = s.time; SLSchedule.instr_id = s.instructorID; SLSchedule.instructor_fName = s.firstName; SLSchedule.instructor_lName = s.lastName; return(SLSchedule); }
private static PLCourse DTO_to_PL(SLCourse.Course s) { PLCourse myCourse = new PLCourse(); myCourse.id = s.id; myCourse.title = s.title; myCourse.description = s.description; myCourse.courseLevel = s.level; myCourse.units = s.units; if (s.prerequisite_list != null) { myCourse.prerequisiteList = new List <PLCourse>(); foreach (SLCourse.Course course in s.prerequisite_list) { PLCourse tmp = DTO_to_PL(course); myCourse.prerequisiteList.Add(tmp); } } return(myCourse); }