コード例 #1
0
    public string GetAllKeyword()
    {
        clsKeywordsUtil KeywordsUtil = (clsKeywordsUtil)Session["KeywordsUtil"];
        string          strTest      = KeywordsUtil.GetKeywords();

        return(strTest);
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Ajax.Utility.RegisterTypeForAjax(typeof(AuthoringTool_CaseEditor_Paper_Paper_EditKeywordAndSynonyms));

        if (!IsPostBack)
        {
            if (Request.QueryString["DataBaseName"] != null)
            {
                strDataBaseName = Request.QueryString["DataBaseName"].ToString();//"Hints";
            }
            if (Request.QueryString["DataTableName"] != null)
            {
                strDataTableName = Request.QueryString["DataTableName"].ToString();//"Conversation_Question";
            }
            if (Request.QueryString["KeyWordsFieldName"] != null)
            {
                strKeyWordsFieldName = Request.QueryString["KeyWordsFieldName"].ToString();//"cKeyword";
            }
            if (Request.QueryString["CompareFieldsNames"] != null)
            {
                strCompareFieldsNames = Request.QueryString["CompareFieldsNames"].ToString();//"cQuestion|cQID";
            }
            if (Request.QueryString["CompareFieldsValues"] != null)
            {
                strCompareFieldsValues = Request.QueryString["CompareFieldsValues"].ToString();//"test conversation question|7046_178";
            }

            if (KeywordsUtil == null)
            {
                KeywordsUtil = new clsKeywordsUtil(strDataBaseName, strDataTableName, strKeyWordsFieldName, strCompareFieldsNames, strCompareFieldsValues);
                string strOriKey = KeywordsUtil.GetKeywords();
                if (strOriKey != "")
                {
                    div_section4.Controls.Add(KeywordsUtil.ConstructKeywordTable(strOriKey, true));
                }
                Session["KeywordsUtil"] = KeywordsUtil;
            }
        }

        Addnewtb.ServerClick    += new EventHandler(Addnewtb_ServerClick);
        btnKeyTable.ServerClick += new EventHandler(btnKeyTable_ServerClick);
        Remove_Btn.ServerClick  += new EventHandler(Remove_Btn_ServerClick);
    }
コード例 #3
0
    private void Remove_Btn_ServerClick(object sender, EventArgs e)
    {
        tbTypeNewKeyword.Text = "";
        clsKeywordsUtil KeywordsUtil = (clsKeywordsUtil)Session["KeywordsUtil"];
        string          keyword      = KeywordsUtil.GetKeywords();

        if (HiddenFieldforRemove.Value != null)
        {
            string[] arrKeyword = keyword.Split('|');
            keyword = null;
            for (int i = 0; i < arrKeyword.Length; i++)
            {
                if ((arrKeyword[i].IndexOf(HiddenFieldforRemove.Value.ToString()) >= 0) || (arrKeyword[i] == ""))
                {
                    continue;
                }
                else
                {
                    if (i == arrKeyword.Length - 1)
                    {
                        keyword += arrKeyword[i];
                    }
                    else
                    {
                        keyword += arrKeyword[i] + "|";
                    }
                }
            }
            if (keyword != null)
            {
                if (keyword.LastIndexOf('|') == keyword.Length - 1)
                {
                    keyword = keyword.Remove(keyword.LastIndexOf('|'));
                }
            }

            UpdateConversationKeyword(keyword);
        }
        Lb_showKeyword.Text      = "";
        HiddenFieldfortext.Value = "";
    }
コード例 #4
0
    private void Addnewtb_ServerClick(object sender, EventArgs e)
    {
        tbTypeNewKeyword.Text = "";
        clsKeywordsUtil KeywordsUtil = (clsKeywordsUtil)Session["KeywordsUtil"];
        string          keyword      = KeywordsUtil.GetKeywords();

        if (HiddenFieldfortext.Value != null)
        {
            Label NewKeyword = (Label)this.Page.FindControl("Lb_showKeyword");
            if ((keyword != "") && (keyword != "tmp"))
            {
                // 防止問答題中,新增一筆新的資料時會錯的BUG,即先給一個tmp,故在新增時要多一個判斷。  老詹 2015/06/19
                keyword        += "|" + HiddenFieldfortext.Value;
                NewKeyword.Text = HiddenFieldfortext.Value;
            }
            else
            {
                NewKeyword.Text = HiddenFieldfortext.Value;
                keyword         = HiddenFieldfortext.Value;
            }
            UpdateConversationKeyword(keyword);
        }
    }
コード例 #5
0
    public void SaveSynonyms(string strNewkeyword)
    {
        clsKeywordsUtil KeywordsUtil = (clsKeywordsUtil)Session["KeywordsUtil"];

        KeywordsUtil.SaveKeyword(strNewkeyword);
    }
