private void setupTextQuestionTable() { tcTextQuestionTable.Controls.Clear(); Table table = new Table(); tcTextQuestionTable.Controls.Add(table); table.CellSpacing = 0; table.CellPadding = 5; table.BorderStyle = BorderStyle.Solid; table.BorderWidth = Unit.Pixel(1); table.BorderColor = System.Drawing.Color.Black; table.GridLines = GridLines.Both; table.Width = Unit.Percentage(100); //建立Table的CSS table.CssClass = "header1_table"; //依照QuestionMode決定取出此組別的問答題 string strSQL = mySQL.getGroupTextQuestion(Session["GroupID"].ToString()); DataSet dsQuestionList = sqldb.getDataSet(strSQL); if (dsQuestionList.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsQuestionList.Tables[0].Rows.Count; i++) { string strGetKeyword = Hints.Learning.Question.DataReceiver.getTextQuestionKeyword(dsQuestionList.Tables[0].Rows[i]["cQID"].ToString()); string[] arrKeyword = strGetKeyword.Split(','); //取得QID string strQID = ""; strQID = dsQuestionList.Tables[0].Rows[i]["cQID"].ToString(); //取得QuestionType string strQuestionType = "2"; strQuestionType = dsQuestionList.Tables[0].Rows[i]["cQuestionType"].ToString(); //取得Question string strQuestion = ""; strQuestion = dsQuestionList.Tables[0].Rows[i]["cQuestion"].ToString(); //取得Answer string strAnswer = ""; strAnswer = dsQuestionList.Tables[0].Rows[i]["cAnswer"].ToString(); //取得病徵 string strSymptoms = ""; strSymptoms = AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevel_SELECT_QuestionSymptoms(strQID); if (hfSymptoms.Value == "All" || hfSymptoms.Value == strSymptoms) { intQuestionIndex += 1; #region 建立問答題的內容 TableRow trTextQuestionTitle = new TableRow(); trTextQuestionTitle.Attributes.Add("Class", "header1_table_first_row"); trTextQuestionTitle.Style.Add("CURSOR", "hand"); table.Rows.Add(trTextQuestionTitle); trTextQuestionTitle.Attributes.Add("onclick", "ShowDetail('" + strQID + "','img_" + strQID + "')"); //建立問題的標題 TableRow trQuestionTitle = new TableRow(); trQuestionTitle.Attributes.Add("Class", "header1_tr_odd_row"); table.Rows.Add(trQuestionTitle); trQuestionTitle.ID = "trQuestionTitle_" + strQID; //建立問題的內容 TableRow trQuestion = new TableRow(); trQuestion.Attributes.Add("Class", "header1_tr_even_row"); table.Rows.Add(trQuestion); trQuestion.ID = "trQuestion_" + strQID; //建立Answer的標題 TableRow trAnswerTitle = new TableRow(); trAnswerTitle.Attributes.Add("Class", "header1_tr_odd_row"); table.Rows.Add(trAnswerTitle); trAnswerTitle.ID = "trAnswerTitle_" + strQID; //建立Answer的內容 TableRow trAnswer = new TableRow(); trAnswer.Attributes.Add("Class", "header1_tr_even_row"); table.Rows.Add(trAnswer); trAnswer.ID = "trAnswer_" + strQID; //建立Keyword的標題 TableRow trKeywordTitle = new TableRow(); trKeywordTitle.Attributes.Add("Class", "header1_tr_odd_row"); table.Rows.Add(trKeywordTitle); trKeywordTitle.ID = "trKeywordTitle_" + strQID; //建立Keyword的內容 TableRow trKeyword = new TableRow(); trKeyword.Attributes.Add("Class", "header1_tr_even_row"); table.Rows.Add(trKeyword); trKeyword.ID = "trKeyword_" + strQID; //建立同義問題的標題 TableRow trSynQuestionTitle = new TableRow(); trSynQuestionTitle.Attributes.Add("Class", "header1_tr_odd_row"); table.Rows.Add(trSynQuestionTitle); trSynQuestionTitle.ID = "trSynQuestionTitle_" + strQID; trSynQuestionTitle.Style.Add("CURSOR", "hand"); //建立同義問題的內容 TableRow trSynQuestion = new TableRow(); trSynQuestion.Attributes.Add("Class", "header1_tr_even_row"); table.Rows.Add(trSynQuestion); trSynQuestion.ID = "trSynQuestion_" + strQID; trSynQuestionTitle.Attributes.Add("onclick", "ShowSynDetail('" + trSynQuestion.ID + "' , 'imgSynQuestion_" + strQID + "')"); trSynQuestion.Style.Add("display", "none"); //建立同義答案的標題 TableRow trSynAnswerTitle = new TableRow(); trSynAnswerTitle.Attributes.Add("Class", "header1_tr_odd_row"); table.Rows.Add(trSynAnswerTitle); trSynAnswerTitle.ID = "trSynAnswerTitle_" + strQID; trSynAnswerTitle.Style.Add("CURSOR", "hand"); //建立同義答案的內容 TableRow trSynAnswer = new TableRow(); trSynAnswer.Attributes.Add("Class", "header1_tr_even_row"); table.Rows.Add(trSynAnswer); trSynAnswer.ID = "trSynAnswer_" + strQID; trSynAnswerTitle.Attributes.Add("onclick", "ShowSynDetail('" + trSynAnswer.ID + "' , 'imgSynAnswer_" + strQID + "')"); trSynAnswer.Style.Add("display", "none"); #region 管控同義項的顯示與隱藏 DataTable dtSynQuestion = new DataTable(); DataTable dtSynAnswer = new DataTable(); dtSynQuestion = clsInterrogationEnquiry.GetSynQuestion(strQID); dtSynAnswer = clsInterrogationEnquiry.GetSynAnswer(strQID); if (dtSynQuestion.Rows.Count == 0) { trSynQuestionTitle.Style.Add("display", "none"); trSynQuestion.Style.Add("display", "none"); } if (dtSynAnswer.Rows.Count == 0) { trSynAnswerTitle.Style.Add("display", "none"); trSynAnswer.Style.Add("display", "none"); } #endregion //問題的題號 // TableCell tcQuestionNum = new TableCell(); // trQuestion.Cells.Add(tcQuestionNum); // tcQuestionNum.Style["width"] = "50px"; // tcQuestionNum.Text = "Q" + intQuestionIndex.ToString() + ": "; TableCell tcTextQuestionTitle = new TableCell(); trTextQuestionTitle.Cells.Add(tcTextQuestionTitle); tcTextQuestionTitle.Text = "Q" + intQuestionIndex.ToString() + ": "; tcTextQuestionTitle.Text = "<IMG id='img_" + strQID + "' src='../../../BasicForm/Image/minus.gif'> Q" + intQuestionIndex.ToString() + " : "; TableCell tcQuestionTitle = new TableCell(); trQuestionTitle.Cells.Add(tcQuestionTitle); tcQuestionTitle.Text = "<font style='color:Black; font-weight:bold'>Question : <font/>"; TableCell tcSynQuestionTitle = new TableCell(); trSynQuestionTitle.Cells.Add(tcSynQuestionTitle); tcSynQuestionTitle.Text = "<IMG id='imgSynQuestion_" + strQID + "' src='../../../BasicForm/Image/plus.gif'><font style='color:Black; font-weight:bold'> Synonymous Question : <font/>"; TableCell tcAnswerTitle = new TableCell(); trAnswerTitle.Cells.Add(tcAnswerTitle); tcAnswerTitle.Text = "<font style='color:Black; font-weight:bold'>Answer :<font/>"; TableCell tcSynAnswerTitle = new TableCell(); trSynAnswerTitle.Cells.Add(tcSynAnswerTitle); tcSynAnswerTitle.Text = "<IMG id='imgSynAnswer_" + strQID + "' src='../../../BasicForm/Image/plus.gif'><font style='color:Black; font-weight:bold'> Synonymous Answer : <font/>"; TableCell tcKeywordTitle = new TableCell(); trKeywordTitle.Cells.Add(tcKeywordTitle); tcKeywordTitle.Text = "<font style='color:Black; font-weight:bold'>Keyword : <font/>"; TableCell tcQuestion = new TableCell(); trQuestion.Cells.Add(tcQuestion); if (arrKeyword.Length > 0) { for (int kcount = 0; kcount < arrKeyword.Length; kcount++) { strQuestion = strQuestion.Replace(arrKeyword[kcount], "<span class='span_keyword' >" + arrKeyword[kcount] + "</span>");; tcQuestion.Text = strQuestion; } } TableCell tcSynQuestion = new TableCell(); trSynQuestion.Cells.Add(tcSynQuestion); BulidInterrogation("Question", strQID, tcSynQuestion); TableCell tcAnswer = new TableCell(); trAnswer.Cells.Add(tcAnswer); for (int kcount = 0; kcount < arrKeyword.Length; kcount++) { strAnswer = strAnswer.Replace(arrKeyword[kcount], "<span class='span_keyword' >" + arrKeyword[kcount] + "</span>");; } tcAnswer.Text = strAnswer; TableCell tcSynAnswer = new TableCell(); trSynAnswer.Cells.Add(tcSynAnswer); BulidInterrogation("Answer", strQID, tcSynAnswer); TableCell tcKeyword = new TableCell(); trKeyword.Cells.Add(tcKeyword); tcKeyword.Text = strGetKeyword; //建立修改按鈕的TableRow TableRow trModify = new TableRow(); //trModify.Attributes.Add("Class", "header1_tr_even_row"); table.Rows.Add(trModify); trModify.ID = "trModify_" + strQID; TableCell tcModify = new TableCell(); trModify.Cells.Add(tcModify); tcModify.Attributes["align"] = "right"; // tcModify.ColumnSpan = 2; //問題的難易度 Label lbQuestionLevel = new Label(); tcModify.Controls.Add(lbQuestionLevel); int iQuestionLevel = AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevelValue(strQID); if (iQuestionLevel != -1) { lbQuestionLevel.Text = "Question Level:" + AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevelName_SELECT_LevelName(iQuestionLevel) + " "; } //問題的病徵 Label lbQuestionSymptoms = new Label(); tcModify.Controls.Add(lbQuestionSymptoms); lbQuestionSymptoms.Text = "Question Symptoms:" + AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevel_SELECT_QuestionSymptoms(strQID) + " "; //建立修改問題的Button Button btnModifyText = new Button(); tcModify.Controls.Add(btnModifyText); btnModifyText.Style["width"] = "150px"; btnModifyText.ID = "btnModifyText-" + strQID; btnModifyText.Text = "Modify"; btnModifyText.Click += new EventHandler(btnModifyText_Click); btnModifyText.CssClass = "button_continue"; //建立間隔 Label lblCell = new Label(); tcModify.Controls.Add(lblCell); lblCell.Text = " "; //建立刪除問答題的Button Button btnDeleteText = new Button(); tcModify.Controls.Add(btnDeleteText); btnDeleteText.Style["width"] = "150px"; btnDeleteText.ID = "btnDeleteText-" + strQID; btnDeleteText.Text = "Delete"; btnDeleteText.Click += new EventHandler(btnDeleteText_Click); btnDeleteText.CssClass = "button_continue"; //建立Space TableRow trSpace = new TableRow(); trSpace.Style.Add("background-color", "#EBECED"); table.Rows.Add(trSpace); TableCell tcSpace = new TableCell(); tcSpace.Style.Add("height", "7px"); trSpace.Cells.Add(tcSpace); //if (intQuestionIndex % 2 == 0) //{ // trQuestion.Attributes.Add("Class", "header1_tr_odd_row"); // trModify.Attributes.Add("Class", "header1_tr_odd_row"); //} //else //{ // trQuestion.Attributes.Add("Class", "header1_tr_even_row"); // trModify.Attributes.Add("Class", "header1_tr_even_row"); //} #endregion } } } else { //此問卷沒有任何問答題的情況 trTextQuestionTable.Style["display"] = "none"; } dsQuestionList.Dispose(); }