private void btnSaveNext_ServerClick(object sender, EventArgs e)
        {
            SaveQuestionText();

            //朱君 2012/11/25 將使用者所選擇的特徵值存入暫存陣列中,並儲存於資料庫中。
            clsFeaturevalue clsSaveFeature = new clsFeaturevalue();

            clsSaveFeature.update_FeatureItemIntoDataBase(clsSaveFeature.get_dtFeatureItem_Data(strGroupID, this));

            //Redirect至下一個網頁
            string strSystemFunction = "";

            if (Session["SystemFunction"] != null)
            {
                strSystemFunction = Session["SystemFunction"].ToString();
            }

            switch (strSystemFunction)
            {
            case "EditPaper":
                Response.Redirect("Paper_OtherQuestion.aspx?Opener=Paper_TextQuestionEditor");
                break;

            case "EditQuestion":
                if (Request.QueryString["QID"] != null)
                {
                    Response.Redirect("Paper_QuestionView.aspx?Opener=Paper_TextQuestionEditor");
                }
                else
                {
                    Response.Redirect("Paper_QuestionMain.aspx?Opener=Paper_TextQuestionEditor");
                }
                break;

            case "PreviewPaper":
                Response.Redirect("Paper_MainPage.aspx?Opener=Paper_TextQuestionEditor");
                break;

            default:
                Response.Redirect("Paper_QuestionMain.aspx?Opener=Paper_TextQuestionEditor");
                break;
            }

            //			if(hiddenQuestionMode.Value == "Specific")
            //			{
            //				//Paper_OtherQuestion.aspx
            //				Response.Redirect("Paper_OtherQuestion.aspx?Opener=Paper_TextQuestionEditor");
            //			}
            //			else
            //			{
            //				if(hiddenOpener.Value == "Paper_QuestionView")
            //				{
            //					Response.Redirect("Paper_QuestionMain.aspx?Opener=Paper_TextQuestionEditor");
            //				}
            //				else
            //				{
            //					Response.Redirect("./QuestionGroupTree/QuestionGroupTree.aspx?Opener=Paper_QuestionType");
            //				}
            //			}
        }