コード例 #6
0
    private void btnKeyTable_ServerClick(object sender, EventArgs e)
    {
        string          strKeyword       = HiddenFieldfortext.Value.ToString();
        clsKeywordsUtil KeywordsUtil     = (clsKeywordsUtil)Session["KeywordsUtil"];
        string          strTmpAllKeyword = KeywordsUtil.GetKeywords();

        div_section4.Controls.Add(KeywordsUtil.ConstructKeywordTable(strTmpAllKeyword, true));
        if (strKeyword != "")
        {
            string       strSynonym = KeywordsUtil.SearchSynonym(strKeyword);
            HtmlTableRow trSynonyms = new HtmlTableRow();
            if (strSynonym == "")
            {
                trSynonyms.Style["width"] = "100%";
                trSynonyms.Attributes.Add("class", "header1_tr_odd_row");
                HtmlTableCell tdException = new HtmlTableCell();
                tdException.Style["width"] = "100%";
                tdException.Attributes.Add("Class", "header1_tr_even_row");
                tdException.InnerHtml = "<span style='color:red'>" + "此關鍵字沒有相關同義詞。</span>";
                trSynonyms.Cells.Add(tdException);
                Lb_synonyms.Rows.Add(trSynonyms);
            }
            else
            {
                trSynonyms.ID = "trSynonyms_" + strKeyword;
                string[] strAllSynonyms = strSynonym.Split(',');
                trSynonyms.Style["width"] = "100%";
                HtmlTableCell tdSynonyms = new HtmlTableCell();
                tdSynonyms.Style["width"] = "100%";
                for (int i = 0; i < strAllSynonyms.Length; i++)
                {
                    HtmlInputCheckBox cbSynonyms = new HtmlInputCheckBox();
                    cbSynonyms.ID = strKeyword + (i + 1).ToString() + "_" + strAllSynonyms[i];
                    cbSynonyms.Attributes.Add("onclick", "AddNewSynonyms('" + cbSynonyms.ID + "');");
                    Label lbSynonyms = new Label();
                    lbSynonyms.ForeColor = Color.Red;
                    lbSynonyms.Text      = strAllSynonyms[i] + "&nbsp;&nbsp;&nbsp;";
                    tdSynonyms.Controls.Add(cbSynonyms);
                    tdSynonyms.Controls.Add(lbSynonyms);
                }
                trSynonyms.Cells.Add(tdSynonyms);
                Lb_synonyms.Rows.Add(trSynonyms);
                string[] strAllKeyword = strTmpAllKeyword.Split('|');
                for (int i = 0; i < strAllKeyword.Length; i++)
                {
                    if (strAllKeyword[i].IndexOf(strKeyword) >= 0)
                    {
                        string[] strKeywordArr = strAllKeyword[i].Split(',');
                        for (int j = 1; j < strKeywordArr.Length; j++)
                        {
                            for (int k = 1; k <= strAllSynonyms.Length; k++)
                            {
                                HtmlInputCheckBox tmpCb = (HtmlInputCheckBox)this.FindControl(strKeywordArr[0] + k.ToString() + "_" + strKeywordArr[j]);
                                if (tmpCb != null)
                                {
                                    tmpCb.Checked = true;
                                }
                            }
                        }
                    }
                }
            }
        }
        //Session["KeywordsUtil"] = null;
    }
コード例 #7
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            this.Initiate();

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

            //從ORCS的課堂練習頁面接收參數
            if (hiddenPreOpener.Value == "SelectPaperMode")
            {
                //設定從課堂練習頁面進來時,此頁面的控制項
                SetPageStyle();
            }

            //加入btnSaveNextQuestion的事件
            btnSaveNextQuestion.ServerClick += new EventHandler(btnSaveNextQuestion_ServerClick);

            //加入btnSaveNext的事件
            btnSaveNext.ServerClick += new EventHandler(btnSaveNext_ServerClick);


            //初始化Layout
            InititateLayoutTableForFeature();
            //朱君 增加編輯特徵值屬性表格
            this.FindControl("PanelFeature").Controls.Add(LayoutTableForFeature);

            string strGetKeyword = Hints.Learning.Question.DataReceiver.getTextQuestionKeyword(strQID);

            if (strGetKeyword != "N/A")
            {
                clsKeywordsUtil keywordsUtil = new clsKeywordsUtil();
                divKeyWords.Controls.Add(keywordsUtil.ConstructKeywordTable(strGetKeyword, false));
                //btnEditKeyword.Text = "Edit the Keyword";
            }

            #region 設定問題Level與病徵的下拉選單項目
            DataTable dtQuestionLevel = new DataTable();
            dtQuestionLevel = AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevelName();
            foreach (DataRow drQuestionLevel in dtQuestionLevel.Rows)
            {
                ddlQuestionLevel.Items.Add(drQuestionLevel["cLevelName"].ToString());
            }

            //建立病徵的下拉選單項目
            DataTable dtDiseaseSymptomsTree = DiseaseSymptomsTree_SELECT();
            ddlSymptoms.Items.Add("All");
            foreach (DataRow drDiseaseSymptomsTree in dtDiseaseSymptomsTree.Rows)
            {
                ddlSymptoms.Items.Add(drDiseaseSymptomsTree["cNodeName"].ToString());
            }
            #endregion

            #region 設定問題Level與病徵的下拉選單選擇項目
            if (!IsPostBack)
            {
                int iQuestionLevel = AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevelValue(strQID);
                if (iQuestionLevel != -1)
                {
                    ddlQuestionLevel.SelectedValue = AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevelName_SELECT_LevelName(iQuestionLevel);
                }
                string strQuestionSymptoms = AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevel_SELECT_QuestionSymptoms(strQID);
                if (strQuestionSymptoms != "-1")
                {
                    ddlSymptoms.SelectedValue = strQuestionSymptoms;
                }
            }
            #endregion

            //設定答案選項的下拉選單項目  老詹 2013/8/28
            if (this.IsPostBack == false)
            {
                this.setupddlAnswerOptions(strQID);
            }

            //如果從課堂練習編輯考卷頁面新增題目功能來 直接關閉視窗
            if (Session["IsFromClassExercise"] != null && Session["IsFromClassExercise"].ToString() == "True")
            {
                btnNextQuestion.Attributes["style"] = "display:none;";
            }

            ddlAnswerOptions.SelectedIndexChanged += new EventHandler(ddlAnswerOptions_SelectedIndexChanged);

            hrQuestion.Style.Add("display", "none");
            hrAnswer.Style.Add("display", "none");
            BulidInterrogation("Question");
            BulidInterrogation("Answer");
        }