public ContentModuleTracking GetActivityStatus(ContentModuleTracking pEntActivityAssignment)
        {
            _sqlObject = new SQLObject();
            ContentModuleTracking entActivityAssignment = new ContentModuleTracking();
            SqlConnection         sqlConnection         = null;
            int iIndex;

            try
            {
                _strConnString = _sqlObject.GetClientDBConnString(pEntActivityAssignment.ClientId);
                sqlConnection  = new SqlConnection(_strConnString);
                _sqlcmd        = new SqlCommand(Schema.ActivityAssignment.PROC_GET_ACTIVITY_STATUS, sqlConnection);

                _sqlpara = new SqlParameter(Schema.ActivityAssignment.PARA_ACTIVITY_ID, pEntActivityAssignment.ContentModuleId);
                _sqlcmd.Parameters.Add(_sqlpara);

                _sqlpara = new SqlParameter(Schema.Learner.PARA_USER_ID, pEntActivityAssignment.UserID);
                _sqlcmd.Parameters.Add(_sqlpara);

                _sqlpara = new SqlParameter(Schema.ActivityAssignment.PARA_ACTIVITY_TYPE, ActivityContentType.Course.ToString());
                _sqlcmd.Parameters.Add(_sqlpara);

                _sqlreader = _sqlObject.SqlDataReader(_sqlcmd, false);
                _sqlreader.Read();

                if (_sqlreader.HasRows)
                {
                    iIndex = _sqlreader.GetOrdinal(Schema.ActivityAssignment.COL_ACTIVITY_STATUS);
                    if (!_sqlreader.IsDBNull(iIndex))
                    {
                        entActivityAssignment.CompletionStatus = (ActivityCompletionStatus)Enum.Parse(typeof(ActivityCompletionStatus), _sqlreader.GetString(iIndex));
                    }
                }

                // //return entActivityAssignment;
            }
            catch (Exception expCommon)
            {
                //_expCustom = new CustomException(_strMessageId, CustomException.WhoCallsMe(), ExceptionSeverityLevel.Critical, expCommon, true);
                //throw _expCustom;
            }
            finally
            {
                if (_sqlreader != null && !_sqlreader.IsClosed)
                {
                    _sqlreader.Close();
                }
                if (sqlConnection != null && sqlConnection.State != ConnectionState.Closed)
                {
                    sqlConnection.Close();
                }
            }
            return(entActivityAssignment);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get Course Configuration List
        /// </summary>
        /// <param name="pEntCourseConfiguration"></param>
        /// <returns></returns>
        public List <CourseConfiguration> GetCourseConfigurationList(CourseConfiguration pEntCourseConfiguration)
        {
            _sqlObject = new SQLObject();
            List <CourseConfiguration> entListCourseConfiguration = new List <CourseConfiguration>();
            SqlConnection sqlConnection = null;

            try
            {
                _strConnString     = _sqlObject.GetClientDBConnString(pEntCourseConfiguration.ClientId);
                sqlConnection      = new SqlConnection(_strConnString);
                _sqlcmd            = new SqlCommand();
                _sqlcmd.Connection = sqlConnection;
                if (!String.IsNullOrEmpty(pEntCourseConfiguration.ID))
                {
                    _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_COURSE_CONFIGURATION_ID, pEntCourseConfiguration.ID);
                    _sqlcmd.Parameters.Add(_sqlpara);
                    _sqlcmd.CommandText = Schema.CourseConfiguration.PROC_GET_COURSE_CONFIGURATION_BY_ID;
                }
                else
                {
                    _sqlcmd.CommandText = Schema.CourseConfiguration.PROC_GET_ALL_COURSE_CONFIGURATION;
                }
                _sqlreader = null;
                _sqlreader = _sqlObject.SqlDataReader(_sqlcmd, false);
                while (_sqlreader.Read())
                {
                    _entCourseConfiguration = FillObject(_sqlreader, _sqlObject);
                    entListCourseConfiguration.Add(_entCourseConfiguration);
                }
            }
            catch (Exception expCommon)
            {
                //expCommon = new CustomException(_strMessageId, CustomException.WhoCallsMe(), ExceptionSeverityLevel.Critical, expCommon, true);
                throw expCommon;
            }
            finally
            {
                if (_sqlreader != null && !_sqlreader.IsClosed)
                {
                    _sqlreader.Close();
                }
                if (sqlConnection != null && sqlConnection.State != ConnectionState.Closed)
                {
                    sqlConnection.Close();
                }
            }
            return(entListCourseConfiguration);
        }
        /// <summary>
        /// To Get Content Module Tracking details by condent module id and User Id.
        /// </summary>
        /// <param name="pEntContModTracking"></param>
        /// <returns>ContentModuleTracking object </returns>
        public ContentModuleTracking GetContentModuleTrackingByID(ContentModuleTracking pEntContModTracking)
        {
            _sqlObject = new SQLObject();
            ContentModuleTracking entContModTracking = new ContentModuleTracking();
            SqlConnection         sqlConnection      = null;

            try
            {
                _strConnString = _sqlObject.GetClientDBConnString(pEntContModTracking.ClientId);
                sqlConnection  = new SqlConnection(_strConnString);
                sqlcmd         = new SqlCommand(Schema.ContentModuleTracking.PROC_GET_CONTENT_MODULE_TRACKING, sqlConnection);
                sqlpara        = new SqlParameter(Schema.Common.PARA_ATTEMPT_ID, pEntContModTracking.ID);
                sqlcmd.Parameters.Add(sqlpara);

                sqlpara = new SqlParameter(Schema.ContentModule.PARA_CONTENT_MODULE_ID, pEntContModTracking.ContentModuleId);
                sqlcmd.Parameters.Add(sqlpara);

                sqlpara = new SqlParameter(Schema.Learner.PARA_USER_ID, pEntContModTracking.UserID);
                sqlcmd.Parameters.Add(sqlpara);

                sqlpara = new SqlParameter("SessionId", pEntContModTracking.SessionId);
                sqlcmd.Parameters.Add(sqlpara);

                sqlreader          = _sqlObject.SqlDataReader(sqlcmd, false);
                entContModTracking = FillObject(sqlreader, _sqlObject);
            }
            catch (Exception expCommon)
            {
                //_expCustom = new CustomException(_strMessageId, CustomException.WhoCallsMe(), ExceptionSeverityLevel.Critical, expCommon, true);
                //throw _expCustom;
            }
            finally
            {
                if (sqlreader != null && !sqlreader.IsClosed)
                {
                    sqlreader.Close();
                }
                if (sqlConnection != null && sqlConnection.State != ConnectionState.Closed)
                {
                    sqlConnection.Close();
                }
            }
            entContModTracking.ClientId  = pEntContModTracking.ClientId;
            entContModTracking.SessionId = pEntContModTracking.SessionId;
            return(entContModTracking);
        }
        /// <summary>
        /// To get user details by user id.
        /// </summary>
        /// <param name="pEntLearner"></param>
        /// <returns>Learner</returns>
        public Learner GetUserByID(Learner pEntLearner)
        {
            SqlConnection sqlConnection = null;

            _sqlcmd             = new SqlCommand();
            _sqlcmd.CommandText = Schema.Learner.PROC_GET_USER;
            _sqlObject          = new SQLObject();
            if (!String.IsNullOrEmpty(pEntLearner.ID))
            {
                _sqlpara = new SqlParameter(Schema.Learner.PARA_USER_ID, pEntLearner.ID.ToString());
            }
            else
            {
                _sqlpara = new SqlParameter(Schema.Learner.PARA_USER_ID, null);
            }
            _sqlcmd.Parameters.Add(_sqlpara);
            try
            {
                _strConnString     = _sqlObject.GetClientDBConnString(pEntLearner.ClientId);
                sqlConnection      = new SqlConnection(_strConnString);
                _sqlcmd.Connection = sqlConnection;
                _sqlreader         = _sqlObject.SqlDataReader(_sqlcmd, false);
                _sqlreader.Read();
                _entLearner = FillUserObject(_sqlreader, false, _sqlObject);
            }
            catch (Exception expCommon)
            {
                //_expCustom = new CustomException(_strMessageId, CustomException.WhoCallsMe(), ExceptionSeverityLevel.Critical, expCommon, true);
                throw expCommon;
            }
            finally
            {
                if (_sqlreader != null && !_sqlreader.IsClosed)
                {
                    _sqlreader.Close();
                }
                if (sqlConnection != null && sqlConnection.State != ConnectionState.Closed)
                {
                    sqlConnection.Close();
                }
            }
            return(_entLearner);
        }