Example #1
0
        /// <summary>
        /// Returns all the courses registered in EJS.
        /// </summary>
        public static ejsCourse[] GetAllRegisteredCourses(
            ejsService.ejsSessionToken sessionToken, bool includeDisabledCourses)
        {
            EjsPublicServiceClient _client = null;

            try
            {
                _client = new EjsPublicServiceClient();
                _client.Endpoint.Address = new EndpointAddress(ejsBridgeManager.EjsAddress);
                ejsCourse[] results = _client.GetAllRegisteredCourses(sessionToken, includeDisabledCourses);
                return(results);
            }
            catch (FaultException <ejsFailureReport> ex)
            {
                if (ex.Detail._failureCode == 7)
                {
                    sessionToken._isAuthenticated = false;
                }

                throw new ApplicationException(ex.Detail._header + "\n" + ex.Detail._message);
            }
            //catch (Exception)
            //{
            //	throw new ApplicationException(Properties.Resources.EX_EjsConnectionFailed);
            //}
            finally
            {
                if (_client != null)
                {
                    _client.Close();
                }
            }
        }
Example #2
0
        /// <summary>
        /// Registers a user to a course in the EJS.
        /// </summary>
        public static void RegisterUserToCourse(
            ejsService.ejsSessionToken sessionToken, ejsCourse course)
        {
            EjsPublicServiceClient _client = null;

            try
            {
                _client = new EjsPublicServiceClient();
                _client.Endpoint.Address = new EndpointAddress(ejsBridgeManager.EjsAddress);
                _client.RegisterUserToCourse(sessionToken, course);
            }
            catch (FaultException <ejsFailureReport> ex)
            {
                if (ex.Detail._failureCode == 7)
                {
                    sessionToken._isAuthenticated = false;
                }

                throw new ApplicationException(ex.Detail._header + "\n" + ex.Detail._message);
            }
            catch (Exception)
            {
                sessionToken._isAuthenticated = false;
                //throw new ApplicationException(Properties.Resources.EX_EjsConnectionFailed);
            }
            finally
            {
                if (_client != null)
                {
                    _client.Close();
                }
            }
        }
Example #3
0
        /// <summary>
        /// Returns all the courses that a particular user has registered to.
        /// </summary>
        public static ejsCourse[] GetRegisteredCoursesForUser(
            ejsService.ejsSessionToken sessionToken, bool includeDocuments)
        {
            EjsPublicServiceClient _client = null;

            try
            {
                _client = new EjsPublicServiceClient();
                _client.Endpoint.Address = new EndpointAddress(ejsBridgeManager.EjsAddress);
                ejsCourse[] results = _client.GetRegisteredCoursesForUser(sessionToken, includeDocuments);
                return(results);
            }
            catch (FaultException <ejsFailureReport> ex)
            {
                if (ex.Detail._failureCode == 7)
                {
                    sessionToken._isAuthenticated = false;
                }

                throw new ApplicationException(ex.Detail._header + "\n" + ex.Detail._message);
            }
            catch (Exception)
            {
                throw new ApplicationException("EJSと接続する際に失敗しました。");
            }
            finally
            {
                if (_client != null)
                {
                    _client.Close();
                }
            }
        }