/// <summary>
        /// Save text question
        /// </summary>
        //Save Question , Answer Edit to DB Ben2017
        private void SaveQuestionText()
        {
            //儲存題目
            clsProgramQuestion myText                     = new clsProgramQuestion();
            string             strQTextContent            = txtQuestionData.Text;
            string             strATextContent            = txtAnswerData.Text;
            string             strTextTestDataContent     = txtTestData.Text;           //get test data from textarea
            string             strTextOutputFormatContent = txtOutputFormatExData.Text; //get output format from textarea



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


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

            //#######you can now store
            //#####strTextQContent,strTextAContent,strTextTestDataContent,strTextOutputFormatContent
            //#######to DB by passing them to function "saveProgramQuestionAnswer" below, and modify that function
            //#######to meet your need.

            //#######Also,you have to keep the  format of  strATextContent,strTextTestDataContent,and strTextTestDataContent,
            //#######which matters when comparing the result of the program execution.
            myText.saveProgramQuestionAnswer(strQID, strAID, strQTextContent, strATextContent, strUserID, strPaperID, strGroupDivisionID, strGroupID, hiddenQuestionMode.Value, strTextTestDataContent, strTextOutputFormatContent);

            //儲存問題難易度
            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);
            }
        }
        protected void btSaveNew_Click(object sender, EventArgs e)
        {
            //建立QID
            DataReceiver myReceiver = new DataReceiver();

            strQID = strUserID + "_Q_" + myReceiver.getNowTime();
            System.Threading.Thread.Sleep(1000);
            strAID = strUserID + "_A_" + myReceiver.getNowTime();

            //儲存題目
            clsProgramQuestion myText          = new clsProgramQuestion();
            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.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")
            {
                int       intContentSeq = myReceiver.getPaperContentMaxSeq(strPaperID) + 1;
                SQLString mySQL         = new SQLString();
                mySQL.SaveToQuestionContent(strPaperID, strQID, "0", "2", hiddenQuestionMode.Value, intContentSeq.ToString());
            }

            //若從編輯考卷來,直接將問題新增至考卷裡 蕭凱 2014/3/25
            if (hiddenPreOpener.Value == "SelectPaperMode" && hiddenQuestionMode.Value != "Specific")
            {
                SQLString mySQL = new SQLString();
                //取得考卷題數
                string strSeq = Convert.ToString(myReceiver.getPaperContentMaxSeq(strPaperID) + 1);
                mySQL.SaveToQuestionContent(strPaperID, strQID, "0", "2", "General", strSeq);
                Session.Remove("PreOpener");
            }

            //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_QuestionViewNew.aspx?Opener=Paper_TextQuestionEditor");
                }
                else
                {
                    Response.Redirect("Paper_QuestionMain.aspx?Opener=Paper_TextQuestionEditor");
                }
                break;

            case "PreviewPaper":
                if (hiddenPreOpener.Value == "SelectPaperMode")
                {
                    Response.Redirect("Paper_MainPage.aspx?Opener=SelectPaperMode&cCaseID=" + strCaseID + "&cSectionName=" + strSectionName + "&cPaperID=" + strPaperID);
                }
                else
                {
                    Response.Redirect("Paper_MainPage.aspx?Opener=Paper_TextQuestionEditor");
                }
                break;

            default:
                Response.Redirect("Paper_QuestionMain.aspx?Opener=Paper_TextQuestionEditor");
                break;
            }
        }
        private void btnSaveNextQuestion_ServerClick(object sender, EventArgs e)
        {
            DataReceiver myReceiver = new DataReceiver();

            //儲存題目
            clsProgramQuestion myText                     = new clsProgramQuestion();
            string             strTextQContent            = txtQuestionData.Text;       //get question description from textarea
            string             strTextAContent            = txtAnswerData.Text;         //get answer from textarea
            string             strTextTestDataContent     = txtTestData.Text;           //get test data from textarea
            string             strTextOutputFormatContent = txtOutputFormatExData.Text; //get output format from textarea

            //replace some certain chars in the content retrieved from the above four textareas.
            strTextQContent            = strTextQContent.Replace("&lt;", "<");
            strTextQContent            = strTextQContent.Replace("&gt;", ">");
            strTextAContent            = strTextAContent.Replace("&lt;", "<");
            strTextAContent            = strTextAContent.Replace("&gt;", ">");
            strTextTestDataContent     = strTextTestDataContent.Replace("&lt;", "<");
            strTextTestDataContent     = strTextTestDataContent.Replace("&gt;", ">");
            strTextOutputFormatContent = strTextOutputFormatContent.Replace("&lt;", "<");
            strTextOutputFormatContent = strTextOutputFormatContent.Replace("&gt;", ">");



            myText.saveQuestionAnswer(strQID, strAID, 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");
        }