Пример #1
0
        private void btnSubmit_ServerClick(object sender, ImageClickEventArgs e)
        {
            ////取得txtNum的值
            //int intUserNum = 0;
            //try
            //{
            //    intUserNum = Convert.ToInt32(((HtmlInputText)(this.FindControl("Form1").FindControl("txtNumber"))).Value);
            //}
            //catch
            //{
            //    intUserNum = 0;
            //}

            //檢查是否大於問題數量
            //if(intUserNum <= intQuestionNum)
            //{

            /*
             * if(strGenerationMethod == "Edit")
             * {
             *      //此問卷是使用者自行編輯
             *
             * //					if(strEditMode == "System" && strFunction == "4")
             * //					{
             * //						//將資料儲存到Paper_GroupingQuestion
             * //
             * //						mySQL.SaveToPaperGroupingQuestion(strPaperID , strGroupID , strGroupDivisionID , intUserNum.ToString());
             * //					}
             * //					else
             * //					{
             *
             *
             *      //取得此組別的亂數選取的QID陣列
             *      string[] arrayQID = this.getQIDArray(intUserNum);//myRandom.getGroupRandomQIDArrayNotSelectLevel1(strGroupID , intUserNum , strPaperID);
             *
             *
             *      string strSQL = "";
             *      if(hiddenQuestionMode.Value == "Specific")
             *      {
             *              strSQL = mySQL.getSpecificQuestionLevel1NotSelect(strPaperID);
             *      }
             *      else
             *      {
             *              strSQL = mySQL.getGroupQuestionLevel1NotSelect(strGroupID,strPaperID);
             *      }
             *
             *      DataSet dsQuestionList = sqldb.getDataSet(strSQL);
             *
             *      //將此陣列的值存入Paper_Content中
             *      if(arrayQID.Length > 0)
             *      {
             *              for(int i=0 ; i< arrayQID.Length ; i++)
             *              {
             *                      string strQID = arrayQID[i];
             *                      DataRow[] tr = dsQuestionList.Tables[0].Select("cQID = '"+strQID+"'");
             *
             *                      //Standard score
             *                      string strScore = "0";
             *
             *                      //QuestionType
             *                      string strQuestionType = "";
             *                      try
             *                      {
             *                              strQuestionType = tr[0]["cQuestionType"].ToString();
             *                      }
             *                      catch
             *                      {
             *                      }
             *
             *                      //QuestionMode
             *                      string strQuestionMode = "";
             *                      try
             *                      {
             *                              strQuestionMode = tr[0]["cQuestionMode"].ToString();
             *                      }
             *                      catch
             *                      {
             *                      }
             *
             *                      //Seq
             *                      string strSeq = Convert.ToString(myReceiver.getPaperContentMaxSeq(strPaperID) + 1);
             *
             *                      //Question
             *                      string strQuestion = "";
             *                      try
             *                      {
             *                              strQuestion = tr[0]["cQuestion"].ToString();
             *                      }
             *                      catch
             *                      {
             *                      }
             *
             *                      //將此題目的資料存入資料庫
             *                      mySQL.SaveToQuestionContent(strPaperID , strQID , strScore , strQuestionType , strQuestionMode , strQuestion , strSeq);
             *              }
             *      }
             *      else
             *      {
             *              //陣列沒有資料的情形
             *      }
             *      dsQuestionList.Dispose();
             *
             *      //}
             * }
             * else
             * {
             *      //此問卷是系統在呈現時隨機選題
             *
             *      //把使用者選擇的問題個數和問題組別資料存入 Paper_RandomQuestionNum
             *
             *      if(hiddenQuestionMode.Value == "Specific")
             *      {
             *              mySQL.saveRandomSpecificQuestionNum(strPaperID , intUserNum);
             *      }
             *      else
             *      {
             *
             *              mySQL.saveRandomQuestionNum(strPaperID , strGroupID , intUserNum);
             *      }
             *      //Response.Write(intUserNum);
             * }
             */
            //mySQL.saveRandomQuestionNum(strPaperID , strGroupID , intUserNum);
            //}

            //將使用者選擇問題難易度的數量存入資料表
            for (int i = 0; i < Request.Form.Count; i++)
            {
                if (Request.Form.Keys[i].ToString().IndexOf("ddlQuestionLevelNum_") != -1)
                {
                    string[] strQuestionLevelNum = Request.Form.Keys[i].ToString().Split('_');
                    int      iQuestionLevel      = Convert.ToInt16(strQuestionLevelNum[1]);
                    int      iQuestionLevelNum   = Convert.ToInt16(Request.Form[i].ToString());
                    mySQL.saveRandomQuestionNum(strPaperID, strGroupID, iQuestionLevelNum, iQuestionLevel);
                }
            }

            Response.Redirect("Paper_OtherQuestion.aspx");
        }