/// <summary>
        /// Save text question
        /// </summary>
        private void SaveQuestionText()
        {
            //儲存題目
            clsTextQuestion myText          = new clsTextQuestion();
            string          strQTextContent = txtQuestionData.Text;
            string          strATextContent = txtAnswerData.Text;

            strQTextContent = strQTextContent.Replace("&lt;", "<");
            strQTextContent = strQTextContent.Replace("&gt;", ">");
            strATextContent = strATextContent.Replace("&lt;", "<");
            strATextContent = strATextContent.Replace("&gt;", ">");

            myText.saveTextQuestion(strQID, strQTextContent, strATextContent, strUserID, strPaperID, strGroupDivisionID, strGroupID, hiddenQuestionMode.Value);

            //儲存問題難易度
            int iQuestionLevel = AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevelName_SELECT_QuestionLevel(ddlQuestionLevel.SelectedValue);

            AuthoringTool.QuestionEditLevel.QuestionLevel.INSERT_QuestionLevel(strQID, iQuestionLevel);

            //儲存問題的病徵
            AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevel_INSERT_QuestionSymptoms(strQID, ddlSymptoms.SelectedValue);

            //如果是Specific題目則需儲存一筆資料至Paper_Content
            if (hiddenQuestionMode.Value == "Specific")
            {
                DataReceiver myReceiver    = new DataReceiver();
                int          intContentSeq = myReceiver.getPaperContentMaxSeq(strPaperID) + 1;
                SQLString    mySQL         = new SQLString();
                mySQL.SaveToQuestionContent(strPaperID, strQID, "0", "2", hiddenQuestionMode.Value, intContentSeq.ToString());
            }
        }
