/// <summary> /// 儲存編輯問答題網頁上的一題問答題資料 /// </summary> /// <param name="WebPage"></param> /// <param name="strPaperID"></param> /// <param name="strGroupDivisionID"></param> /// <param name="strGroupID"></param> /// <param name="strQuestionMode"></param> public void saveTextQuestion(string strQID, string strQuestion, string strAnswer, string strUserID, string strPaperID, string strQuestionDivisionID, string strQuestionGroupID, string strQuestionMode) { //儲存一筆資料至QuestionIndex saveIntoQuestionIndex(strQID, strQuestion, strAnswer, 1); //儲存一筆資料至Paper_TextQuestion saveIntoPaper_TextQuestion(strQID, strQuestion, strAnswer, 1); //儲存一筆資料至QuestionMode SQLString mySQL = new SQLString(); mySQL.saveIntoQuestionMode(strQID, strPaperID, strQuestionDivisionID, strQuestionGroupID, strQuestionMode, "2"); }
//儲存對話題的問題資料 public static void saveConversation_Question(string strQID, string strQuestion, string strPaperID, string strQuestionDivisionID, string strQuestionGroupID, string strQuestionMode) { //儲存一筆資料至QuestionIndex clsTextQuestion.saveIntoQuestionIndex(strQID, strQuestion, "", 1); //儲存一筆資料至QuestionMode SQLString mySQL = new SQLString(); mySQL.saveIntoQuestionMode(strQID, strPaperID, strQuestionDivisionID, strQuestionGroupID, strQuestionMode, "4"); //儲存一筆資料至QuestionAnswer_Question saveIntoConversation_Question(strQID, strQuestion); }
/// <summary> /// 儲存編輯圖形題資料 /// </summary> /// <param name="WebPage"></param> /// <param name="strPaperID"></param> /// <param name="strGroupDivisionID"></param> /// <param name="strGroupID"></param> /// <param name="strQuestionMode"></param> public void saveSimulatorQuestion(string strQID, string strQuestion, string strPaperID, string strQuestionDivisionID, string strQuestionGroupID, string strQuestionMode) { //儲存一筆資料至QuestionIndex string strAnswer = ""; saveIntoQuestionIndex(strQID, strQuestion, strAnswer, 1); //儲存一筆資料至Paper_TextQuestion //saveIntoPaper_TextQuestion(strQID, strQuestion, strAnswer, 1); //儲存一筆資料至Paper_simulatorQuestion //saveIntoQuestionSimulator(strQID, strAnswer, strOrder, strSimulatorID); //儲存一筆資料至QuestionMode strPaperID=NULL strQuestionDivisionID="" strQuestionGroupID, strQuestionMode=Session SQLString mySQL = new SQLString(); mySQL.saveIntoQuestionMode(strQID, strPaperID, strQuestionDivisionID, strQuestionGroupID, strQuestionMode, "3"); }
/// <summary> /// 儲存編輯問答題網頁上的一題問答題資料 新問答題兩張資料表 QuestionAnswer_Question QuestionAnswer_Answer /// </summary> /// <param name="strQID"></param> /// <param name="strQuestion"></param> /// <param name="strAnswer"></param> /// <param name="strUserID"></param> /// <param name="strPaperID"></param> /// <param name="strQuestionDivisionID"></param> /// <param name="strQuestionGroupID"></param> /// <param name="strQuestionMode"></param> /// <param name="strTextTestDataContent"></param> /// <param name="strTextOutputFormatContent"></param> public void saveProgramQuestionAnswer(string strQID, string strAID, string strQuestion, string strAnswer, string strUserID, string strPaperID, string strQuestionDivisionID, string strQuestionGroupID, string strQuestionMode, string strTextTestDataContent, string strTextOutputFormatContent) { //儲存一筆資料至QuestionIndex //###parameter "strAnswer" can set to NULL in 程式題 saveIntoQuestionIndex(strQID, strQuestion, null, 1); //儲存一筆資料至QuestionMode SQLString mySQL = new SQLString(); mySQL.saveIntoQuestionMode(strQID, strPaperID, strQuestionDivisionID, strQuestionGroupID, strQuestionMode, "7"); // store question description to DB //e.g., saveIntoQuestionAnswer_Question(strQID, strQuestion); // store correct answer to DB //e.g., saveIntoQuestionAnswer_Answer(strQID, strAID, strAnswer); }
/// <summary> /// 儲存編輯問答題網頁上的一題問答題資料 新問答題兩張資料表 QuestionAnswer_Question QuestionAnswer_Answer /// </summary> /// <param name="strQID"></param> /// <param name="strQuestion"></param> /// <param name="strAnswer"></param> /// <param name="strUserID"></param> /// <param name="strPaperID"></param> /// <param name="strQuestionDivisionID"></param> /// <param name="strQuestionGroupID"></param> /// <param name="strQuestionMode"></param> /// <param name="strTextTestDataContent"></param> /// <param name="strTextOutputFormatContent"></param> public void saveProgramQuestionAnswer(string strQID, string strAID, string strQuestion, string strAnswer, string strUserID, string strPaperID, string strQuestionDivisionID, string strQuestionGroupID, string strQuestionMode, string strTextTestDataContent, string strTextOutputFormatContent) { //All the questions need to store a record in QuestionIndex and QuestionMode table. //儲存一筆資料至QuestionIndex //###parameter "strAnswer" can be set to NULL in 程式題 saveIntoQuestionIndex(strQID, strQuestion, null, 1);//set sLevel to 1 for the time being because although sLevel ranges from 0 to 12 ,only sLevel == 1 is used in the entire Hints system //儲存一筆資料至QuestionMode //###with parameter "strQuestionType" set to 7 in 程式題,which is defined in Paper_QuestionTypeNew.aspx to represent the QuestionType of 程式題 SQLString mySQL = new SQLString(); mySQL.saveIntoQuestionMode(strQID, strPaperID, strQuestionDivisionID, strQuestionGroupID, strQuestionMode, "7"); //#######write your code below################### // store question description 'strQuestion' to DB //e.g., saveIntoQuestionAnswer_Question(strQID, strQuestion); // store correct answer 'strAnswer' to file // store Tesing data 'strTextTestDataContent' to file // store output format 'strTextOutputFormatContent' to file }
protected void btSaveNew_Click(object sender, EventArgs e) { string strQuestion = ""; string strSelection = ""; string strResponse = ""; int strCorrectAnswer = 0; string[] strQuestionID = null; string strNewQID = CommonQuestionUtility.GetNewID(this.UserID, "Question"); string strNewSID = CommonQuestionUtility.GetNewID(this.UserID, "Selection"); string strSID = ""; string strRID = ""; string strCID = ""; for (int i = 0; i < Request.Form.Count; i++) { if (Request.Form.Keys[i].ToString().IndexOf("QuestionTextBox@" + strQID) != -1) { strQuestion = Request.Form[i].ToString(); this.qAccessor.QuestionIndex_INSERT(strNewQID, strQuestion); //儲存一筆資料至QuestionMode SQLString mySQL = new SQLString(); mySQL.saveIntoQuestionMode(strNewQID, "", "", strGroupID, "General", "1"); } if (Request.Form.Keys[i].ToString().IndexOf("editLevelDdl@" + strQID) != -1) { string strQuestionLevel = Request.Form[i].ToString(); int iQuestionLevel = AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevelName_SELECT_QuestionLevel(strQuestionLevel); AuthoringTool.QuestionEditLevel.QuestionLevel.INSERT_QuestionLevel(strNewQID, iQuestionLevel); } if (Request.Form.Keys[i].ToString().IndexOf("editGradeTensDdl@" + strQID) != -1) { string strQuestionGradeTens = Request.Form[i].ToString(); string strQuestionGradeUnits = Request.Form[i + 1].ToString(); AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionGrade_INSERT(strNewQID, strQuestionGradeTens + strQuestionGradeUnits); } DataTable dtQuestionSelectionIndex = Hints.Learning.Question.SQLString.getSelectionListFromQuestionSelectionIndexByQID(strQID); int iSCount = 0; foreach (DataRow drQuestionSelectionIndex in dtQuestionSelectionIndex.Rows) { if (Request.Form.Keys[i].ToString().IndexOf("SelectionTextBox@" + drQuestionSelectionIndex["cSelectionID"].ToString()) != -1) { strSelection = Request.Form[i].ToString(); strSID = drQuestionSelectionIndex["cSelectionID"].ToString(); } if (Request.Form.Keys[i].ToString().IndexOf("SelectionResponseTextBox@" + drQuestionSelectionIndex["cSelectionID"].ToString()) != -1) { strResponse = Request.Form[i].ToString(); strRID = drQuestionSelectionIndex["cSelectionID"].ToString(); } strCorrectAnswer = 0; if (Request.Form.Keys[i].ToString().IndexOf("IsCorrectChkBox@" + strQID + "#" + drQuestionSelectionIndex["cSelectionID"].ToString()) != -1) { strCorrectAnswer = 1; strCID = drQuestionSelectionIndex["cSelectionID"].ToString(); } else { strCID = drQuestionSelectionIndex["cSelectionID"].ToString(); } if (strSID != "" && strRID != "" && strCID != "") { if ((strSID == strRID) && (strSID == strCID) && (strCID == strRID)) { iSCount = DataReceiver.QuestionSelectionIndex_SELECT_Seq(strQID, drQuestionSelectionIndex["cSelectionID"].ToString()); this.qAccessor.QuestionSelectionIndex_INSERT(strNewQID, strNewSID + "_" + iSCount, iSCount, strSelection, strResponse, strCorrectAnswer); } } //朱君 2012/11/25 將使用者所選擇的特徵值存入暫存陣列中,並儲存於資料庫中。 // this.qAccessor.update_FeatureItemIntoDataBase(strQID, get_dtFeatureItem_Data(strGroupID)); } } //若從編輯考卷來,直接將問題新增至考卷裡 蕭凱 2014/3/25 if (hiddenPreOpener.Value == "SelectPaperMode") { DataReceiver myReceiver = new DataReceiver(); SQLString mySQL = new SQLString(); //取得考卷題數 string strSeq = Convert.ToString(myReceiver.getPaperContentMaxSeq(strPaperID) + 1); mySQL.SaveToQuestionContent(strPaperID, strNewQID, "0", "1", "General", strSeq); } FinishSave(); }