Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        public static List <PLCourse> GetCourseList()
        {
            List <PLCourse> courseList = new List <PLCourse>();


            SLCourse.ISLCourse client = new SLCourse.SLCourseClient();

            string[] errors = new string[0];
            SLCourse.GetCourseListRequest  request  = new SLCourse.GetCourseListRequest(errors);
            SLCourse.GetCourseListResponse response = client.GetCourseList(request);
            SLCourse.Course[] coursesLoaded         = response.GetCourseListResult;

            if (coursesLoaded != null)
            {
                foreach (SLCourse.Course s in coursesLoaded)
                {
                    PLCourse Course = DTO_to_PL(s);
                    courseList.Add(Course);
                }
            }
            return(courseList);
        }
Exemplo n.º 5
0
        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);
        }