示例#1
0
 /// <summary>
 /// Lesson load event
 /// </summary>
 private void Lesson_Load()
 {
     if (!PageContext.Current.IsPreviewMode)
     {
         BusinessServices.Toolbook objToolbook = new BusinessServices.Toolbook();
         if (!objToolbook.StartLesson(PageContext.Current.SessionID))
         {
             Response.Write(ResourceManager.GetString("QuizLesson_Error"));
             Response.End();
             //throw new Exception("Lesson has already been started");
         }
     }
 }
示例#2
0
        /// <summary>
        /// Lesson_OnLoad
        /// </summary>
        /// <param name="sessionID">This is the session id that maps to the lesson that is currently loading</param>
        /// <param name="postData">This is the collection of http post data variables</param>
        private void Lesson_OnLoad(SqlString sessionID, NameValueCollection postData)
        {
            try
            {
                string    strPagesVisited = "";                         // List of pages already visited within this lesson
                string    strBookmark     = "";                         // Bookmarked page, if any
                string    strUsersName    = "";                         // User's full name
                DataTable dtbPagesVisitedResults;
                BusinessServices.Toolbook objToolBook = new BusinessServices.Toolbook();

                //
                // TODO: any other validation including - dateExported, toolbookID
                //


                // Validate that this lesson has not been started before (based on the guid)
                // it should have no date completed
                if (!objToolBook.StartLesson(sessionID))
                {
                    //TODO: check this redirect : Response.Redirect(c_strHomeUrl);

                    OutputToToolBook(
                        cm_strReturnCodeCriticalError                                                             // paramater 1 - ReturnCode
                        + cm_strDelimiter + ResourceManager.GetString("Error1")                                   //"Please make sure you do not use your browser's backwards and forwards buttons. Navigate lessons and quizzes using the buttons in the bottom right hand corner."	// paramater 2 - Error Message
                        + cm_strDelimiter + m_strRootURL + cm_strHomeLocation + "?SessionID=" + (string)sessionID // paramater 3 - ExitURL
                        );
                    return;
                }

                // Get pages visited
                dtbPagesVisitedResults = objToolBook.GetPagesVisited(sessionID);
                foreach (DataRow objPageVisited in dtbPagesVisitedResults.Rows)
                {
                    if (strPagesVisited.Length > 0)
                    {
                        strPagesVisited += ",";
                    }
                    strPagesVisited += objPageVisited["ToolBookPageID"].ToString();
                }

                // Get any Bookmark
                strBookmark = objToolBook.GetBookmark(sessionID);

                // Get user's full name
                strUsersName = objToolBook.GetUser(sessionID);

                OutputToToolBook(
                    cm_strReturnCodeOK                                                                        // paramater 1 - ReturnCode
                    + cm_strDelimiter + strPagesVisited                                                       // paramater 2 - Pages Visited
                    + cm_strDelimiter + strBookmark                                                           // paramater 3 - BookMark
                    + cm_strDelimiter + strUsersName                                                          // paramater 4 - UserName
                    + cm_strDelimiter + m_strRootURL + cm_strHomeLocation + "?SessionID=" + (string)sessionID // paramater 5 - ExitURL
                    + cm_strDelimiter + m_strRootURL + cm_strErrorLocation + "?errnum=14"                     // paramater 6 - ErrorURL
                    + cm_strDelimiter + ""                                                                    // paramater 7 - Error Message
                    );

                // scussfully started lesson
                //  - increase the session timeout
                Session.Timeout = 40;
                return;
            }
            catch (Exception ex)
            {
                //TODO: log this error
                OutputToToolBook(
                    cm_strReturnCodeCriticalError                                            // paramater 1 - ReturnCode
                    + cm_strDelimiter + "TBListner Error 15. Unknown Error" + ex.Message     // paramater 2 - Error Message
                    + cm_strDelimiter + m_strRootURL + cm_strHomeLocation                    // paramater 3 - ExitURL
                    );
                return;
            }
        }        //Lesson_OnLoad