private void setupTextAnswer(Table table, string strQID) { //建立學生答案的function string strSQL = ""; //依照不同MODE呼叫不同的Function switch (strFunction) { case "0": //Author,Case , Class strSQL = mySQL.getTextSummaryByCaseClass(strPaperID, strQID, strCaseID, strClass); break; case "1": //Author , Case , Group strSQL = mySQL.getTextSummaryByCaseGroup(strPaperID, strQID, strCaseID, strGroup); break; case "2": //Author , Case strSQL = mySQL.getTextSummaryByCase(strPaperID, strQID, strCaseID); break; case "3": //Author , Class strSQL = mySQL.getTextSummaryByAuthorClass(strPaperID, strQID, strAuthorID, strClass); break; case "4": //Author , Group strSQL = mySQL.getTextSummaryByAuthorGroup(strPaperID, strQID, strAuthorID, strGroup); break; case "5": //Author strSQL = mySQL.getTextSummaryByAuthor(strPaperID, strQID, strAuthorID); break; case "6": //Case , Class strSQL = mySQL.getTextSummaryByCaseClass(strPaperID, strQID, strCaseID, strClass); break; case "7": //Case , Group strSQL = mySQL.getTextSummaryByCaseGroup(strPaperID, strQID, strCaseID, strGroup); break; case "8": //Case strSQL = mySQL.getTextSummaryByCase(strPaperID, strQID, strCaseID); break; case "9": //Class strSQL = mySQL.getTextSummaryByClass(strPaperID, strQID, strClass); break; case "10": //Group strSQL = mySQL.getTextSummaryByGroup(strPaperID, strQID, strGroup); break; } //設定其內容 DataSet dsAnswer = sqldb.getDataSet(strSQL); if (dsAnswer.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsAnswer.Tables[0].Rows.Count; i++) { //UsrID string strUserID = ""; try { strUserID = dsAnswer.Tables[0].Rows[i]["cUserID"].ToString(); } catch { } //User name string strUserName = ""; try { strUserName = myReceiver.getUserName(strUserID); } catch { } //Answer string strAnswer = ""; try { strAnswer = dsAnswer.Tables[0].Rows[i]["cAnswer"].ToString(); } catch { } TableRow trAnswer = new TableRow(); table.Rows.Add(trAnswer); //建立CSS if ((i % 2) != 0) { trAnswer.Attributes.Add("Class", "header1_tr_odd_row"); } else { trAnswer.Attributes.Add("Class", "header1_tr_even_row"); } /***如果要顯示學生姓名請移除註解 * //學生姓名 * TableCell tcName = new TableCell(); * trAnswer.Cells.Add(tcName); * tcName.Text = "";//strUserName; * tcName.Width = Unit.Pixel(0); */ //答案 TableCell tcAnswer = new TableCell(); trAnswer.Cells.Add(tcAnswer); tcAnswer.Text = strAnswer; tcAnswer.Style.Add("FONT-WEIGHT", "bold"); tcAnswer.Style.Add("FONT-SIZE", "16px"); tcAnswer.ForeColor = System.Drawing.Color.Blue; } } dsAnswer.Dispose(); }