/// <summary> /// 建構新的子問題 /// </summary> public void add_sub_question(string new_Sub_QID) { QuestionItemControlTable sub_Question_Tb = new QuestionItemControlTable(this.Question_Edit_Type, this.author_UserID, new_Sub_QID, "", this.Page, this.intLevel + 1, hidenRecordDisplayItemID, strCaseID); if (recordDisplayItemID.IndexOf(this.ID + ";") == -1) { hidenRecordDisplayItemID.Value += this.ID + ";"; this.recordDisplayItemID += this.ID + ";"; } if (this.Question_Edit_Type == "Script_Question" || this.Question_Edit_Type == "Interrogation_Enquiry") { sub_Question_Tb.addQuestionAnswer(this.Page); } this.Rows.Add(new TableRow()); this.Rows[this.Rows.Count - 1].Cells.Add(new TableCell()); this.Rows[this.Rows.Count - 1].Cells[0].Controls.Add(sub_Question_Tb); if (this.recordDisplayItemID.IndexOf(this.ID + ";") != -1 && this.Question_Edit_Type != "Interrogation_Enquiry") { //表示使用者尚未點選,因此應該隱藏起來 for (int j = 0; j < this.Rows.Count - 1; j++) { this.Rows[j].Style.Add("DISPLAY", ""); } ((TableRow)this.Parent.Parent).Style.Add("DISPLAY", ""); SelectionLabel.Text = " <b>Selection</b></nobr>"; } }
/// <summary> /// 建構子問題集合 /// </summary> public void add_sub_question() { string sub_QID = ""; string sub_QuestionText = ""; DataRow[] drs = getSub_Question_DataRow(); QuestionItemControlTable sub_Question_Tb = null; //子問題的HTML Table for (int i = 0; i < drs.Length; i++) { sub_QID = drs[i]["cLinkedQID"].ToString(); set_recordDisplayItemID(sub_QID); sub_QuestionText = ((QuestionAccessor)this.Page.Session["QuestionAccessor"]).getQuestionText(sub_QID); sub_Question_Tb = new QuestionItemControlTable(this.Question_Edit_Type, this.author_UserID, sub_QID, sub_QuestionText, this.Page, this.intLevel + 1, hidenRecordDisplayItemID, strCaseID); this.Rows.Add(new TableRow()); if (this.recordDisplayItemID.IndexOf(this.ID + ";") != -1 && this.Question_Edit_Type != "Interrogation_Enquiry") { //表示使用者尚未點選,因此應該隱藏起來 this.Rows[this.Rows.Count - 1].Style.Add("DISPLAY", ""); } else { this.Rows[this.Rows.Count - 1].Style.Add("DISPLAY", "none"); } this.Rows[this.Rows.Count - 1].Cells.Add(new TableCell()); this.Rows[this.Rows.Count - 1].Cells[0].Controls.Add(sub_Question_Tb); } }
/// <summary> /// 加入問題選項或問題的子問題 /// </summary> public void addSelections_SubQuestion() { string follow_up_ID = ""; //ID string follow_up_Text = ""; //內容 string follow_up_Response_Text = ""; //Response bool bIs_Selection_Correct; //選項正確與否 DataRow[] drs = getSelectionDataRow(); SelectionItemControlTable selection_Tb = null; QuestionItemControlTable question_Tb = null; for (int i = 0; i < drs.Length; i++) { follow_up_ID = drs[i]["cSelectionID"].ToString(); follow_up_Text = drs[i]["cSelection"].ToString(); follow_up_Response_Text = drs[i]["cResponse"].ToString(); if (drs[i]["bCaseSelect"] != System.DBNull.Value) { //因為bCaseSelect不是Null,因此表示為問題的選項 bIs_Selection_Correct = Convert.ToBoolean(drs[i]["bCaseSelect"]); selection_Tb = new SelectionItemControlTable(this.Question_Edit_Type, this.author_UserID, this.strQID, follow_up_ID, follow_up_Text, follow_up_Response_Text, bIs_Selection_Correct, this.Page, this.intLevel + 1, hidenRecordDisplayItemID, i, this.strCaseID); if (this.Question_Edit_Type == "Script_Question") { set_recordDisplayItemID(follow_up_ID, "Selection"); Table container = ((Table)this.Rows[1].Cells[0].Controls[0]); container.Rows[0].Cells[2].Controls.Add(selection_Tb.add_Sub_Question_Btn); selection_Tb.add_Sub_Question_Btn.Height = Unit.Pixel(27); } this.Rows.Add(new TableRow()); if (this.recordDisplayItemID.IndexOf(this.ID + ";") == -1) { set_recordDisplayItemID(follow_up_ID, "Question"); //表示使用者尚未點選,因此應該隱藏起來 //若不是問診編輯類型,則也將答案部分隱藏起來 this.Rows[this.Rows.Count - 1].Style.Add("DISPLAY", "none"); } this.Rows[this.Rows.Count - 1].Cells.Add(new TableCell()); this.Rows[this.Rows.Count - 1].Cells[0].Controls.Add(selection_Tb); } else { //因為bCaseSelect為Null,因此表示為問題的子問題 question_Tb = new QuestionItemControlTable(this.Question_Edit_Type, this.author_UserID, follow_up_ID, follow_up_Text, this.Page, this.intLevel + 1, this.hidenRecordDisplayItemID, this.strCaseID); this.Rows.Add(new TableRow()); if (this.recordDisplayItemID.IndexOf(this.ID + ";") == -1 && this.Question_Edit_Type != "Interrogation_Enquiry") { //表示使用者尚未點選,因此應該隱藏起來 this.Rows[this.Rows.Count - 1].Style.Add("DISPLAY", "none"); } this.Rows[this.Rows.Count - 1].Cells.Add(new TableCell()); this.Rows[this.Rows.Count - 1].Cells[0].Controls.Add(question_Tb); } } }
private void newFirstLevelQuestion() { QuestionItemControlTable qItemControlTable = null; //QuestionItemControlTable string QID = CommonQuestionUtility.GetNewID(this.UserID, "Question"); //下面回圈所處理問題ID qItemControlTable = new QuestionItemControlTable(this.Question_Edit_Type, this.UserID, QID, "", this, 1, recordDisplayItemID, CaseID); this.LayoutTable.Rows.Add(new TableRow()); this.LayoutTable.Rows[LayoutTable.Rows.Count - 1].Cells.Add(new TableCell()); this.LayoutTable.Rows[LayoutTable.Rows.Count - 1].Cells[0].Controls.Add(qItemControlTable); this.qAccessor.add_New_Question(QID); qItemControlTable.addQuestionAnswer(this.Page); if ((Question_Edit_Type == "Group_Question" || Question_Edit_Type == "Choice_Question") && !Convert.ToBoolean(Session["bModify"])) { Session["CurrentEditQuestionNum"] = Convert.ToInt32(Session["totalQuestionNum"]); } Session["totalQuestionNum"] = Convert.ToInt32(Session["totalQuestionNum"]) + 1; }
/// <summary> /// 建構新的子問題 /// </summary> public void add_sub_question(string new_Sub_QID) { QuestionItemControlTable sub_Question_Tb = new QuestionItemControlTable(this.Question_Edit_Type, this.author_UserID, new_Sub_QID, "", this.Page, this.intLevel + 1, hidenRecordDisplayItemID, this.strCaseID); if (recordDisplayItemID.IndexOf(this.ID + ";") == -1) { hidenRecordDisplayItemID.Value += this.ID + ";"; } if (this.Question_Edit_Type == "Script_Question" || this.Question_Edit_Type == "Interrogation_Enquiry") { sub_Question_Tb.addQuestionAnswer(this.Page); } this.Rows.Add(new TableRow()); this.Rows[this.Rows.Count - 1].Cells.Add(new TableCell()); this.Rows[this.Rows.Count - 1].Cells[0].Controls.Add(sub_Question_Tb); for (int i = 0; i < this.Rows.Count - 1; i++) { this.Rows[i].Style.Add("display", ""); } string imgSrc = "/HINTS/AuthoringTool/CaseEditor/Paper/CommonQuestionEdit/Image/minus.gif"; QuestionLabel.Text = "<nobr> <img style='cursor:hand;' onclick=\"displaySubQuestion('" + this.ID + "');\" src='" + imgSrc + "'> <b>Question:</b></nobr>"; // if(this.recordDisplayItemID.IndexOf(this.ID+";")==-1 && this.Question_Edit_Type!="Interrogation_Enquiry") // { // //表示使用者尚未點選,因此應該隱藏起來 // for(int j=0;j<this.Rows.Count-1;j++) // { // this.Rows[j].Style.Add("DISPLAY",""); // } // ((TableRow)this.Parent.Parent).Style.Add("DISPLAY",""); // string imgSrc = "../image/minus.gif"; // SelectionLabel.Text = "<nobr> <img style='cursor:hand;' onclick=\"displaySubQuestion('"+this.ID+"');\" src='"+imgSrc+"'> <b>Selection:</b></nobr>"; // } }
/// <summary> /// 開始至資料庫讀取問題以及問題的選項,並將問題按照父子關係呈現至HTML的Table中,以呈現至前端 /// </summary> private void ProcessData() { recordDisplayItemID.Value = this.Request.Form["recordDisplayItemID"]; DataRow[] drs = qAccessor.QuestionIndex.Select("sLevel=1"); //取得第一階層的起始問題 string QID = ""; if (this.Question_Edit_Type == "Group_Question" && !Convert.ToBoolean(Session["bModify"]) && !this.IsPostBack || (this.Question_Edit_Type == "Choice_Question" && !this.IsPostBack && drs.Length == 0)) { QID = CommonQuestionUtility.GetNewID(this.UserID, "Question"); //下面回圈所處理問題ID this.qAccessor.add_New_Question(QID); string[] new_SelectionID = CommonQuestionUtility.GetNewID(this.UserID, "Selection", 4); //新增的選項ID for (int i = 0; i < 4; i++) { this.qsAccessor.add_new_selection(QID, new_SelectionID[i]); } } drs = qAccessor.QuestionIndex.Select("sLevel=1"); //取得第一階層的起始問題 QuestionItemControlTable qItemControlTable = null; //QuestionItemControlTable // string LevelAndRank = ""; //下面回圈所處理問題ID string QuestionText = ""; string KeyWordsText = ""; if (this.Question_Edit_Type == "Group_Question" || this.Question_Edit_Type == "Choice_Question") { if (Session["totalQuestionNum"] == null) { Session.Add("totalQuestionNum", drs.Length); } else { Session["totalQuestionNum"] = drs.Length; } if (!Convert.ToBoolean(Session["bModify"])) { if (this.Page.IsPostBack == false) { Session["CurrentEditQuestionNum"] = Convert.ToInt32(Session["totalQuestionNum"]) - 1; } } else { if ((Request.QueryString["QID"] + "").Length > 0) { strQID = Request.QueryString["QID"].ToString(); Session["CurrentEditQuestionNum"] = getCurrentEditQuestionNumByQID(drs, Request.QueryString["QID"] + "");//在修改模式下,取得是哪個問題要修改 } else { Session["CurrentEditQuestionNum"] = Convert.ToInt32(Session["totalQuestionNum"]) - 1; } } } for (int i = 0; i < drs.Length; i++) //開始針對每個問題作處理 { QID = drs[i]["cQID"].ToString(); //問題ID set_recordDisplayItemID(QID); QuestionText = drs[i]["cQuestion"].ToString(); //問題內容 KeyWordsText = drs[i]["cKeyWords"].ToString(); //關鍵字內容 qItemControlTable = new QuestionItemControlTable(this.Question_Edit_Type, this.UserID, QID, QuestionText, this, 1, this.recordDisplayItemID, CaseID, KeyWordsText); this.LayoutTable.Rows.Add(new TableRow()); this.LayoutTable.Rows[LayoutTable.Rows.Count - 1].Cells.Add(new TableCell()); this.LayoutTable.Rows[LayoutTable.Rows.Count - 1].Cells[0].Controls.Add(qItemControlTable); if (this.Question_Edit_Type == "Group_Question" || this.Question_Edit_Type == "Choice_Question") { this.LayoutTable.Rows[LayoutTable.Rows.Count - 1].Style.Add("display", "none"); } } //朱君 加入特徵值TABLE if (strQID == "") { strQID = QID; //朱君 避免新創題目時strQID為空 } FeatureItemControl qFeatureItemControlTable = new FeatureItemControl(this, 1, strGroupID, strQID); //FeatureItemControlTable qFeatureItemControlTable.ID = "FeatureItemControlTable"; this.LayoutTableForFeature.Rows.Add(new TableRow()); this.LayoutTableForFeature.Rows[LayoutTableForFeature.Rows.Count - 1].Cells.Add(new TableCell()); this.LayoutTableForFeature.Rows[LayoutTableForFeature.Rows.Count - 1].Cells[0].Controls.Add(qFeatureItemControlTable); //新增題目時的QID 蕭凱2014/3/25 strAddNewQID = QID; }