示例#1
0
        /// <summary>
        /// 增加問題選項的事件
        /// </summary>
        private void addSelection_Btn_Click(object sender, EventArgs e)
        {
            string new_SelectionID = CommonQuestionUtility.GetNewID(this.author_UserID, "Selection");           //新增的選項ID

            ((QuestionSelectionAccessor)this.Page.Session["QuestionSelectionAccessor"]).add_new_selection(this.strQID, new_SelectionID);
            addSelection(new_SelectionID);
        }
        private void add_Sub_Question_Btn_Click(object sender, EventArgs e)
        {
            string tmpQID      = ((Table)this.Parent.Parent.Parent).ID.Split('@')[1];                      //取得要選項所屬的問題的ID
            string new_Sub_QID = CommonQuestionUtility.GetNewID(this.author_UserID, "Question");           //選項所要新增的問題ID

            ((QuestionAccessor)this.Page.Session["QuestionAccessor"]).add_New_Sub_Question(tmpQID, strSelectionID, new_Sub_QID, this.intLevel + 1);
            add_sub_question(new_Sub_QID);
            addPlusImage(false);
        }
示例#3
0
        /// <summary>
        /// 增加子問題的button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void add_SubQuestion_Btn_Click(object sender, EventArgs e)
        {
            string new_Sub_QID = CommonQuestionUtility.GetNewID(this.author_UserID, "Question");           //選項所要新增的問題ID

            ((QuestionAccessor)this.Page.Session["QuestionAccessor"]).add_New_Sub_Question(this.strQID, new_Sub_QID, this.intLevel + 1);
            // the following is failed by dolphin, currently removed @ 2006-08-20
            //if (Question_Edit_Type == "Choice_Question") {
            //    try {
            //        string strSQL = "INSERT INTO SubQuestionMap VALUES('" + "hsmokCase200607090009459062500" + "','" + this.strQID + "','" + new_Sub_QID + "')";
            //        Hints.DB.clsHintsDB hintsDB = new Hints.DB.clsHintsDB();
            //        hintsDB.ExecuteNonQuery(strSQL);
            //    }
            //    catch { }
            //}
            add_sub_question(new_Sub_QID);
        }
        private void newFirstLevelQuestion()
        {
            QuestionItemControlTable qItemControlTable = null;                    //QuestionItemControlTable
            string QID = CommonQuestionUtility.GetNewID(this.UserID, "Question"); //下面回圈所處理問題ID

            qItemControlTable = new QuestionItemControlTable(this.Question_Edit_Type, this.UserID, QID, "", this, 1, recordDisplayItemID, CaseID);
            this.LayoutTable.Rows.Add(new TableRow());
            this.LayoutTable.Rows[LayoutTable.Rows.Count - 1].Cells.Add(new TableCell());
            this.LayoutTable.Rows[LayoutTable.Rows.Count - 1].Cells[0].Controls.Add(qItemControlTable);
            this.qAccessor.add_New_Question(QID);
            qItemControlTable.addQuestionAnswer(this.Page);

            if ((Question_Edit_Type == "Group_Question" || Question_Edit_Type == "Choice_Question") && !Convert.ToBoolean(Session["bModify"]))
            {
                Session["CurrentEditQuestionNum"] = Convert.ToInt32(Session["totalQuestionNum"]);
            }
            Session["totalQuestionNum"] = Convert.ToInt32(Session["totalQuestionNum"]) + 1;
        }
