/// <summary> /// 儲存一個題目下所有選項的資料至Paper_NextStepBySelectionID /// </summary> /// <param name="WebPage"></param> /// <param name="strPaperID"></param> /// <param name="strQID"></param> /// <param name="strSelectionID"></param> /// <param name="intQuestionIndex"></param> public void saveNextStepBySelectionID(System.Web.UI.Page WebPage, string strPaperID, string strQID, int intQuestionIndex) { //DataReceiver myReceiver = new DataReceiver(); //選項 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++) { string strSelectionID = dsSelection.Tables[0].Rows[i]["cSelectionID"].ToString(); int intSelectionIndex = 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"]); //取得題號下拉式選單被選取的內容 string strDlIndexID = "dlSelection-Index-" + strSelectionID; DropDownList dlIndex = ((DropDownList)(WebPage.FindControl("Form1").FindControl(strDlIndexID))); int intNextIndex = Convert.ToInt32(dlIndex.SelectedItem.Value); //取得Section下拉式選單被選取的內容 string strDlSectionID = "dlSelection-Section-" + strSelectionID; DropDownList dlSection = ((DropDownList)(WebPage.FindControl("Form1").FindControl(strDlSectionID))); string strNextSection = ""; if (dlSection.SelectedItem != null) { strNextSection = dlSection.SelectedItem.Value; } //此選項的NextStep是By Section還是題號 int intNextMethod = 2; //檢查此選項的NextStep是Section還是題號 string strRbIndexID = "rbIndex-" + strSelectionID; RadioButton rbIndex = ((RadioButton)(WebPage.FindControl("Form1").FindControl(strRbIndexID))); string strRbSectionID = "rbSection-" + strSelectionID; RadioButton rbSection = ((RadioButton)(WebPage.FindControl("Form1").FindControl(strRbSectionID))); string strRbDefaultID = "rbDefault-" + strSelectionID; RadioButton rbDefault = ((RadioButton)(WebPage.FindControl("Form1").FindControl(strRbDefaultID))); if (rbIndex.Checked == true) { if (intNextIndex == 0) { //結束Section intNextMethod = 0; } else { //題號 intNextMethod = 2; } } else if (rbSection.Checked == true) { //Section intNextMethod = 1; } else { //Default intNextMethod = 9999; intNextIndex = 9999; } //把資料存入Paper_NextStepBySelectionID SQLString.SaveToPaper_NextStepBySelectionID(strPaperID, strQID, intQuestionIndex, strSelectionID, intSelectionIndex, intNextMethod, strNextSection, intNextIndex); } } dsSelection.Dispose(); }