Exemplo n.º 1
0
        /// <summary>
        /// Get AVPath
        /// </summary>
        /// <param name="pEntCourseConfiguration"></param>
        /// <returns></returns>
        public CourseConfiguration GetAVPath(CourseConfiguration pEntCourseConfiguration)
        {
            _sqlObject = new SQLObject();
            CourseConfiguration entCourseConfiguration = new CourseConfiguration();
            SqlConnection       sqlConnection          = null;

            try
            {
                _strConnString      = _sqlObject.GetClientDBConnString(pEntCourseConfiguration.ClientId);
                sqlConnection       = new SqlConnection(_strConnString);
                _sqlcmd             = new SqlCommand();
                _sqlcmd.Connection  = sqlConnection;
                _sqlcmd.CommandText = Schema.CourseConfiguration.PROC_GET_AV_PATH_COURSE_CONFIGURATION;
                Object obj = null;
                obj = _sqlObject.ExecuteScalar(_sqlcmd, false);
                if (obj != null)
                {
                    entCourseConfiguration.AVPath = Convert.ToString(obj);
                }
            }
            catch (Exception expCommon)
            {
                //expCommon = new CustomException(_strMessageId, CustomException.WhoCallsMe(), ExceptionSeverityLevel.Critical, expCommon, true);
                throw expCommon;
            }
            finally
            {
                if (sqlConnection != null && sqlConnection.State != ConnectionState.Closed)
                {
                    sqlConnection.Close();
                }
            }
            return(entCourseConfiguration);
        }
        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.º 3
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);
        }
        /// <summary>
        /// To update FileName
        /// </summary>
        /// <param name="pEntContentModuleTracking"></param>
        /// <returns>ContentModuleTracking object</returns>
        public ContentModuleTracking UpdateScannedFileName(ContentModuleTracking pEntContentModuleTracking)
        {
            _sqlObject         = new SQLObject();
            sqlcmd             = new SqlCommand();
            sqlcmd.CommandText = Schema.Common.PROC_UPDATE_SCANNED_FILE_NAME;
            try
            {
                _strConnString = _sqlObject.GetClientDBConnString(pEntContentModuleTracking.ClientId);
                if (!string.IsNullOrEmpty(pEntContentModuleTracking.ContentModuleId))
                {
                    sqlpara = new SqlParameter(Schema.Common.PARA_ACTIVITY_ID, pEntContentModuleTracking.ContentModuleId);
                    sqlcmd.Parameters.Add(sqlpara);
                }
                if (!string.IsNullOrEmpty(pEntContentModuleTracking.UserID))
                {
                    sqlpara = new SqlParameter(Schema.Common.PARA_SYSTEM_USER_GUID, pEntContentModuleTracking.UserID);
                    sqlcmd.Parameters.Add(sqlpara);
                }
                if (!string.IsNullOrEmpty(pEntContentModuleTracking.ScannedCertificationFileName))
                {
                    sqlpara = new SqlParameter(Schema.Common.PARA_SCANNED_FILE_NAME, pEntContentModuleTracking.ScannedCertificationFileName);
                    sqlcmd.Parameters.Add(sqlpara);
                }

                sqlpara = new SqlParameter(Schema.Common.PARA_ACTIVITY_TYPE, ActivityContentType.Course.ToString());
                sqlcmd.Parameters.Add(sqlpara);

                _sqlObject.ExecuteNonQuery(sqlcmd, _strConnString);
            }
            catch (Exception expCommon)
            {
                //_expCustom = new CustomException(_strMessageId, CustomException.WhoCallsMe(), ExceptionSeverityLevel.Critical, expCommon, true);
                //throw _expCustom;
            }
            return(pEntContentModuleTracking);
        }
        /// <summary>
        /// Bulk Update
        /// </summary>
        /// <param name="pEntListTracking"></param>
        /// <param name="pIsBulkMarkCompleted"></param>
        /// <returns></returns>
        public List <ContentModuleTracking> BulkUpdate(List <ContentModuleTracking> pEntListTracking, bool pIsBulkMarkCompleted)
        {
            _sqlObject = new SQLObject();
            List <ContentModuleTracking> entListTracking = new List <ContentModuleTracking>();
            int            iBatchSize  = 0;
            SqlCommand     _sqlcmd     = null;
            SqlConnection  _sqlcon     = null;
            SqlDataAdapter _sqladapter = null;

            try
            {
                if (pEntListTracking.Count > 0)
                {
                    _dtable = new DataTable();
                    _dtable.Columns.Add(Schema.ContentModuleTracking.COL_ATTEMPT_ID);
                    _dtable.Columns.Add(Schema.ContentModule.COL_CONTENT_MODULE_ID);
                    _dtable.Columns.Add(Schema.Learner.COL_USER_ID);
                    _dtable.Columns.Add(Schema.ContentModuleTracking.COL_DATE_OF_COMPLETION);
                    _dtable.Columns.Add(Schema.ContentModuleTracking.COL_MARKED_COMPLETED_BY_ID);
                    _dtable.Columns.Add(Schema.ContentModuleTracking.COL_COMPLETION_STATUS);
                    _dtable.Columns.Add(Schema.ContentModuleTracking.COL_REVIEWER_COMMENTS);
                    _dtable.Columns.Add(Schema.ContentModuleTracking.COL_SCANNED_CERTIFICATION_FILE_NAME);
                    _dtable.Columns.Add(Schema.Common.COL_IS_BULK_MARK_COMPLETED);

                    foreach (ContentModuleTracking entAttempt in pEntListTracking)
                    {
                        DataRow drow = _dtable.NewRow();

                        if (String.IsNullOrEmpty(_strConnString))
                        {
                            _strConnString = _sqlObject.GetClientDBConnString(entAttempt.ClientId);
                        }
                        if (string.IsNullOrEmpty(entAttempt.ID))
                        {
                            entAttempt.ID = IDGenerator.GetStringGUID();
                        }

                        drow[Schema.ContentModuleTracking.COL_ATTEMPT_ID] = entAttempt.ID;
                        drow[Schema.ContentModule.COL_CONTENT_MODULE_ID]  = entAttempt.ContentModuleId;
                        drow[Schema.Learner.COL_USER_ID] = entAttempt.UserID;
                        drow[Schema.ContentModuleTracking.COL_DATE_OF_COMPLETION]              = entAttempt.DateOfCompletion;
                        drow[Schema.ContentModuleTracking.COL_MARKED_COMPLETED_BY_ID]          = entAttempt.MarkedCompletedById;
                        drow[Schema.ContentModuleTracking.COL_COMPLETION_STATUS]               = entAttempt.CompletionStatus.ToString();
                        drow[Schema.ContentModuleTracking.COL_REVIEWER_COMMENTS]               = entAttempt.ReviewComments;
                        drow[Schema.ContentModuleTracking.COL_SCANNED_CERTIFICATION_FILE_NAME] = entAttempt.ScannedCertificationFileName;
                        drow[Schema.Common.COL_IS_BULK_MARK_COMPLETED] = entAttempt.IsBulkMarkCompleted;

                        iBatchSize = iBatchSize + 1;
                        _dtable.Rows.Add(drow);
                        entListTracking.Add(entAttempt);
                    }

                    if (_dtable.Rows.Count > 0)
                    {
                        _sqlcmd             = new SqlCommand();
                        _sqlcmd.CommandText = Schema.ContentModuleTracking.PROC_UPDATE_MARK_COMPLETED;
                        _sqlcmd.CommandType = CommandType.StoredProcedure;
                        _sqlcon             = new SqlConnection(_strConnString);
                        _sqlcmd.Connection  = _sqlcon;

                        _sqlcmd.Parameters.Add(Schema.ContentModuleTracking.PARA_ATTEMPT_ID, SqlDbType.VarChar, 100, Schema.ContentModuleTracking.COL_ATTEMPT_ID);
                        _sqlcmd.Parameters.Add(Schema.ContentModule.PARA_CONTENT_MODULE_ID, SqlDbType.VarChar, 100, Schema.ContentModule.COL_CONTENT_MODULE_ID);
                        _sqlcmd.Parameters.Add(Schema.Learner.PARA_USER_ID, SqlDbType.VarChar, 100, Schema.Learner.COL_USER_ID);
                        _sqlcmd.Parameters.Add(Schema.ContentModuleTracking.PARA_COMPLETED_DATE, SqlDbType.DateTime, 20, Schema.ContentModuleTracking.COL_DATE_OF_COMPLETION);
                        _sqlcmd.Parameters.Add(Schema.ContentModuleTracking.PARA_MARKED_COMPLETED_BY_ID, SqlDbType.VarChar, 100, Schema.ContentModuleTracking.COL_MARKED_COMPLETED_BY_ID);
                        _sqlcmd.Parameters.Add(Schema.ContentModuleTracking.PARA_COMPLETION_STATUS, SqlDbType.NVarChar, 100, Schema.ContentModuleTracking.COL_COMPLETION_STATUS);
                        _sqlcmd.Parameters.Add(Schema.ContentModuleTracking.PARA_REVIEWER_COMMENTS, SqlDbType.NVarChar, 2000, Schema.ContentModuleTracking.COL_REVIEWER_COMMENTS);
                        _sqlcmd.Parameters.Add(Schema.ContentModuleTracking.PARA_SCANNED_CERTIFICATION_FILE_NAME, SqlDbType.VarChar, 500, Schema.ContentModuleTracking.COL_SCANNED_CERTIFICATION_FILE_NAME);
                        _sqlcmd.Parameters.Add(Schema.Common.PARA_IS_BULK_MARK_COMPLETED, SqlDbType.Bit, 1, Schema.Common.COL_IS_BULK_MARK_COMPLETED);

                        _sqladapter = new SqlDataAdapter();
                        _sqladapter.InsertCommand = _sqlcmd;
                        _sqladapter.InsertCommand.CommandTimeout   = 0;
                        _sqladapter.InsertCommand.UpdatedRowSource = UpdateRowSource.None;
                        _sqladapter.UpdateBatchSize = iBatchSize;
                        _sqladapter.Update(_dtable);
                        _sqladapter.Dispose();
                    }
                }
            }
            catch (Exception expCommon)
            {
                //_expCustom = new CustomException(_strMessageId, CustomException.WhoCallsMe(), ExceptionSeverityLevel.Critical, expCommon, true);
                //throw _expCustom;
            }

            return(entListTracking);
        }
        private void fGenerateLog(ContentModuleTracking pEntContModTracking)
        {
            _sqlObject         = new SQLObject();
            sqlcmd             = new SqlCommand();
            sqlcmd.CommandType = CommandType.StoredProcedure;
            sqlcmd.CommandText = Schema.ContentModuleTracking.PROC_GENERATELOG;
            _strConnString     = _sqlObject.GetClientDBConnString(pEntContModTracking.ClientId);

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

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

            if (DateTime.MinValue.CompareTo(pEntContModTracking.DateOfStart) < 0)
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_DATE_OF_START, pEntContModTracking.DateOfStart);
            }
            else
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_DATE_OF_START, null);
            }
            sqlcmd.Parameters.Add(sqlpara);

            if (pEntContModTracking.DateOfCompletion != null)
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_DATE_OF_COMPLETION, pEntContModTracking.DateOfCompletion);
            }
            else
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_DATE_OF_COMPLETION, null);
            }
            sqlcmd.Parameters.Add(sqlpara);

            sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_TOTAL_NO_OF_PAGES, pEntContModTracking.TotalNoOfPages);
            sqlcmd.Parameters.Add(sqlpara);

            sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_NO_OF_PAGES_COMPLETED, pEntContModTracking.NoOfPagesCompleted);
            sqlcmd.Parameters.Add(sqlpara);

            sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_COMPLETION_STATUS, pEntContModTracking.CompletionStatus.ToString());
            sqlcmd.Parameters.Add(sqlpara);

            if (!string.IsNullOrEmpty(pEntContModTracking.Score))
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_SCORE, pEntContModTracking.Score);
            }
            else
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_SCORE, null);
            }
            sqlcmd.Parameters.Add(sqlpara);

            if (!string.IsNullOrEmpty(pEntContModTracking.UserDataXML))
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_USER_DATA_XML, pEntContModTracking.UserDataXML);
            }
            else
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_USER_DATA_XML, null);
            }
            sqlcmd.Parameters.Add(sqlpara);

            using (SqlConnection conn = new SqlConnection(_strConnString))
            {
                conn.Open();

                sqlcmd.Connection = conn;
                sqlcmd.ExecuteNonQuery();
            }
        }
        /// <summary>
        /// private method to support both Add and Edit content module tracking transactions.
        /// </summary>
        /// <param name="pEntContModTracking"></param>
        /// <param name="pUpdateMode"></param>
        /// <returns>ContentModuleTracking object</returns>
        private ContentModuleTrackingUpdateResult Update(ContentModuleTracking pEntContModTracking, string pStrUpdateMode)
        {
            _sqlObject         = new SQLObject();
            sqlcmd             = new SqlCommand();
            sqlcmd.CommandType = CommandType.StoredProcedure;
            sqlcmd.CommandText = Schema.ContentModuleTracking.PROC_UPDATE_CONTENT_MODULE_TRACKING;
            _strConnString     = _sqlObject.GetClientDBConnString(pEntContModTracking.ClientId);
            //if (pStrUpdateMode == Schema.Common.VAL_INSERT_MODE)
            //{
            //    sqlpara = new SqlParameter(Schema.Common.PARA_UPDATE_MODE, Schema.Common.VAL_INSERT_MODE);
            //}
            //else
            //    sqlpara = new SqlParameter(Schema.Common.PARA_UPDATE_MODE, Schema.Common.VAL_UPDATE_MODE);
            //sqlcmd.Parameters.Add(sqlpara);

            if (string.IsNullOrEmpty(pEntContModTracking.ID))
            {
                pEntContModTracking.ID = pEntContModTracking.LearnerId + IDGenerator.GetUniqueKey(16);
            }

            sqlpara = new SqlParameter(Schema.Common.PARA_CONTENTTRACKID, 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.Common.PARA_IS_BULK_MARK_COMPLETED, pEntContModTracking.IsBulkMarkCompleted);
            //sqlcmd.Parameters.Add(sqlpara);

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

            //if (!string.IsNullOrEmpty(pEntContModTracking.SessionId))
            //{
            //    sqlcmd.Parameters.Add(new SqlParameter(Schema.Learner.PARA_SESSION_ID, pEntContModTracking.SessionId));
            //}

            //sqlcmd.Parameters.Add(new SqlParameter(Schema.ContentModuleTracking.PARA_EXTEND_EXPIRATION_MINUTES, pEntContModTracking.ExtendExpirationMinutes));
            //sqlcmd.Parameters.Add(new SqlParameter(Schema.ContentModuleTracking.PARA_CHECK_EXPIRED_SESSION, pEntContModTracking.CheckExpiredSession));

            if (DateTime.MinValue.CompareTo(pEntContModTracking.DateOfStart) < 0)
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_DATE_OF_START, pEntContModTracking.DateOfStart);
            }
            else
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_DATE_OF_START, null);
            }
            sqlcmd.Parameters.Add(sqlpara);

            if (pEntContModTracking.DateOfCompletion != null)
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_DATE_OF_COMPLETION, pEntContModTracking.DateOfCompletion);
            }
            else
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_DATE_OF_COMPLETION, null);
            }
            sqlcmd.Parameters.Add(sqlpara);

            sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_TOTAL_NO_OF_PAGES, pEntContModTracking.TotalNoOfPages);
            sqlcmd.Parameters.Add(sqlpara);

            sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_NO_OF_PAGES_COMPLETED, pEntContModTracking.NoOfPagesCompleted);
            sqlcmd.Parameters.Add(sqlpara);

            sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_COMPLETION_STATUS, pEntContModTracking.CompletionStatus.ToString());
            sqlcmd.Parameters.Add(sqlpara);

            if (!string.IsNullOrEmpty(pEntContModTracking.Score))
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_SCORE, pEntContModTracking.Score);
            }
            else
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_SCORE, null);
            }
            sqlcmd.Parameters.Add(sqlpara);

            if (!string.IsNullOrEmpty(pEntContModTracking.UserDataXML))
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_USER_DATA_XML, pEntContModTracking.UserDataXML);
            }
            else
            {
                sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_USER_DATA_XML, null);
            }
            sqlcmd.Parameters.Add(sqlpara);

            //if (!string.IsNullOrEmpty(pEntContModTracking.Score))
            //    sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_SCORE, pEntContModTracking.Score);
            //else
            //    sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_SCORE, null);
            //sqlcmd.Parameters.Add(sqlpara);

            //if (!string.IsNullOrEmpty(pEntContModTracking.MarkedCompletedById))
            //    sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_MARKED_COMPLETED_BY_ID, pEntContModTracking.MarkedCompletedById);
            //else
            //    sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_MARKED_COMPLETED_BY_ID, null);
            //sqlcmd.Parameters.Add(sqlpara);

            //if (!string.IsNullOrEmpty(pEntContModTracking.ScannedCertificationFileName))
            //    sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_SCANNED_CERTIFICATION_FILE_NAME, pEntContModTracking.ScannedCertificationFileName);
            //else
            //    sqlpara = new SqlParameter(Schema.ContentModuleTracking.PARA_SCANNED_CERTIFICATION_FILE_NAME, null);
            //sqlcmd.Parameters.Add(sqlpara);

            //sqlcmd.Parameters.AddWithValue(Schema.ContentModuleTracking.PARA_ACTIVITY_NAME, null);
            //sqlcmd.Parameters.AddWithValue(Schema.ContentModuleTracking.PARA_USER_FIRST_LAST_NAME, null);
            //sqlcmd.Parameters.AddWithValue(Schema.ContentModuleTracking.PARA_REVIEWER_COMMENTS, pEntContModTracking.ReviewComments);
            //sqlcmd.Parameters.AddWithValue(Schema.ContentModuleTracking.PARA_REGION_VIEW_INFO, pEntContModTracking.RegionViewInfo);
            //sqlcmd.Parameters.AddWithValue(Schema.ContentModuleTracking.PARA_IS_FOR_ADMIN_PREVIEW, pEntContModTracking.IsForAdminPreview);

            ContentModuleTrackingUpdateResult result = null;

            using (SqlConnection conn = new SqlConnection(_strConnString))
            {
                conn.Open();

                sqlcmd.Connection = conn;

                using (var reader = sqlcmd.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        reader.Read();

                        result = new ContentModuleTrackingUpdateResult();

                        //reader.SetValueForColumn<string>("PreviousCompletionStatus", s => result.PreviousCompletionStatus = s);
                        //reader.SetValueForColumn<string>("CurrentCompletionStatus", s => result.CurrentCompletionStatus = s);
                        //reader.SetValueForColumn<string>("LearnerId", s => result.LearnerId = s);
                    }
                }
            }

            return(result);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Update
        /// </summary>
        /// <param name="pEntCourseConfiguration"></param>
        /// <param name="pUpdateMode"></param>
        /// <returns></returns>
        private CourseConfiguration Update(CourseConfiguration pEntCourseConfiguration, string pUpdateMode)
        {
            int iRows = 0;

            _sqlObject          = new SQLObject();
            _sqlcmd             = new SqlCommand();
            _sqlcmd.CommandText = Schema.CourseConfiguration.PROC_UPDATE_COURSE_CONFIGURATION;
            try
            {
                _strConnString = _sqlObject.GetClientDBConnString(pEntCourseConfiguration.ClientId);

                if (pUpdateMode == Schema.Common.VAL_INSERT_MODE)
                {
                    _sqlpara = new SqlParameter(Schema.Common.PARA_UPDATE_MODE, Schema.Common.VAL_INSERT_MODE);
                    pEntCourseConfiguration.ID = IDGenerator.GetStringGUID();
                }
                else
                {
                    _sqlpara = new SqlParameter(Schema.Common.PARA_UPDATE_MODE, Schema.Common.VAL_UPDATE_MODE);
                }

                _sqlcmd.Parameters.Add(_sqlpara);

                // Allowresize Parameter
                _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_ALLOW_RESIZE, pEntCourseConfiguration.AllowResize);
                _sqlcmd.Parameters.Add(_sqlpara);

                // AllowResize paramater
                _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_ALLOW_SCROLL, pEntCourseConfiguration.AllowScroll);
                _sqlcmd.Parameters.Add(_sqlpara);

                // Avpath paramater
                if (!string.IsNullOrEmpty(pEntCourseConfiguration.AVPath))
                {
                    _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_AV_PATH, pEntCourseConfiguration.AVPath);
                }
                else
                {
                    _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_AV_PATH, System.DBNull.Value);
                }
                _sqlcmd.Parameters.Add(_sqlpara);

                // ClientID paramater
                if (!string.IsNullOrEmpty(pEntCourseConfiguration.ClientId))
                {
                    _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_CLIENT_ID, pEntCourseConfiguration.ClientId);
                }
                else
                {
                    _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_CLIENT_ID, System.DBNull.Value);
                }
                _sqlcmd.Parameters.Add(_sqlpara);

                // Course launch New Window paramater
                _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_COURSE_LAUNCH_NEW_WINDOW, pEntCourseConfiguration.CourseLaunchNewWindow);
                _sqlcmd.Parameters.Add(_sqlpara);

                // Course Launch Same Window paramater
                _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_COURSE_LAUNCH_SAME_WINDOW, pEntCourseConfiguration.CourseLaunchSameWindow);
                _sqlcmd.Parameters.Add(_sqlpara);

                // Course Window Height paramater
                if (pEntCourseConfiguration.CourseWindowHeight != 0)
                {
                    _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_COURSE_WINDOW_HEIGHT, pEntCourseConfiguration.CourseWindowHeight);
                }
                else
                {
                    _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_COURSE_WINDOW_HEIGHT, System.DBNull.Value);
                }
                _sqlcmd.Parameters.Add(_sqlpara);

                // Course Window Width paramater
                if (pEntCourseConfiguration.CourseWindowWidth != 0)
                {
                    _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_COURSE_WINDOW_WIDTH, pEntCourseConfiguration.CourseWindowWidth);
                }
                else
                {
                    _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_COURSE_WINDOW_WIDTH, System.DBNull.Value);
                }
                _sqlcmd.Parameters.Add(_sqlpara);

                // Is Course Session No Expiry paramater
                _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_IS_COURSE_SESSION_NO_EXPIRY, pEntCourseConfiguration.IsCourseSessionNoExpiry);
                _sqlcmd.Parameters.Add(_sqlpara);

                // Mastery Score paramater
                if (pEntCourseConfiguration.MasteryScore != 0)
                {
                    _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_MASTERY_SCORE, pEntCourseConfiguration.MasteryScore);
                }
                else
                {
                    _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_MASTERY_SCORE, System.DBNull.Value);
                }
                _sqlcmd.Parameters.Add(_sqlpara);

                // Max File upload Size paramater
                if (pEntCourseConfiguration.MaxFileUploadSizeMB != 0)
                {
                    _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_MAX_FILE_UPLOAD_SIZE_MB, pEntCourseConfiguration.MaxFileUploadSizeMB);
                }
                else
                {
                    _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_MAX_FILE_UPLOAD_SIZE_MB, System.DBNull.Value);
                }
                _sqlcmd.Parameters.Add(_sqlpara);

                // Course Question Response Tracking paramater
                _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_QUESTION_RESPONSE_TRACKING, pEntCourseConfiguration.QuestionResponseTracking);
                _sqlcmd.Parameters.Add(_sqlpara);

                // Course Launch Same Window paramater
                _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_SCORE_TRACKING, pEntCourseConfiguration.ScoreTracking);
                _sqlcmd.Parameters.Add(_sqlpara);

                // Last Modified by ID paramater
                if (!string.IsNullOrEmpty(pEntCourseConfiguration.LastModifiedById))
                {
                    _sqlpara = new SqlParameter(Schema.Common.PARA_MODIFIED_BY, pEntCourseConfiguration.LastModifiedById);
                }
                else
                {
                    _sqlpara = new SqlParameter(Schema.Common.PARA_MODIFIED_BY, System.DBNull.Value);
                }
                _sqlcmd.Parameters.Add(_sqlpara);

                // Course Configuration ID paramater
                if (!string.IsNullOrEmpty(pEntCourseConfiguration.ID))
                {
                    _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_COURSE_CONFIGURATION_ID, pEntCourseConfiguration.ID);
                }
                else
                {
                    _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_COURSE_CONFIGURATION_ID, System.DBNull.Value);
                }
                _sqlcmd.Parameters.Add(_sqlpara);

                //-aw 6/15/2011 Added course protocol
                _sqlpara = new SqlParameter(Schema.CourseConfiguration.PARA_PROTOCOL, pEntCourseConfiguration.Protocol);
                _sqlcmd.Parameters.Add(_sqlpara);

                iRows = _sqlObject.ExecuteNonQuery(_sqlcmd, _strConnString);
            }
            catch (Exception expCommon)
            {
                //expCommon = new CustomException(_strMessageId, CustomException.WhoCallsMe(), ExceptionSeverityLevel.Critical, expCommon, true);
                throw expCommon;
            }
            return(pEntCourseConfiguration);
        }