示例#1
0
 public QuestionSelectionAccessor(QuestionAccessor qAccessor, string Question_Edit_Type)
 {
     this.qAccessor          = qAccessor;
     this.Question_Edit_Type = Question_Edit_Type;
     setQuestionDatatable();
     qAccessor.qsAccessor = this;
 }
示例#2
0
        /// <summary>
        /// 刪除問題的事件
        /// </summary>
        private void deleteQuestion_Btn_Click(object sender, EventArgs e)
        {
            string           parent_SelectionID = "";                                //問題所屬選項ID
            string           sub_QID            = ((Button)sender).ID.Split('@')[1]; //取得要刪除的問題ID
            QuestionAccessor qAccessor          = (QuestionAccessor)this.Page.Session["QuestionAccessor"];

            try
            {
                //如果有父選項
                parent_SelectionID = ((Table)this.Parent.Parent.Parent).ID.Split('@')[1];
                qAccessor.deleteSelection_Question_RelationInDataTable(parent_SelectionID, sub_QID);
            }
            catch {}
            TextBox tb = (TextBox)this.FindControl("Form1").FindControl("QuestionTextBox@" + sub_QID);

            qAccessor.deleteQuestionInDataTable(sub_QID);
            if (((Table)this.Parent.Parent.Parent) != null && ((Table)this.Parent.Parent.Parent).Rows.Count == 2)
            {
                try
                {
                    ((SelectionItemControlTable)this.Parent.Parent.Parent).disablePlusImage();
                }
                catch {}
            }
            ((Table)this.Parent.Parent.Parent).Rows.Remove(((TableRow)this.Parent.Parent));
            if ((this.Question_Edit_Type == "Group_Question" || this.Question_Edit_Type == "Choice_Question") && this.intLevel == 1)
            {
                this.Page.Session["totalQuestionNum"]       = Convert.ToInt32(this.Page.Session["totalQuestionNum"]) - 1;
                this.Page.Session["CurrentEditQuestionNum"] = Convert.ToInt32(this.Page.Session["CurrentEditQuestionNum"]) - 1;
            }
        }
 /// <summary>
 /// //建構問題選擇物件和問題選項選擇物件
 /// </summary>
 private void initQuestion_Selection_Accessor()
 {
     //if (Session["QuestionAccessorParameter"] == null)
     //{ // removed by dolphin @ 2006-08-10
     // modified @ 2006-08-10 by dolphin, update the Session variable in any case.
     // Fix the bug if using Question Editor first, then use the Diagnosis no update the Session, and vice versa.
     Session["QuestionAccessorParameter"] = getQuestionAccessParameter();
     //}
     qAccessor  = new QuestionAccessor(Question_Edit_Type, (Hashtable)Session["QuestionAccessorParameter"], this);
     qsAccessor = new QuestionSelectionAccessor(qAccessor, Question_Edit_Type);
     Session.Add("QuestionSelectionAccessor", qsAccessor);
     Session.Add("QuestionAccessor", qAccessor);
 }
示例#4
0
        private void ret_SelectedIndexChanged(object sender, EventArgs e)
        {
            string           oldQID           = ((DropDownList)sender).ID.Split('@')[1];//取得問題ID
            TextBox          tb               = (TextBox)this.FindControl("Form1").FindControl("QuestionTextBox@" + oldQID);
            string           scriptCategoryID = ((DropDownList)sender).SelectedValue;
            QuestionAccessor qa               = ((QuestionAccessor)this.Page.Session["QuestionAccessor"]);

            ((DropDownList)sender).SelectedItem.Text = qa.getScriptValue(scriptCategoryID);
            string questionText = qa.getScriptQuestion(scriptCategoryID);

            tb.Text = questionText;
            qa.addScriptCategoryIDInQuestionIndex(oldQID, scriptCategoryID, questionText);
        }
 private void SetDataAccessor()
 {
     if (!IsPostBack)
     {
         ViewState.Add("Question_Edit_Type", Question_Edit_Type);
         initQuestion_Selection_Accessor();
     }
     else
     {
         if (Question_Edit_Type == ViewState["Question_Edit_Type"].ToString())
         {
             qAccessor  = (QuestionAccessor)Session["QuestionAccessor"];
             qsAccessor = (QuestionSelectionAccessor)Session["QuestionSelectionAccessor"];
             Session["QuestionAccessorParameter"] = getQuestionAccessParameter();
         }
         else
         {
             ViewState["Question_Edit_Type"] = Question_Edit_Type;
             initQuestion_Selection_Accessor();
         }
     }
 }