Exemplo n.º 1
0
        /// <summary>
        /// 建立顯示某問卷隨機出題的清單
        /// </summary>
        /// <param name="strPaperID"></param>
        /// <returns></returns>
        public Table getListTableFromRandomNum(string strPaperID)
        {
            Table table = new Table();

            //取得RandomNum的資料
            DataTable dtRandom = SQLString.getPaperInformationFromPaper_RandomQuestionNumWithGroupName(strPaperID);

            if (dtRandom.Rows.Count > 0)
            {
                //建立標頭欄位
                TableRow trTitle = new TableRow();
                table.Rows.Add(trTitle);

                //QuestionGroupName
                TableCell tcGroupNameTitle = new TableCell();
                trTitle.Cells.Add(tcGroupNameTitle);
                tcGroupNameTitle.Text = "Group name";

                //QustionNum
                TableCell tcQustionNumTitle = new TableCell();
                trTitle.Cells.Add(tcQustionNumTitle);
                tcQustionNumTitle.Text = "Question number";

                for (int i = 0; i < dtRandom.Rows.Count; i++)
                {
                    TableRow tr = new TableRow();
                    table.Rows.Add(tr);

                    //QuestionGroupName
                    TableCell tcGroupName = new TableCell();
                    tr.Cells.Add(tcGroupName);
                    tcGroupName.Text = dtRandom.Rows[i]["cNodeName"].ToString();

                    //QustionNum
                    TableCell tcQuestionNum = new TableCell();
                    tr.Cells.Add(tcQuestionNum);
                    tcQuestionNum.Style["width"]      = "180px";
                    tcQuestionNum.Attributes["align"] = "center";
                    tcQuestionNum.Text = dtRandom.Rows[i]["sQuestionNum"].ToString();
                }
            }

            //CSS
            TableAttribute.setupTopHeaderTableStyle(table, "TableName", 1, "60%", 5, 0, GridLines.Both, true);

            return(table);
        }