Example #2
0
    protected void btnFinish_Click(object sender, EventArgs e)
    {
        if (strSenceID == "")
        {
            strSenceID = Session["SceneID"].ToString();
        }

        //判斷是否有設定VRversion
        if (strSenceID != "")
        {
            //朱君 2012/11/25 將使用者所選擇的特徵值存入暫存陣列中,並儲存於資料庫中。
            clsFeaturevalue clsSaveFeature = new clsFeaturevalue();
            clsSaveFeature.update_FeatureItemIntoDataBase(clsSaveFeature.get_dtFeatureItem_Data(strGroupID, this));

            //將情境題題目存入資料表中
            UpdateQuestion();

            Session["QuestionAccessorParameter"] = null;
            Session["QuestionAccessor"]          = null;
            Session["QuestionSelectionAccessor"] = null;

            //若從編輯考卷來,直接將問題新增至考卷裡 蕭凱 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, strQID, "0", "5", "General", strSeq);
            }

            //完成儲存
            FinishSave();
        }
        else
        {
            Response.Write("<script>window.alert('未決定題目VR場景')</script>");
        }
    }
        private void finishBtn_Click(object sender, ImageClickEventArgs e)
        {
            //朱君 2012/11/25 將使用者所選擇的特徵值存入暫存陣列中,並儲存於資料庫中。
            clsFeaturevalue clsSaveFeature = new clsFeaturevalue();

            clsSaveFeature.update_FeatureItemIntoDataBase(clsSaveFeature.get_dtFeatureItem_Data(strGroupID, this));
            this.qAccessor.update_DataTableIntoDatabase();  //與問題有關的問題資料存入資料庫
            this.qsAccessor.update_DataTableIntoDatabase(); //與問題選項有關的問題選項資料存入資料庫
            if (this.Question_Edit_Type != "Choice_Question")
            {
                this.qAccessor.update_QuestionSource_In_Database();//將此問題有關的應用領域資料存入相關資料表
            }

            //檢查內容是否為空
            clsHintsDB hintsDB   = new clsHintsDB();
            string     strScript = "";
            string     strSQL    = "";

            strSQL = "SELECT [cQuestion] FROM [NewVersionHintsDB].[dbo].[QuestionIndex] where cQID = '" + strAddNewQID + "'";
            string strQuestionContent = hintsDB.getDataSet(strSQL).Tables[0].Rows[0]["cQuestion"].ToString();

            if (strQuestionContent.Equals(""))
            {
                strScript += "題目內容未填寫";
            }

            strSQL = "SELECT cSelection , bCaseSelect FROM [NewVersionHintsDB].[dbo].[QuestionSelectionIndex] where cQID='" + strAddNewQID + "'";
            DataTable dtQuestionSelection  = hintsDB.getDataSet(strSQL).Tables[0];
            bool      isSelectionNull      = false;
            bool      isSelectionCheckNull = true;

            foreach (DataRow drSelection in dtQuestionSelection.Rows)
            {
                if (drSelection["cSelection"].ToString().Trim().Equals(""))
                {
                    isSelectionNull = true;
                }
                string s = drSelection["bCaseSelect"].ToString();
                if (drSelection["bCaseSelect"].ToString().Equals("True"))
                {
                    isSelectionCheckNull = false;
                }
            }
            if (isSelectionNull)
            {
                if (!strScript.Equals(""))
                {
                    strScript += ",";
                }
                strScript += "選擇題選項內容未填寫";
            }
            if (isSelectionCheckNull)
            {
                if (!strScript.Equals(""))
                {
                    strScript += ",";
                }
                strScript += "選擇題選項答案未選";
            }
            if (!strScript.Equals(""))
            {
                strSQL = "DELETE FROM [NewVersionHintsDB].[dbo].[QuestionIndex] WHERE cQID = '" + strAddNewQID + "'";
                hintsDB.ExecuteNonQuery(strSQL);
                strSQL = "DELETE FROM [NewVersionHintsDB].[dbo].[QuestionSelectionIndex] WHERE cQID = '" + strAddNewQID + "'";
                hintsDB.ExecuteNonQuery(strSQL);
                ClientScript.RegisterClientScriptBlock(this.GetType(), "Refresh", "alert('" + strScript + ",請填寫完整再存檔')", true);
                return;
            }


            Session["QuestionAccessorParameter"] = null;
            Session["QuestionAccessor"]          = null;
            Session["QuestionSelectionAccessor"] = null;
            //若從編輯考卷來,直接將問題新增至考卷裡
            if (Session["IsFromClassExercise"] != null && Session["IsFromClassExercise"].ToString().Equals("True"))
            {
                DataReceiver myReceiver = new DataReceiver();
                SQLString    mySQL      = new SQLString();
                //取得考卷題數
                string strSeq = Convert.ToString(myReceiver.getPaperContentMaxSeq(strPaperID) + 1);
                mySQL.SaveToQuestionContent(strPaperID, strAddNewQID, "0", "6", "General", strSeq);
            }
            FinishSave();

            //移除Session
            Session.Remove("PreOpener");

            bool bIsZero = true;//用來判斷使用者是否有設定分數

            for (int i = 0; i < Request.Form.Count; i++)
            {
                if (Request.Form.Keys[i].ToString().IndexOf("editLevelDdl@") != -1)
                {
                    string   strQuestionLevel = Request.Form[i].ToString();
                    string[] strQuestionID    = Request.Form.Keys[i].ToString().Split('@');
                    int      iQuestionLevel   = AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevelName_SELECT_QuestionLevel(strQuestionLevel);
                    AuthoringTool.QuestionEditLevel.QuestionLevel.INSERT_QuestionLevel(strQuestionID[1], iQuestionLevel);
                }

                if (Request.Form.Keys[i].ToString().IndexOf("editGradeTensDdl@") != -1)
                {
                    string   strQuestionGradeTens  = Request.Form[i].ToString();
                    string   strQuestionGradeUnits = Request.Form[i + 1].ToString();
                    string[] strQuestionID         = Request.Form.Keys[i].ToString().Split('@');
                    AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionGrade_INSERT(strQuestionID[1], strQuestionGradeTens + strQuestionGradeUnits);

                    if (strQuestionGradeUnits != "0" || strQuestionGradeTens != "0")
                    {
                        bIsZero = false;
                    }
                }
            }

            //如果使用者都無設定分數 系統自己以題數去算每題平均
            if (bIsZero)
            {
                string strQuestionGradeTens  = "";
                string strQuestionGradeUnits = "";
                int    iQuestionCount        = 0;
                if (Session["GroupID"] != null)
                {
                    DataTable dtQuestionLevelNum = PaperSystem.DataReceiver.GetQuestionLevelNum(Session["GroupID"].ToString());
                    if (dtQuestionLevelNum.Rows.Count > 0)
                    {
                        iQuestionCount = Convert.ToInt32(dtQuestionLevelNum.Rows[0]["QuestionLevelNum"].ToString());
                    }
                }
                else
                {
                    iQuestionCount = qAccessor.QuestionIndex.Rows.Count;
                }


                for (int i = 0; i < Request.Form.Count; i++)
                {
                    if (Request.Form.Keys[i].ToString().IndexOf("editGradeTensDdl@") != -1)
                    {
                        string[] strQuestionID = Request.Form.Keys[i].ToString().Split('@');
                        AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionGrade_INSERT(strQuestionID[1], strQuestionGradeTens + strQuestionGradeUnits);
                    }
                }
            }
        }
        //Save Question , Answer Edit and selected Feature value to DB
        private void btnSaveNext_ServerClick(object sender, EventArgs e)
        {
            //Save Question , Answer Edit to DB
            SaveQuestionText();


            //Save selected Feature value to DB
            //朱君 2012/11/25 將使用者所選擇的特徵值存入暫存陣列中,並儲存於資料庫中。
            clsFeaturevalue clsSaveFeature = new clsFeaturevalue();

            clsSaveFeature.update_FeatureItemIntoDataBase(clsSaveFeature.get_dtFeatureItem_Data(strGroupID, this));

            //Redirect至下一個網頁
            string strSystemFunction = "";

            if (Session["SystemFunction"] != null)
            {
                strSystemFunction = Session["SystemFunction"].ToString();
            }

            //如果從課堂練習編輯考卷頁面新增題目功能來 直接關閉視窗
            if (Session["IsFromClassExercise"] != null && Session["IsFromClassExercise"].ToString() == "True" && Session["PreOpener"] != null && Session["PreOpener"] == "SelectPaperModeAddANewQuestion")
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "Refresh", "opener.document.getElementById('btnRefresh').click();window.close();", true);
                return;
            }

            switch (strSystemFunction)
            {
            case "EditPaper":
                Response.Redirect("Paper_OtherQuestion.aspx?Opener=Paper_TextQuestionEditor");
                break;

            case "EditQuestion":
                if (Request.QueryString["QID"] != null)
                {
                    Response.Redirect("Paper_QuestionViewNew.aspx?Opener=Paper_TextQuestionEditor");
                }
                else
                {
                    //Response.Redirect("Paper_QuestionMain.aspx?Opener=Paper_TextQuestionEditor");
                    strGroupID = Session["GroupID"].ToString();
                    Response.Redirect("Paper_QuestionViewNew.aspx?GroupID=" + strGroupID);
                }
                break;

            case "PreviewPaper":
                if (hiddenPreOpener.Value == "SelectPaperMode")
                {
                    Response.Redirect("Paper_MainPage.aspx?Opener=SelectPaperMode&cCaseID=" + strCaseID + "&cSectionName=" + strSectionName + "&cPaperID=" + strPaperID);
                }
                else
                {
                    Response.Redirect("Paper_MainPage.aspx?Opener=Paper_TextQuestionEditor");
                }
                break;

            default:
                Response.Redirect("Paper_QuestionMain.aspx?Opener=Paper_TextQuestionEditor");
                break;
            }
        }