/// <summary> /// update existing schedule for a course /// </summary> /// <param name="s"></param> public static void UpdateScheduledCourse(PLScheduledCourse s) { SLSchedule.ScheduledCourse updateCourseSchedule = DTO_to_SL(s); SLSchedule.ISLCourseSchedule SLSchedule = new SLSchedule.SLCourseScheduleClient(); string[] errors = new string[0]; SLSchedule.UpdateCourseScheduleRequest request = new SLSchedule.UpdateCourseScheduleRequest(updateCourseSchedule, errors); SLSchedule.UpdateCourseSchedule(request); }
/// <summary> /// Insert a new course to the schedule /// </summary> /// <param name="s"></param> public static void InsertScheduledCourse(PLScheduledCourse s) { SLSchedule.ScheduledCourse newCourseSchedule = DTO_to_SL(s); SLSchedule.ISLCourseSchedule SLSchedule = new SLSchedule.SLCourseScheduleClient(); string[] errors = new string[0]; SLSchedule.InsertCourseScheduleRequest request = new SLSchedule.InsertCourseScheduleRequest(newCourseSchedule, errors); SLSchedule.InsertCourseSchedule(request); }
/// <summary> /// Get course schedule detail /// </summary> /// <param name="id"></param> /// <returns>PLScheduleCourse</returns> public static PLScheduledCourse GetScheduleDetail(int id) { SLSchedule.ISLCourseSchedule SLSchedule = new SLSchedule.SLCourseScheduleClient(); string[] errors = new string[0]; SLSchedule.GetCourseScheduleDetailRequest request = new SLSchedule.GetCourseScheduleDetailRequest(id, errors); SLSchedule.GetCourseScheduleDetailResponse response = SLSchedule.GetCourseScheduleDetail(request); SLSchedule.ScheduledCourse newSchedule = response.GetCourseScheduleDetailResult; //System.Diagnostics.Debug.WriteLine("newStudent value: " + newStudent.ToString()); System.Diagnostics.Debug.WriteLine("response: " + response.GetCourseScheduleDetailResult); // this is the data transfer object code... return(DTO_to_PL(newSchedule)); }
/// <summary> /// call service layer's delete scheduled course method /// </summary> /// <param name="id"></param> public static bool DeleteScheduledCourse(int id) { SLSchedule.ISLCourseSchedule SLSchedule = new SLSchedule.SLCourseScheduleClient(); string[] errors = new string[0]; SLSchedule.DeleteCourseScheduleRequest request = new SLSchedule.DeleteCourseScheduleRequest(id, errors); SLSchedule.DeleteCourseScheduleResponse response = SLSchedule.DeleteCourseSchedule(request); if (response.errors.Length > 0) { return(false); } return(true); }
/// <summary> /// Get Schedule List /// </summary> /// <param name="year"></param> /// <param name="quarter"></param> /// <returns>List</Scheduled></returns> public static List <PLScheduledCourse> GetScheduleList(int year, string quarter) { List <PLScheduledCourse> scheduleList = new List <PLScheduledCourse>(); SLSchedule.ISLCourseSchedule client = new SLSchedule.SLCourseScheduleClient(); string[] errors = new string[0]; SLSchedule.GetScheduleListRequest request = new SLSchedule.GetScheduleListRequest(year, quarter, errors); SLSchedule.GetScheduleListResponse response = client.GetScheduleList(request); SLSchedule.ScheduledCourse[] schedulesLoaded = response.GetScheduleListResult; if (schedulesLoaded != null) { foreach (SLSchedule.ScheduledCourse s in schedulesLoaded) { PLScheduledCourse schedule = DTO_to_PL(s); scheduleList.Add(schedule); } } return(scheduleList); }