コード例 #1
0
ファイル: AllTests.cs プロジェクト: endermert/alms-sdk-dotnet
        static Guid CreateMasterCourse(Guid organizationalUnitGuid)
        {
            ServiceFactory       factory   = new ServiceFactory();
            IMasterCourseService mcService = factory.CreateMasterCourseService();

            var masterCourse = new MasterCourse();

            // the following are required fields.
            masterCourse.MasterCourseGuid = Guid.Empty;
            masterCourse.Name             = "Test Master Course";
            masterCourse.Programs.Add(organizationalUnitGuid);

            // the following are optional fields.
            masterCourse.Description      = "master course description";
            masterCourse.ShortDescription = "ShortDescription";
            masterCourse.Categories       = new List <string>();
            masterCourse.Audiences        = new List <string>();

            var masterCourseGuid = mcService.Create(masterCourse);

            if (masterCourseGuid == Guid.Empty)
            {
                printError(mcService.LastError);
            }
            else
            {
                Console.WriteLine(string.Format("Master course {0} was created.", masterCourse.Name));
            }
            return(masterCourseGuid);
        }
コード例 #2
0
ファイル: AllTests.cs プロジェクト: endermert/alms-sdk-dotnet
        static void UpdateMasterCourse(Guid masterCourseGuid)
        {
            ServiceFactory       factory   = new ServiceFactory();
            IMasterCourseService mcService = factory.CreateMasterCourseService();

            var masterCourse = new MasterCourse();

            // the following are required fields.
            masterCourse.MasterCourseGuid = masterCourseGuid;
            masterCourse.Name             = "Test Master Course - Modified";
            masterCourse.Programs         = null; //Programlarda değişiklik istenmiyorsa bu değer null geçilmeli.

            // the following are optional fields.
            masterCourse.Description      = "Description";
            masterCourse.ShortDescription = "ShortDescription";
            masterCourse.Categories       = new List <string>();
            masterCourse.Audiences        = new List <string>();

            bool success = mcService.Update(masterCourse);

            if (!success)
            {
                printError(mcService.LastError);
            }
            else
            {
                Console.WriteLine(string.Format("Name of master course {0} was updated to {1}.", masterCourse.MasterCourseGuid, masterCourse.Name));
            }
        }
コード例 #3
0
ファイル: AllTests.cs プロジェクト: endermert/alms-sdk-dotnet
        static void DeleteMasterCourse(Guid masterCourseGuid)
        {
            ServiceFactory       factory   = new ServiceFactory();
            IMasterCourseService mcService = factory.CreateMasterCourseService();
            bool success = mcService.Delete(masterCourseGuid);

            if (!success)
            {
                printError(mcService.LastError);
            }
            else
            {
                Console.WriteLine(string.Format("Master course {0} was deleted.", masterCourseGuid));
            }
        }
コード例 #4
0
ファイル: AllTests.cs プロジェクト: endermert/alms-sdk-dotnet
        static void SearchMasterCourses(string keyword, int offset = 0, int limit = 100)
        {
            ServiceFactory       factory   = new ServiceFactory();
            IMasterCourseService mcService = factory.CreateMasterCourseService();

            IEnumerable <MasterCourse> masterCourses = mcService.Search(keyword, true, offset, limit); // get master course data by masterCourseGuid

            if (mcService.LastError != null)
            {
                printError(mcService.LastError);
            }
            else
            {
                Console.WriteLine(string.Format("Master course count is {0}.", masterCourses.Count()));
            }
        }
コード例 #5
0
ファイル: AllTests.cs プロジェクト: endermert/alms-sdk-dotnet
        static void GetMasterCourse(Guid masterCourseGuid)
        {
            ServiceFactory       factory   = new ServiceFactory();
            IMasterCourseService mcService = factory.CreateMasterCourseService();

            MasterCourse masterCourse = mcService.Get(masterCourseGuid); // get master course data by masterCourseGuid

            if (mcService.LastError != null)
            {
                printError(mcService.LastError);
            }
            else
            {
                string name = masterCourse.Name;
                Console.WriteLine(string.Format("Name of master course is {0}.", masterCourse.Name));
            }
        }