Esempio n. 1
0
        static void AddTeacherToCourse()
        {
            ServiceFactory factory = new ServiceFactory();
            ICourseService cService = factory.CreateCourseService();

            string courseGuid = "1bd0d136-14d8-4ece-886e-b2614fbc8953";

            List<string> teacherList = new List<string>()
            {
                "user_10",
                "user_11"
            };

            bool success = cService.AddTeachers(courseGuid, teacherList);

            if (!success)
            {
                printError(cService.LastError);
            }
            else
            {
                Console.WriteLine(string.Format("Teachers are added specified class {0}.", courseGuid));
            }
        }
Esempio n. 2
0
        static void UpdateCourse(Guid courseGuid)
        {
            ServiceFactory factory = new ServiceFactory();
            ICourseService cService = factory.CreateCourseService();

            var course = new Course()
            {
                CourseGuid = courseGuid,
                Name = "Test Course Modified " + DateTime.Now.ToString("dd.MM.yyyy hh:mm:ss")
            };

            bool success = cService.Update(course);

            if (!success)
            {
                printError(cService.LastError);
            }
            else
            {
                Console.WriteLine(string.Format("Name of course {0} was updated to {1}.", courseGuid, course.Name));
            }
        }
Esempio n. 3
0
        static void SearchCourses(string keyword, int offset = 0, int limit = 100)
        {
            ServiceFactory factory = new ServiceFactory();
            ICourseService cService = factory.CreateCourseService();

            IEnumerable<Course> courses = cService.Search(keyword, true, offset, limit);

            if (cService.LastError != null)
            {
                printError(cService.LastError);
            }
            else
            {
                Console.WriteLine(string.Format("Found {0} courses.", courses.Count()));
            }
        }
Esempio n. 4
0
        static void GetCourse(Guid courseGuid)
        {
            ServiceFactory factory = new ServiceFactory();
            ICourseService cService = factory.CreateCourseService();

            Course course = cService.Get(courseGuid);

            if (cService.LastError != null)
            {
                printError(cService.LastError);
            }
            else
            {
                string name = course.Name;
                Console.WriteLine(string.Format("Name of course is {0}.", name));
            }
        }
Esempio n. 5
0
 static void DeleteCourse(Guid courseGuid)
 {
     ServiceFactory factory = new ServiceFactory();
     ICourseService cService = factory.CreateCourseService();
     bool success = cService.Delete(courseGuid);
     if (!success)
     {
         printError(cService.LastError);
     }
     else
     {
         Console.WriteLine(string.Format("Course {0} was deleted.", courseGuid));
     }
 }
Esempio n. 6
0
        static Guid CreateCourse(Guid masterCourseGuid)
        {
            ServiceFactory factory = new ServiceFactory();
            ICourseService cService = factory.CreateCourseService();

            var course = new Course()
            {
                Name = "Test Course",
                Description = "Test course description",
                CourseDefaultView = AlmsSdk.Domain.Enums.CourseViewType.Card,
                CourseAllowSelfEnrollment = false,
                Abbreviation = "TTC",
                MasterCourseGuid = masterCourseGuid
            };

            Guid courseGuid = cService.Create(course);

            if (courseGuid == Guid.Empty)
            {
                printError(cService.LastError);
            }
            else
            {
                Console.WriteLine(string.Format("Course {0} was created.", courseGuid));
            }
            return courseGuid;
        }