예제 #1
0
        /// <summary>
        /// 建立一個可以顯示建議與非建議選項選擇題的表格
        /// </summary>
        /// <returns></returns>
        public Table setupSingleSelectionQuestionTableByPlainView(string strPaperID, string strCaseID, int intClinicNum, string strSectionName, string strQID, int intQuestionIndex)
        {
            DataReceiver myReceiver = new DataReceiver();

            Table table = new Table();

            //題目
            TableRow trQuestion = new TableRow();

            table.Rows.Add(trQuestion);

            //題號
            TableCell tcNum = new TableCell();

            trQuestion.Cells.Add(tcNum);
            tcNum.Text = intQuestionIndex.ToString();
            tcNum.Attributes.Add("align", "center");
            tcNum.Style.Add("WIDTH", "10px");

            //Question
            string    strQuestion = myReceiver.getSelectionQuestionContent(strQID);
            TableCell tcQuestion  = new TableCell();

            trQuestion.Cells.Add(tcQuestion);
            tcQuestion.Text = strQuestion;

            //設定回饋機制
            TableCell tcRetry = new TableCell();

            trQuestion.Cells.Add(tcRetry);
            tcRetry.Attributes["align"] = "center";
            tcRetry.Style["width"]      = "220px";

            HtmlInputButton btnRetry = new HtmlInputButton("button");

            tcRetry.Controls.Add(btnRetry);
            btnRetry.Style["width"]  = "150px";
            btnRetry.Style["height"] = "30px";
            btnRetry.Value           = "設定回饋機制";
            btnRetry.Attributes.Add("class", "button_continue");
            btnRetry.Attributes["onclick"] = "callRetrySetting('" + strPaperID + "' , '" + strCaseID + "' , '" + intClinicNum + "' , '" + strSectionName + "' , '" + strQID + "')";

            //選項
            SQLString mySQL  = new SQLString();
            string    strSQL = mySQL.getAllSelections(strQID);

            SqlDB   myDB        = new SqlDB(System.Configuration.ConfigurationSettings.AppSettings["connstr"]);
            DataSet dsSelection = myDB.getDataSet(strSQL);

            if (dsSelection.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < dsSelection.Tables[0].Rows.Count; i++)
                {
                    TableRow trSelection = new TableRow();
                    table.Rows.Add(trSelection);

                    string strSelectionID = dsSelection.Tables[0].Rows[i]["cSelectionID"].ToString();
                    int    intSeq         = Convert.ToInt32(dsSelection.Tables[0].Rows[i]["sSeq"]);
                    string strSelection   = dsSelection.Tables[0].Rows[i]["cSelection"].ToString();
                    bool   bSuggested     = Convert.ToBoolean(dsSelection.Tables[0].Rows[i]["bCaseSelect"]);

                    //顯示建議或是非建議選項的圖片
                    TableCell tcControl = new TableCell();
                    trSelection.Cells.Add(tcControl);
                    tcControl.Attributes.Add("align", "center");
                    tcControl.Style.Add("WIDTH", "10px");

                    //img
                    HtmlImage img = new HtmlImage();
                    tcControl.Controls.Add(img);
                    if (bSuggested == true)
                    {
                        //Suggested
                        img.Src = "/Hints/Summary/Images/smiley4.gif";
                    }
                    else
                    {
                        //Un-Suggested
                        img.Src = "/Hints/Summary/Images/smiley11.gif";
                    }

                    //Selection
                    TableCell tcSelection = new TableCell();
                    trSelection.Cells.Add(tcSelection);
                    tcSelection.Text = strSelection;

                    //NextStep
                    TableCell tcNextStep = new TableCell();
                    trSelection.Cells.Add(tcNextStep);
                    tcNextStep.Style["width"] = "220px";
                    tcNextStep.Controls.Add(this.getNextStepTable(strPaperID, strCaseID, intClinicNum, strSectionName, strQID, strSelectionID, bSuggested, intQuestionIndex));
                }
            }
            dsSelection.Dispose();

            //設定外觀
            TableAttribute.setupTopHeaderTableStyle(table, "TableName", 1, "100%", 5, 0, GridLines.Both, true);
            return(table);
        }