private void InititateLayoutTableForFeature() { LayoutTableForFeature.ID = "LayoutTableForFeature"; //第一列 LayoutTableForFeature.Width = Unit.Parse("100%"); //LayoutTable.BorderWidth = Unit.Parse("3px"); //LayoutTable.BorderColor = Color.Green; LayoutTableForFeature.ID = "LayoutTableForFeature_1"; LayoutTableForFeature.Rows.Add(new TableRow()); LayoutTableForFeature.Rows[LayoutTableForFeature.Rows.Count - 1].Cells.Add(new TableCell()); Label FeatureTitle = new Label(); FeatureTitle.Text = "SetFeature"; LayoutTableForFeature.Rows[LayoutTableForFeature.Rows.Count - 1].Cells[0].Controls.Add(FeatureTitle); LayoutTableForFeature.Rows[LayoutTableForFeature.Rows.Count - 1].Cells[0].CssClass = "title"; //第二列 LayoutTableForFeature.Rows.Add(new TableRow()); LayoutTableForFeature.Rows[LayoutTableForFeature.Rows.Count - 1].Cells.Add(new TableCell()); Table containerForFeature = CommonQuestionUtility.get_HTMLTable(1, 2); LayoutTableForFeature.Rows[LayoutTableForFeature.Rows.Count - 1].Cells[0].Controls.Add(containerForFeature); 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); }
/// <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; }