示例#5
0
//		/// <summary>
//		/// 若問題的編輯模式是"GroupQuestion",則需設定其一些額外的Session變數,以決定其呈現的方式
//		/// </summary>
//		private void setGroupQuestionSessionVariableForDeleteQuestion()
//		{
//			if(this.Question_Edit_Type=="Group_Question" && this.intLevel==1)
//			{
//				if(this.Page.Session["totalQuestionNum"]==null)
//				{
//					Session.Add("totalQuestionNum",drs.Length);
//				}
//				else
//				{
//					Session["totalQuestionNum"] = drs.Length;
//				}
//				if(!Convert.ToBoolean(Session["bModify"]))
//				{
//					Session["CurrentEditQuestionNum"] = Convert.ToInt32(Session["totalQuestionNum"])-1;
//				}
//			}
//		}

        /// <summary>
        /// 用在問診中按新增子問題連帶也會產生子問題的回答
        /// </summary>
        public void addQuestionAnswer(Page page)
        {
            this.Page = page;
            if (this.Question_Edit_Type == "Group_Question" || this.Question_Edit_Type == "Choice_Question")
            {
                string[] new_SelectionID = CommonQuestionUtility.GetNewID(this.author_UserID, "Selection", 4);              //新增的選項ID
                for (int i = 0; i < 4; i++)
                {
                    ((QuestionSelectionAccessor)this.Page.Session["QuestionSelectionAccessor"]).add_new_selection(this.strQID, new_SelectionID[i]);
                    addSelection(new_SelectionID[i]);
                }
            }
            else
            {
                string new_SelectionID = CommonQuestionUtility.GetNewID(this.author_UserID, "Selection");               //新增的選項ID
                ((QuestionSelectionAccessor)this.Page.Session["QuestionSelectionAccessor"]).add_new_selection(this.strQID, new_SelectionID);
                addSelection(new_SelectionID);
            }
        }
        protected void btSaveNew_Click(object sender, EventArgs e)
        {
            string strQuestion      = "";
            string strSelection     = "";
            string strResponse      = "";
            int    strCorrectAnswer = 0;

            string[] strQuestionID = null;
            string   strNewQID     = CommonQuestionUtility.GetNewID(this.UserID, "Question");
            string   strNewSID     = CommonQuestionUtility.GetNewID(this.UserID, "Selection");
            string   strSID        = "";
            string   strRID        = "";
            string   strCID        = "";

            for (int i = 0; i < Request.Form.Count; i++)
            {
                if (Request.Form.Keys[i].ToString().IndexOf("QuestionTextBox@" + strQID) != -1)
                {
                    strQuestion = Request.Form[i].ToString();
                    this.qAccessor.QuestionIndex_INSERT(strNewQID, strQuestion);
                    //儲存一筆資料至QuestionMode
                    SQLString mySQL = new SQLString();
                    mySQL.saveIntoQuestionMode(strNewQID, "", "", strGroupID, "General", "1");
                }
                if (Request.Form.Keys[i].ToString().IndexOf("editLevelDdl@" + strQID) != -1)
                {
                    string strQuestionLevel = Request.Form[i].ToString();
                    int    iQuestionLevel   = AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevelName_SELECT_QuestionLevel(strQuestionLevel);
                    AuthoringTool.QuestionEditLevel.QuestionLevel.INSERT_QuestionLevel(strNewQID, iQuestionLevel);
                }
                if (Request.Form.Keys[i].ToString().IndexOf("editGradeTensDdl@" + strQID) != -1)
                {
                    string strQuestionGradeTens  = Request.Form[i].ToString();
                    string strQuestionGradeUnits = Request.Form[i + 1].ToString();

                    AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionGrade_INSERT(strNewQID, strQuestionGradeTens + strQuestionGradeUnits);
                }
                DataTable dtQuestionSelectionIndex = Hints.Learning.Question.SQLString.getSelectionListFromQuestionSelectionIndexByQID(strQID);
                int       iSCount = 0;
                foreach (DataRow drQuestionSelectionIndex in dtQuestionSelectionIndex.Rows)
                {
                    if (Request.Form.Keys[i].ToString().IndexOf("SelectionTextBox@" + drQuestionSelectionIndex["cSelectionID"].ToString()) != -1)
                    {
                        strSelection = Request.Form[i].ToString();
                        strSID       = drQuestionSelectionIndex["cSelectionID"].ToString();
                    }
                    if (Request.Form.Keys[i].ToString().IndexOf("SelectionResponseTextBox@" + drQuestionSelectionIndex["cSelectionID"].ToString()) != -1)
                    {
                        strResponse = Request.Form[i].ToString();
                        strRID      = drQuestionSelectionIndex["cSelectionID"].ToString();
                    }
                    strCorrectAnswer = 0;
                    if (Request.Form.Keys[i].ToString().IndexOf("IsCorrectChkBox@" + strQID + "#" + drQuestionSelectionIndex["cSelectionID"].ToString()) != -1)
                    {
                        strCorrectAnswer = 1;
                        strCID           = drQuestionSelectionIndex["cSelectionID"].ToString();
                    }
                    else
                    {
                        strCID = drQuestionSelectionIndex["cSelectionID"].ToString();
                    }

                    if (strSID != "" && strRID != "" && strCID != "")
                    {
                        if ((strSID == strRID) && (strSID == strCID) && (strCID == strRID))
                        {
                            iSCount = DataReceiver.QuestionSelectionIndex_SELECT_Seq(strQID, drQuestionSelectionIndex["cSelectionID"].ToString());
                            this.qAccessor.QuestionSelectionIndex_INSERT(strNewQID, strNewSID + "_" + iSCount, iSCount, strSelection, strResponse, strCorrectAnswer);
                        }
                    }
                    //朱君 2012/11/25 將使用者所選擇的特徵值存入暫存陣列中,並儲存於資料庫中。
                    // this.qAccessor.update_FeatureItemIntoDataBase(strQID, get_dtFeatureItem_Data(strGroupID));
                }
            }
            //若從編輯考卷來,直接將問題新增至考卷裡 蕭凱 2014/3/25
            if (hiddenPreOpener.Value == "SelectPaperMode")
            {
                DataReceiver myReceiver = new DataReceiver();
                SQLString    mySQL      = new SQLString();
                //取得考卷題數
                string strSeq = Convert.ToString(myReceiver.getPaperContentMaxSeq(strPaperID) + 1);
                mySQL.SaveToQuestionContent(strPaperID, strNewQID, "0", "1", "General", strSeq);
            }
            FinishSave();
        }
        /// <summary>
        /// 開始至資料庫讀取問題以及問題的選項,並將問題按照父子關係呈現至HTML的Table中,以呈現至前端
        /// </summary>
        private void ProcessData()
        {
            recordDisplayItemID.Value = this.Request.Form["recordDisplayItemID"];
            DataRow[] drs = qAccessor.QuestionIndex.Select("sLevel=1"); //取得第一階層的起始問題
            string    QID = "";

            if (this.Question_Edit_Type == "Group_Question" && !Convert.ToBoolean(Session["bModify"]) && !this.IsPostBack || (this.Question_Edit_Type == "Choice_Question" && !this.IsPostBack && drs.Length == 0))
            {
                QID = CommonQuestionUtility.GetNewID(this.UserID, "Question");                          //下面回圈所處理問題ID
                this.qAccessor.add_New_Question(QID);
                string[] new_SelectionID = CommonQuestionUtility.GetNewID(this.UserID, "Selection", 4); //新增的選項ID
                for (int i = 0; i < 4; i++)
                {
                    this.qsAccessor.add_new_selection(QID, new_SelectionID[i]);
                }
            }


            drs = qAccessor.QuestionIndex.Select("sLevel=1");  //取得第一階層的起始問題
            QuestionItemControlTable qItemControlTable = null; //QuestionItemControlTable
            //			string LevelAndRank = "";
            //下面回圈所處理問題ID
            string QuestionText = "";
            string KeyWordsText = "";

            if (this.Question_Edit_Type == "Group_Question" || this.Question_Edit_Type == "Choice_Question")
            {
                if (Session["totalQuestionNum"] == null)
                {
                    Session.Add("totalQuestionNum", drs.Length);
                }
                else
                {
                    Session["totalQuestionNum"] = drs.Length;
                }
                if (!Convert.ToBoolean(Session["bModify"]))
                {
                    if (this.Page.IsPostBack == false)
                    {
                        Session["CurrentEditQuestionNum"] = Convert.ToInt32(Session["totalQuestionNum"]) - 1;
                    }
                }
                else
                {
                    if ((Request.QueryString["QID"] + "").Length > 0)
                    {
                        strQID = Request.QueryString["QID"].ToString();
                        Session["CurrentEditQuestionNum"] = getCurrentEditQuestionNumByQID(drs, Request.QueryString["QID"] + "");//在修改模式下,取得是哪個問題要修改
                    }
                    else
                    {
                        Session["CurrentEditQuestionNum"] = Convert.ToInt32(Session["totalQuestionNum"]) - 1;
                    }
                }
            }

            for (int i = 0; i < drs.Length; i++)                    //開始針對每個問題作處理
            {
                QID = drs[i]["cQID"].ToString();                    //問題ID
                set_recordDisplayItemID(QID);
                QuestionText      = drs[i]["cQuestion"].ToString(); //問題內容
                KeyWordsText      = drs[i]["cKeyWords"].ToString(); //關鍵字內容
                qItemControlTable = new QuestionItemControlTable(this.Question_Edit_Type, this.UserID, QID, QuestionText, this, 1, this.recordDisplayItemID, CaseID, KeyWordsText);
                this.LayoutTable.Rows.Add(new TableRow());
                this.LayoutTable.Rows[LayoutTable.Rows.Count - 1].Cells.Add(new TableCell());
                this.LayoutTable.Rows[LayoutTable.Rows.Count - 1].Cells[0].Controls.Add(qItemControlTable);
                if (this.Question_Edit_Type == "Group_Question" || this.Question_Edit_Type == "Choice_Question")
                {
                    this.LayoutTable.Rows[LayoutTable.Rows.Count - 1].Style.Add("display", "none");
                }
            }

            //朱君 加入特徵值TABLE
            if (strQID == "")
            {
                strQID = QID;                                                                                  //朱君 避免新創題目時strQID為空
            }
            FeatureItemControl qFeatureItemControlTable = new FeatureItemControl(this, 1, strGroupID, strQID); //FeatureItemControlTable

            qFeatureItemControlTable.ID = "FeatureItemControlTable";
            this.LayoutTableForFeature.Rows.Add(new TableRow());
            this.LayoutTableForFeature.Rows[LayoutTableForFeature.Rows.Count - 1].Cells.Add(new TableCell());
            this.LayoutTableForFeature.Rows[LayoutTableForFeature.Rows.Count - 1].Cells[0].Controls.Add(qFeatureItemControlTable);

            //新增題目時的QID 蕭凱2014/3/25
            strAddNewQID = QID;
        }