Пример #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            this.Initiate();

            //接收參數
            this.getParameter();

            //找出此Case有哪一個問卷,取出其PaperID。
            strPaperID = mySQL.getPaperIDFromCase(strCaseID, strClinicNum, strSectionName);

            if (Session["PaperID"] != null)
            {
                strPaperID = Session["PaperID"].ToString();
            }

            //取得此問卷是使用者自行編輯或是系統在呈現題目時才亂數選題
            string  strSQL   = mySQL.getPaperHeader(strPaperID);
            DataSet dsHeader = sqldb.getDataSet(strSQL);

            try
            {
                strGenerationMethod = dsHeader.Tables[0].Rows[0]["cGenerationMethod"].ToString();
            }
            catch
            {
            }
            dsHeader.Dispose();

            //取得該組別的總問題數(依照PresentMethod有不同)
            if (strGenerationMethod == "Edit")
            {
                //取得此General組別尚未被選取的問題數量
                intQuestionNum = myReceiver.getGroupSelectionQuestionCountLevel1NotSelect(strGroupID, strPaperID);
            }
            else
            {
                intQuestionNum = myReceiver.getRandomSelectionQuestionCountLevel1NotSelect(strGroupID, strPaperID);
            }

            if (intQuestionNum <= 0)
            {
                //txtNumber.Disabled = true;
            }
            else
            {
                //txtNumber.Disabled = false;
            }

            //設定Title
            spanMax.InnerText = intQuestionNum.ToString();

            //設定問題難易度的顯示數量
            DataTable dtQuestionLevel = new DataTable();

            dtQuestionLevel = AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevelName();
            foreach (DataRow drQuestionLevel in dtQuestionLevel.Rows)
            {
                DataTable dtQuestionLevelNum = new DataTable();
                dtQuestionLevelNum = PaperSystem.DataReceiver.GetQuestionLevelNum(strGroupID);
                string strQuestionLevelName = drQuestionLevel["cLevelName"].ToString();
                int    iQuestionLevel       = AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevelName_SELECT_QuestionLevel(strQuestionLevelName);
                Label  lbQuestionLevelName  = new Label();
                lbQuestionLevelName.Text = "&nbsp;" + strQuestionLevelName;
                phQuestionLevel.Controls.Add(lbQuestionLevelName);
                int iQuestionLevelNum = 0;
                foreach (DataRow drQuestionLevelNum in dtQuestionLevelNum.Rows)
                {
                    if (Convert.ToInt16(drQuestionLevelNum["cQuestionLevel"].ToString()) == iQuestionLevel)
                    {
                        iQuestionLevelNum = Convert.ToInt16(drQuestionLevelNum["QuestionLevelNum"].ToString());
                    }
                }
                DropDownList ddlQuestionLevelNum = new DropDownList();
                for (int i = 0; i <= iQuestionLevelNum; i++)
                {
                    ddlQuestionLevelNum.Items.Add(i.ToString());
                }
                ddlQuestionLevelNum.ID = "ddlQuestionLevelNum_" + iQuestionLevel;
                phQuestionLevel.Controls.Add(ddlQuestionLevelNum);
            }


            //設定Finish button的事件
            btnSubmit.ServerClick += new ImageClickEventHandler(btnSubmit_ServerClick);
        }