Example #2
0
        /// <summary>
        /// Save text question
        /// </summary>
        private void SaveQuestionText()
        {
            //儲存題目
            clsTextQuestion myText          = new clsTextQuestion();
            string          strQTextContent = txtQuestionData.Text; //get the question description from question textarea
            string          strATextContent = txtAnswerData.Text;   //get the correct answer from answer textarea

            strQTextContent = strQTextContent.Replace("&lt;", "<");
            strQTextContent = strQTextContent.Replace("&gt;", ">");
            strATextContent = strATextContent.Replace("&lt;", "<");
            strATextContent = strATextContent.Replace("&gt;", ">");

            ////use JS alert() in C#
            ScriptManager.RegisterStartupScript(
                this,
                typeof(Page),
                "Alert",
                "<script>alert('aa: " + strATextContent + "');</script>",
                false);
            ///////


            //store the question description and correct answer to the question to DB.
            myText.saveQuestionAnswer(strQID, strAID, strQTextContent, strATextContent, strUserID, strPaperID, strGroupDivisionID, strGroupID, hiddenQuestionMode.Value);

            //儲存問題難易度
            int iQuestionLevel = AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevelName_SELECT_QuestionLevel(ddlQuestionLevel.SelectedValue);

            AuthoringTool.QuestionEditLevel.QuestionLevel.INSERT_QuestionLevel(strQID, iQuestionLevel);

            //儲存問題的病徵
            AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevel_INSERT_QuestionSymptoms(strQID, ddlSymptoms.SelectedValue);

            //如果是Specific題目則需儲存一筆資料至Paper_Content
            if (hiddenQuestionMode.Value == "Specific")
            {
                DataReceiver myReceiver    = new DataReceiver();
                int          intContentSeq = myReceiver.getPaperContentMaxSeq(strPaperID) + 1;
                SQLString    mySQL         = new SQLString();
                mySQL.SaveToQuestionContent(strPaperID, strQID, "0", "2", hiddenQuestionMode.Value, intContentSeq.ToString());
            }

            //若從編輯考卷來,直接將問題新增至考卷裡 蕭凱 2014/3/25
            if (Session["IsFromClassExercise"] != null && Session["IsFromClassExercise"].ToString() == "True")
            {
                DataReceiver myReceiver = new DataReceiver();
                SQLString    mySQL      = new SQLString();
                //取得考卷題數
                string strSeq = Convert.ToString(myReceiver.getPaperContentMaxSeq(strPaperID) + 1);
                mySQL.SaveToQuestionContent(strPaperID, strQID, "0", "2", "General", strSeq);
            }
        }
        private void btnSaveNextQuestion_ServerClick(object sender, EventArgs e)
        {
            DataReceiver myReceiver = new DataReceiver();

            //儲存題目
            clsTextQuestion myText          = new clsTextQuestion();
            string          strTextQContent = txtQuestionData.Text;
            string          strTextAContent = txtAnswerData.Text;

            strTextQContent = strTextQContent.Replace("&lt;", "<");
            strTextQContent = strTextQContent.Replace("&gt;", ">");
            strTextAContent = strTextAContent.Replace("&lt;", "<");
            strTextAContent = strTextAContent.Replace("&gt;", ">");
            myText.saveTextQuestion(strQID, strTextQContent, strTextAContent, strUserID, strPaperID, strGroupDivisionID, strGroupID, hiddenQuestionMode.Value);

            //儲存問題難易度
            int iQuestionLevel = AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevelName_SELECT_QuestionLevel(ddlQuestionLevel.SelectedValue);

            AuthoringTool.QuestionEditLevel.QuestionLevel.INSERT_QuestionLevel(strQID, iQuestionLevel);

            //儲存問題的病徵
            AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevel_INSERT_QuestionSymptoms(strQID, ddlSymptoms.SelectedValue);

            //如果是Specific題目則需儲存一筆資料至Paper_Content
            if (hiddenQuestionMode.Value == "Specific")
            {
                int       intContentSeq = myReceiver.getPaperContentMaxSeq(strPaperID) + 1;
                SQLString mySQL         = new SQLString();
                mySQL.SaveToQuestionContent(strPaperID, strQID, "0", "2", hiddenQuestionMode.Value, intContentSeq.ToString());
            }

            //Redirect至此網頁
            //Response.Redirect("Paper_TextQuestionEditor.aspx?Opener=" + hiddenOpener.Value);

            //建立QID
            strQID = strUserID + "_" + myReceiver.getNowTime();

            //清除TextArea
            txtQuestionData.Text = "";
            txtAnswerData.Text   = "";
            string strScript = "<script language='javascript'>\n";

            strScript += "Clear()\n";
            strScript += "</script>\n";
            Page.RegisterStartupScript("Clear", strScript);

            hrQuestion.Style.Add("display", "none");
            hrAnswer.Style.Add("display", "none");
            BulidInterrogation("Question");
            BulidInterrogation("Answer");
        }
        /// <summary>
        /// Save text question
        /// </summary>
        private void SaveQuestionText()
        {
            //儲存題目
            clsTextQuestion myText          = new clsTextQuestion();
            string          strQTextContent = txtQuestionEdit.Text;

            strQTextContent = strQTextContent.Replace("&lt;", "<");
            strQTextContent = strQTextContent.Replace("&gt;", ">");

            clsConversation.saveConversation_Question(strQID, strQTextContent, strPaperID, strGroupDivisionID, strGroupID, hiddenQuestionMode.Value);

            if (Request.QueryString["OpenGroupID"] != null) // 若從Search頁面開啟,儲存時要額外Insert一筆資料到QuestionMode,表示在OpenGroupID中也要有這類題目  老詹 2015/09/06
            {
                clsHintsDB sqldb = new clsHintsDB();
                string     strGetOpenGroupName = "SELECT cNodeName FROM QuestionGroupTree WHERE cNodeID='" + Request.QueryString["OpenGroupID"].ToString() + "'";
                DataTable  dtGetOpenGroupName  = sqldb.getDataSet(strGetOpenGroupName).Tables[0];
                if (dtGetOpenGroupName.Rows.Count > 0)
                {
                    string    strCheckRepeat = "SELECT * FROM QuestionMode WHERE cQID='" + strQID + "' AND cQuestionGroupID = '" + Request.QueryString["OpenGroupID"].ToString() + "'";
                    DataTable dtCheckRepeat  = sqldb.getDataSet(strCheckRepeat).Tables[0];
                    if (dtCheckRepeat.Rows.Count <= 0)
                    {
                        string strInsertOtherGroupSQL = "INSERT INTO QuestionMode(cQID,cQuestionGroupID,cQuestionGroupName,cQuestionMode,cQuestionType) VALUES ('" + strQID + "','" + Request.QueryString["OpenGroupID"].ToString() + "','" + dtGetOpenGroupName.Rows[0]["cNodeName"].ToString() + "','General','4')";
                        sqldb.ExecuteNonQuery(strInsertOtherGroupSQL);
                    }
                }
            }

            //儲存Problem Type
            AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevel_INSERT_QuestionSymptoms(strQID, "All");

            //如果是Specific題目則需儲存一筆資料至Paper_Content
            if (hiddenQuestionMode.Value == "Specific")
            {
                DataReceiver myReceiver    = new DataReceiver();
                int          intContentSeq = myReceiver.getPaperContentMaxSeq(strPaperID) + 1;
                SQLString    mySQL         = new SQLString();
                mySQL.SaveToQuestionContent(strPaperID, strQID, "0", "2", hiddenQuestionMode.Value, intContentSeq.ToString());
            }
        }
        protected void btSaveNew_Click(object sender, EventArgs e)
        {
            //建立QID
            DataReceiver myReceiver = new DataReceiver();

            strQID = strUserID + "_" + myReceiver.getNowTime();

            //儲存題目
            clsTextQuestion myText          = new clsTextQuestion();
            string          strQTextContent = txtQuestionData.Text;
            string          strATextContent = txtAnswerData.Text;

            strQTextContent = strQTextContent.Replace("&lt;", "<");
            strQTextContent = strQTextContent.Replace("&gt;", ">");
            strATextContent = strATextContent.Replace("&lt;", "<");
            strATextContent = strATextContent.Replace("&gt;", ">");

            myText.saveTextQuestion(strQID, strQTextContent, strATextContent, strUserID, strPaperID, strGroupDivisionID, strGroupID, hiddenQuestionMode.Value);

            //儲存問題難易度
            int iQuestionLevel = AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevelName_SELECT_QuestionLevel(ddlQuestionLevel.SelectedValue);

            AuthoringTool.QuestionEditLevel.QuestionLevel.INSERT_QuestionLevel(strQID, iQuestionLevel);

            //儲存問題的病徵
            AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevel_INSERT_QuestionSymptoms(strQID, ddlSymptoms.SelectedValue);

            //如果是Specific題目則需儲存一筆資料至Paper_Content
            if (hiddenQuestionMode.Value == "Specific")
            {
                int       intContentSeq = myReceiver.getPaperContentMaxSeq(strPaperID) + 1;
                SQLString mySQL         = new SQLString();
                mySQL.SaveToQuestionContent(strPaperID, strQID, "0", "2", hiddenQuestionMode.Value, intContentSeq.ToString());
            }

            //Redirect至下一個網頁
            string strSystemFunction = "";

            if (Session["SystemFunction"] != null)
            {
                strSystemFunction = Session["SystemFunction"].ToString();
            }

            switch (strSystemFunction)
            {
            case "EditPaper":
                Response.Redirect("Paper_OtherQuestion.aspx?Opener=Paper_TextQuestionEditor");
                break;

            case "EditQuestion":
                if (Request.QueryString["QID"] != null)
                {
                    Response.Redirect("Paper_QuestionView.aspx?Opener=Paper_TextQuestionEditor");
                }
                else
                {
                    Response.Redirect("Paper_QuestionMain.aspx?Opener=Paper_TextQuestionEditor");
                }
                break;

            case "PreviewPaper":
                Response.Redirect("Paper_MainPage.aspx?Opener=Paper_TextQuestionEditor");
                break;

            default:
                Response.Redirect("Paper_QuestionMain.aspx?Opener=Paper_TextQuestionEditor");
                break;
            }
        }