//更改weight protected void ddlWeight_Change(object sender, EventArgs e) { DropDownList weight = (DropDownList)sender; string strSQL = "UPDATE ItemForVRAuthoringStepsList SET weight='" + weight.SelectedItem.ToString() + "' WHERE strStepID ='" + weight.ID.ToString().Replace("ddlWeight_", "") + "'"; sqldb.ExecuteNonQuery(strSQL); }
/// <summary> /// 儲存一筆資料至Conversation_Answer /// </summary> /// <param name="strQID"></param> /// <param name="strAID"></param> /// <param name="strAnswer"></param> /// <param name="strAnswerType"></param> /// <param name="AnswerContentType"></param> public static void Conversation_Answer_INSERT(int iSerialNum, string strQID, string strAID, string strAnswer, string strAnswerType, string AnswerContentType) { string strSQL = ""; strSQL = "SELECT * FROM Conversation_Answer WHERE cQID = '" + strQID + "' AND cAID = '" + strAID + "' "; clsHintsDB HintsDB = new clsHintsDB(); DataSet dsCheck = HintsDB.getDataSet(strSQL); if (dsCheck.Tables[0].Rows.Count > 0) { //Update strSQL = "UPDATE Conversation_Answer SET cAnswer = @cAnswer, cAnswerContentType = @cAnswerContentType " + "WHERE cQID = '" + strQID + "' AND cAID = '" + strAID + "' "; object[] pList = { strAnswer, AnswerContentType }; HintsDB.ExecuteNonQuery(strSQL, pList); } else { //Insert strSQL = "INSERT INTO Conversation_Answer (iSerialNum, cQID , cAID , cAnswer , cAnswerType , cAnswerContentType) " + "VALUES (@iSerialNum , @cQID , @cAID , @cAnswer , @cAnswerType , @cAnswerContentType ) "; object[] pList = { iSerialNum, strQID, strAID, strAnswer, strAnswerType, AnswerContentType }; HintsDB.ExecuteNonQuery(strSQL, pList); } dsCheck.Dispose(); }
public void ConfirmSave(string SelectedProType, string strQID, string loacalQuestopic, string localGroupID, string strCaseID, string strcbID) { string strNewSaveQID = strQID.TrimEnd(','); string[] strSelectedcb = strcbID.Split('-'); DataTable dtCheckPaper = new DataTable(); string strSQL = "SELECT B.cPaperID FROM BasicQuestionList AS B, QuestionGroupTree AS Q WHERE B.bIsOriginal='1' AND B.cCaseID = '" + strCaseID + "' AND Q.cNodeName='" + loacalQuestopic + "' AND B.cQuestionTopic='" + localGroupID + "' + '/' + Q.cNodeID"; dtCheckPaper = hintsDB.getDataSet(strSQL).Tables[0]; if (dtCheckPaper.Rows.Count > 0) { if (strNewSaveQID == "") // 防止編入QID為空時,ProblemType仍不空 { SelectedProType = ""; } else if (strNewSaveQID.IndexOf(strSelectedcb[1]) == -1) // 防止編入QID與ProblemType不符 老詹 2015/04/01 { string[] checkQIDRealPT = strNewSaveQID.Split(','); string strAllPT = ""; for (int i = 0; i < checkQIDRealPT.Length; i++) { string strGetRealPTSQL = "SELECT cQuestionSymptoms FROM QuestionLevel WHERE cQID = '" + checkQIDRealPT[i] + "'"; DataTable dtCheckRealPT = hintsDB.getDataSet(strGetRealPTSQL).Tables[0]; strAllPT += dtCheckRealPT.Rows[i]["cQuestionSymptoms"].ToString() + ","; if (strAllPT.IndexOf(SelectedProType) == -1) { SelectedProType = dtCheckRealPT.Rows[i]["cQuestionSymptoms"].ToString(); } } } string strUpdateSQL = "UPDATE BasicQuestionList SET cQID = '" + strNewSaveQID + "', cTestAnswerType='" + SelectedProType + "' WHERE cPaperID = '" + dtCheckPaper.Rows[0]["cPaperID"].ToString() + "'"; hintsDB.ExecuteNonQuery(strUpdateSQL); } else { string iQuestionSerialNum = "Paper"; //以當下日期時間作為流水號 DateTime now = DateTime.Now; string temp = now.ToString("yyyyMMddHHmmssFFFFF"); //建立QID strPaperID = iQuestionSerialNum + "_" + temp; DataTable dtGetNodeID = new DataTable(); string strGetIDSQL = "SELECT cNodeID FROM QuestionGroupTree WHERE cParentID LIKE '" + localGroupID + "' AND cNodeName = '" + loacalQuestopic + "'"; dtGetNodeID = hintsDB.getDataSet(strGetIDSQL).Tables[0]; string strInsertSQL = "INSERT INTO BasicQuestionList (cPaperID, cQuestionTopic, cQID, cVPAID, cTestAnswerType, cCaseID, bIsOriginal) " + "VALUES ('" + strPaperID + "' , '" + (localGroupID + "/" + dtGetNodeID.Rows[0]["cNodeID"].ToString()) + "' , '" + strNewSaveQID + "', '' , '" + SelectedProType + "', '" + strCaseID + "', '1') "; hintsDB.ExecuteNonQuery(strInsertSQL); } }
protected void btModifyGroupSubmit_Click(object sender, EventArgs e) { strSQL = "UPDATE QuestionGroupTree SET cNodeName='" + tNodeName.Value + "', cMode='" + ddlNodeMode.SelectedValue + "' WHERE cNodeID='" + strCurrentNodeID.Value + "'"; try { hintsDB.ExecuteNonQuery(strSQL); } catch { this.RegisterClientScriptBlock("", "<script> alert('error'); </script>"); } this.ConstructQuestionGroupTree(); }
protected void btn_delete_Click(object sender, EventArgs e) { try { strSQL = "DELETE FeaturevalueItem WHERE iFeatureNum = '" + lsb_FeatureItem.SelectedItem.Value + "'"; hintsDB.ExecuteNonQuery(strSQL); } catch { Response.Write("<script>window.alert('請選擇一個特徵值')</script>"); } //初始化set_lsb_FeatureItem set_lsb_FeatureItem(); }
private void SaveQuestionText() { string strQTextContent = txtQuestionEdit.Text; strQTextContent = strQTextContent.Replace("<", "<"); strQTextContent = strQTextContent.Replace(">", ">"); string strVPAnsTitle = txtVPAnsTitle.Text; strVPAnsTitle = strVPAnsTitle.Replace("<", "<"); strVPAnsTitle = strVPAnsTitle.Replace(">", ">"); clsConversation.saveVPAnswer_BasicQuestionList(hfVPAID.Value.ToString(), hfCurrentProType.Value.ToString(), ddl_VPResponseType.SelectedItem.Text.ToString(), strVPAnsTitle, strQTextContent, Request.QueryString["GroupID"].ToString()); clsHintsDB HintsDB = new clsHintsDB(); if (Rbl_AnswerType.SelectedIndex == 0) // 當學生回答模式為Textbox時,須採取的動作 老詹 2014/01/13 { string strSQL = "SELECT * FROM StudentAnsType WHERE cVPAID = '" + hfVPAID.Value.ToString() + "'"; DataTable dtTmp = HintsDB.getDataSet(strSQL).Tables[0]; if (dtTmp.Rows.Count <= 0) { string strInsertSQL = "INSERT INTO StudentAnsType (cVPAID , iAnswerType, cAnswerContent, bIsCorrect) " + "VALUES ('" + hfVPAID.Value.ToString() + "' , '" + (Rbl_AnswerType.SelectedIndex + 1) + "' , '', '0') "; HintsDB.ExecuteNonQuery(strInsertSQL); } else { if (dtTmp.Rows[0]["iAnswerType"].ToString() != "1") { string strDeleteSQL = "DELETE FROM StudentAnsType WHERE cVPAID = '" + hfVPAID.Value.ToString() + "' AND iAnswerType != '1'"; HintsDB.ExecuteNonQuery(strDeleteSQL); string strInsertSQL = "INSERT INTO StudentAnsType (cVPAID , iAnswerType, cAnswerContent, bIsCorrect) " + "VALUES ('" + hfVPAID.Value.ToString() + "' , '" + (Rbl_AnswerType.SelectedIndex + 1) + "' , '', '0') "; HintsDB.ExecuteNonQuery(strInsertSQL); } } } else { //刪除db.StudentAnsType中非教師設定的AnsType選項 string strSQL = "SELECT * FROM StudentAnsType WHERE cVPAID = '" + hfVPAID.Value.ToString() + "' AND iAnswerType != '" + (Rbl_AnswerType.SelectedIndex + 1) + "'"; DataTable dtTmp = HintsDB.getDataSet(strSQL).Tables[0]; if (dtTmp.Rows.Count > 0) { string strDeleteSQL = "DELETE FROM StudentAnsType WHERE cVPAID = '" + hfVPAID.Value.ToString() + "' AND iAnswerType != '" + (Rbl_AnswerType.SelectedIndex + 1) + "'"; HintsDB.ExecuteNonQuery(strDeleteSQL); } } }
/// <summary> /// 儲存一筆資料至QuestionIndex /// </summary> /// <param name="strQID"></param> /// <param name="strQuestion"></param> /// <param name="intLevel"></param> public static void saveIntoQuestionIndex(string strQID, string strQuestion, string strAnswer, int intLevel) { string strSQL = ""; strSQL = "SELECT * FROM QuestionIndex WHERE cQID = '" + strQID + "' "; clsHintsDB HintsDB = new clsHintsDB(); DataSet dsCheck = HintsDB.getDataSet(strSQL); if (dsCheck.Tables[0].Rows.Count > 0) { //Update strSQL = "UPDATE QuestionIndex SET cQuestion = @cQuestion , cAnswer = @cAnswer , sLevel = '" + intLevel.ToString() + "' " + "WHERE cQID = '" + strQID + "' "; } else { //Insert strSQL = "INSERT INTO QuestionIndex (cQID , cQuestion, cAnswer , sLevel) " + "VALUES ('" + strQID + "' , @cQuestion , @cANswer, '" + intLevel.ToString() + "') "; } dsCheck.Dispose(); object[] pList = { strQuestion, strAnswer }; HintsDB.ExecuteNonQuery(strSQL, pList); }
/// <summary> /// 儲存一筆資料至Conversation_Question /// </summary> /// <param name="strQID"></param> /// <param name="strQuestion"></param> public static void saveIntoConversation_Question(string strQID, string strQuestion) { string strSQL = ""; strSQL = "SELECT * FROM Conversation_Question WHERE cQID = '" + strQID + "' "; clsHintsDB HintsDB = new clsHintsDB(); DataSet dsCheck = HintsDB.getDataSet(strSQL); if (dsCheck.Tables[0].Rows.Count > 0) { //Update strSQL = "UPDATE Conversation_Question SET cQuestion = @cQuestion " + "WHERE cQID = '" + strQID + "' "; } else { //Insert strSQL = "INSERT INTO Conversation_Question (cQID , cQuestion) " + "VALUES ('" + strQID + "' , @cQuestion ) "; } dsCheck.Dispose(); object[] pList = { strQuestion }; HintsDB.ExecuteNonQuery(strSQL, pList); }
//返回後仍要判斷職業 老詹 2014/08/26 protected void GobackCareer(object sender, EventArgs e) { //When generating a new 對話題 (if the Opener is Paper_QuestionTypeNew), set Previous page as Paper_QuestionTypeNew,and return to it right away. if (Request.QueryString["Opener"].ToString() == "Paper_QuestionTypeNew") { Response.Redirect(Request.QueryString["Opener"].ToString() + ".aspx?Opener=./QuestionGroupTree/QGroupTreeNew&bModify=False&GroupID=" + strGroupID); } clsHintsDB sqldb = new clsHintsDB(); string strCheckNull = "SELECT * FROM Conversation_Question WHERE cQID='" + strQID + "'"; DataTable dtTemp = sqldb.getDataSet(strCheckNull).Tables[0]; if (dtTemp.Rows.Count > 0) { if (dtTemp.Rows[0]["cQuestion"].ToString() == "" && dtTemp.Rows[0]["cKeyword"].ToString() == "" && dtTemp.Rows[0]["cAudioID"].ToString() == "") { string strDeleteSQL = "DELETE FROM Conversation_Question WHERE cQID='" + strQID + "'"; sqldb.ExecuteNonQuery(strDeleteSQL); } } Session["SynonymsRow"] = null; string strCareer = Request.QueryString["Career"]; RegisterStartupScript("", "<script language='javascript'>goBack('" + strCareer + "', '" + Session["bDisplayQuestionList"].ToString() + "');</script>"); }
protected void btn_delete_Click(object sender, EventArgs e) { //裝資料的表 DataTable dtbackground = new DataTable(); dtbackground.Columns.Add("name", typeof(string)); dtbackground.Columns.Add("order", typeof(string)); SqlDB myDB = new SqlDB(System.Configuration.ConfigurationSettings.AppSettings["connstr"]); clsHintsDB sqlDB = new clsHintsDB(); string strSQL = ""; string DeleteNO = ((Button)sender).CommandArgument; //hfDELETE記錄哪個是被刪掉的 hf_Delte.Value += DeleteNO + "|"; //刪除記錄中的記錄 strSQL = "DELETE Question_Simulator_ans WHERE cQuestion_simulator_ID LIKE '" + hf_QID.Value + "' AND cName LIKE '" + DeleteNO + "'"; clsHintsDB MLASDB = new clsHintsDB(); MLASDB.ExecuteNonQuery(strSQL); ////讀出現在的資料表 //strSQL = "SELECT * FROM Question_Simulator_ans WHERE cQuestion_simulator_ID LIKE '" + hf_QID.Value + "'"; //DataTable dt_data_ans = sqlDB.getDataSet(strSQL).Tables[0]; //for (int i = 0; i < dt_data_ans.Rows.Count; i++) //{ // int strOrder = Convert.ToInt16( dt_data_ans.Rows[i]["cOrder"])-1; // //textbox // TextBox BoxBuffer = (TextBox)form1.FindControl("Order_" + i); // //Update 更新ORDER // strSQL = "UPDATE Question_Simulator_ans SET cOrder=@cOrder WHERE cQuestion_simulator_ID LIKE @cQuestion_simulator_ID AND cName LIKE '" + dt_data_ans.Rows[i]["cName"].ToString() + "'"; // object[] pList = { BoxBuffer.Text.ToString(), hf_QID.Value }; // myDB.ExecuteNonQuery(strSQL, pList); //} //reorder list_order(); //重新讀取資料 strSQL = "SELECT * FROM Question_Simulator_ans WHERE cQuestion_simulator_ID LIKE '" + hf_QID.Value + "' "; DataTable dt_data_temp = sqlDB.getDataSet(strSQL).Tables[0]; for (int n = 0; n < dt_data_temp.Rows.Count; n++) { DataRow dr_in = dtbackground.NewRow(); dr_in["name"] = dt_data_temp.Rows[n]["cName"].ToString(); dr_in["order"] = dt_data_temp.Rows[n]["cOrder"].ToString(); dtbackground.Rows.Add(dr_in); } //re draw PL_table.Controls.Clear(); if (RB1.Checked == true) { table_O_display(dtbackground); } else if (RB2.Checked == true) { noorderdisplay(dtbackground); } }
public string GetPaperAnsProcessID(string strPaperID, string strCaseID) { string strAnsProcessID = ""; string strSQL = ""; clsHintsDB HintsDB = new clsHintsDB(); DataTable dt = new DataTable(); strSQL = "SELECT * FROM AnsProcess_Paper WHERE cCaseID = '" + strCaseID + "' AND cPaperID = '" + strPaperID + "'"; dt = HintsDB.getDataSet(strSQL).Tables[0]; if (dt.Rows.Count > 0) { strAnsProcessID = dt.Rows[0]["cAnsProcessID"].ToString(); } else { strAnsProcessID = "AnsProcess" + DateTime.Now.ToString("yyyyMMddHHmmss"); strSQL = "INSERT INTO AnsProcess_Paper (cAnsProcessID, cCaseID, cPaperID) " + " VALUES ('" + strAnsProcessID + "', '" + strCaseID + "', '" + strPaperID + "')"; HintsDB.ExecuteNonQuery(strSQL); } return(strAnsProcessID); dt.Dispose(); }
private void ImgB_DeleteExCorrectsentence_Click(object sender, EventArgs e) { clsHintsDB hintsDB = new clsHintsDB(); string strDeleteAudioSQL = "UPDATE Conversation_Question SET cAudioID = '" + null + "' WHERE cQID='" + strQID + "'"; hintsDB.ExecuteNonQuery(strDeleteAudioSQL); CheckAudioID(); }
//增加屬性樹的節點 protected void btAddGroupSubmit_Click(object sender, EventArgs e) { //新增節點至資料表中 strSQL = "INSERT INTO FeaturevalueTree VALUES('" + this.getNewNodeID("") + "','" + strCurrentNodeID.Value + "','" + tNewNodeName.Text + "', '" + usi.UserID + "')"; try { hintsDB.ExecuteNonQuery(strSQL); } catch { this.RegisterClientScriptBlock("", "<script> alert('error'); </script>"); } //重新建造屬性樹 this.ConstructQuestionGroupTree(); }
/// <summary> /// 刪除特定的答案 /// </summary> /// <param name="strQID"></param> /// <param name="strAID"></param> public static void Conversation_Answer_DELETE_AssignedAnswer(string strQID, string strAID) { string strSQLDelete = ""; clsHintsDB HintsDB = new clsHintsDB(); strSQLDelete = "Delete From Conversation_Answer Where cQID = '" + strQID + "' AND cAID = '" + strAID + "'"; HintsDB.ExecuteNonQuery(strSQLDelete); }
public static void ItemForConversation_INSERT_CaseQuestion(string CaseID, int ClinicNumber, string SectionName, string cQID, string cAID, string strQuestionGroupID) { clsHintsDB database = new clsHintsDB(); string sql = "INSERT INTO ItemForConversation (cCaseID,sClinicNum,cSectionName,cQID,cAID,cQuestionGroupID) VALUES('" + CaseID + "'," + ClinicNumber + ",'" + SectionName + "','" + cQID + "','" + cAID + "', '" + strQuestionGroupID + "') "; database.ExecuteNonQuery(sql); }
//刪除 老詹 2014/11/02 protected void GV_AnswerContent_RowDeleting(object sender, GridViewDeleteEventArgs e) { string sAnswerContent = ((Label)this.GV_AnswerContent.Rows[e.RowIndex].FindControl("LbAns")).Text.Trim(); clsHintsDB myDB = new clsHintsDB(); string strSQL = "DELETE FROM StudentAnsType WHERE cAnswerContent = '" + sAnswerContent + "'"; myDB.ExecuteNonQuery(strSQL); BindData(); }
protected void Btn_back_Click(object sender, EventArgs e) { //刪除q_s_a中的記錄 string strSQL = "DELETE Question_Simulator_ans WHERE cQuestion_simulator_ID LIKE '" + hf_QID.Value + "'"; clsHintsDB MLASDB = new clsHintsDB(); MLASDB.ExecuteNonQuery(strSQL); //go back last step Response.Redirect("Paper_SimulatorQuestionEditor2.aspx?cImg=" + hf_img.Value + "&Title=" + hf_Title.Value + "&QID=" + hf_QID.Value + ""); }
void btDelete_Click(object sender, EventArgs e) { string strTempAnswerTypeNum = ""; Button btnDelete = new Button(); btnDelete = (Button)(sender); strTempAnswerTypeNum = btnDelete.ID.Split('_')[1]; ArrayList alAnswerTypeName = new ArrayList(); for (int i = 0; i < Request.Form.Count; i++) { if (Request.Form.Keys[i].ToString().IndexOf("tbEditAnswerTypeName_") != -1) { alAnswerTypeName.Add(Request.Form[i].ToString()); } } alAnswerTypeName.RemoveAt(Convert.ToInt32(strTempAnswerTypeNum) - 1); clsHintsDB HintsDB = new clsHintsDB(); string strSQL_Conversation_AnswerType = ""; //先刪除存在的資料 strSQL_Conversation_AnswerType = "DELETE Conversation_AnswerType WHERE cQuestionClassifyID = '" + hfGroupSerialNum.Value + "'"; HintsDB.ExecuteNonQuery(strSQL_Conversation_AnswerType); for (int i = 0; i < alAnswerTypeName.Count; i++) { if (alAnswerTypeName[i] != "") { //新增 strSQL_Conversation_AnswerType = "INSERT INTO Conversation_AnswerType" + "(cQuestionClassifyID, cAnswerTypeName, cAnswerTypeNum)" + " VALUES ('" + Convert.ToInt32(hfGroupSerialNum.Value) + "','" + alAnswerTypeName[i] + "','" + (i + 1) + "')"; HintsDB.ExecuteNonQuery(strSQL_Conversation_AnswerType); } } hfAnswerTypeNum.Value = (Convert.ToInt32(hfAnswerTypeNum.Value) - 1).ToString(); SetAnswerTypeName(Convert.ToInt32(hfAnswerTypeNum.Value)); }
protected void lkSaveF_Click(object sender, EventArgs e) { string sAnswerContent = ((TextBox)this.GV_AnswerContent.FooterRow.FindControl("txAnsF")).Text.Trim(); if (sAnswerContent != "") { clsHintsDB HintsDB = new clsHintsDB(); string strSQL = "SELECT * FROM StudentAnsType WHERE cVPAID = '" + hfVPAID.Value.ToString() + "' AND iAnswerType = '1'"; DataTable dtTmp = HintsDB.getDataSet(strSQL).Tables[0]; if (dtTmp.Rows.Count > 0) //當新增非Textbox的答題模式時,需先刪除原本Textbox答題模式的那一列資料 老詹 2014/01/13 { string strDeleteSQL = "DELETE FROM StudentAnsType WHERE cVPAID = '" + hfVPAID.Value.ToString() + "'"; HintsDB.ExecuteNonQuery(strDeleteSQL); } iAnswerType = Rbl_AnswerType.SelectedIndex + 1; if (((HtmlInputCheckBox)this.GV_AnswerContent.FooterRow.FindControl("CxCorrectF")).Checked) { if (iAnswerType == 2 || iAnswerType == 3) //如果是ddl或rb時,判斷單選 { string strPreUpdateSQL = "UPDATE StudentAnsType SET bIsCorrect='0'" + "WHERE cVPAID='" + hfVPAID.Value.ToString() + "' AND iAnswerType='" + iAnswerType + "'"; HintsDB.ExecuteNonQuery(strPreUpdateSQL); } string strInsertSQL = "INSERT INTO StudentAnsType (cVPAID , iAnswerType, cAnswerContent, bIsCorrect) " + "VALUES ('" + hfVPAID.Value.ToString() + "' , '" + iAnswerType + "' , '" + sAnswerContent + "', '1') "; HintsDB.ExecuteNonQuery(strInsertSQL); } else { string strInsertSQL = "INSERT INTO StudentAnsType (cVPAID , iAnswerType, cAnswerContent, bIsCorrect) " + "VALUES ('" + hfVPAID.Value.ToString() + "' , '" + iAnswerType + "' , '" + sAnswerContent + "', '0') "; HintsDB.ExecuteNonQuery(strInsertSQL); } this.DoCancelAdd(); } else { string script = "alert('選項內容不可為空!!!');"; ClientScript.RegisterStartupScript(this.GetType(), "alert_window", "<script>" + script + "</script>", false); } }
protected void btnDeleteQuestion_Click(object sender, EventArgs e) { try { strSQL = "DELETE QuestionList WHERE qId = '" + ddlQusetionList.SelectedItem.Value + "'"; hintsDB.ExecuteNonQuery(strSQL); } catch { Response.Write("<script>window.alert('請選擇一個題庫')</script>"); } //初始化ddlSelectQuestion下拉式選單 setddlQusetionList(); //刪除後關閉下列所有表格 Panel_out.Visible = false; Panel_inner.Visible = false; }
public void SaveAnswerType(string strGroupSerialID, string strArrayAnswerTypeList) { clsHintsDB HintsDB = new clsHintsDB(); string strSQL_Conversation_AnswerType = ""; //先刪除存在的資料 strSQL_Conversation_AnswerType = "DELETE Conversation_AnswerType WHERE cQuestionClassifyID = '" + strGroupSerialID + "'"; HintsDB.ExecuteNonQuery(strSQL_Conversation_AnswerType); string[] strArrayAnswerTypeName = strArrayAnswerTypeList.Split('|'); for (int i = 0; i < strArrayAnswerTypeName.Length; i++) { if (strArrayAnswerTypeName[i] != "") { //新增 strSQL_Conversation_AnswerType = "INSERT INTO Conversation_AnswerType" + "(cQuestionClassifyID, cAnswerTypeName, cAnswerTypeNum)" + " VALUES ('" + Convert.ToInt32(strGroupSerialID) + "','" + strArrayAnswerTypeName[i] + "','" + (i + 1) + "')"; HintsDB.ExecuteNonQuery(strSQL_Conversation_AnswerType); } } }
//更新 老詹 2014/10/31 protected void GV_AnswerContent_RowUpdating(object sender, GridViewUpdateEventArgs e) { clsHintsDB myDB = new clsHintsDB(); //取得欲更新的欄位資料 string sNewAnswerContent = ((TextBox)this.GV_AnswerContent.Rows[e.RowIndex].FindControl("txAnsE")).Text.Trim(); bool bIsCorrectAnswer = ((HtmlInputCheckBox)this.GV_AnswerContent.Rows[e.RowIndex].FindControl("CxCorrectE")).Checked; if ((bIsCorrectAnswer) && (Rbl_AnswerType.SelectedIndex == 1 || Rbl_AnswerType.SelectedIndex == 2)) //判斷ddl&Radio時正解唯一機制 老詹 2015/07/02 { string strPreUpdateSQL = "UPDATE StudentAnsType SET bIsCorrect='0'" + "WHERE cVPAID='" + hfVPAID.Value.ToString() + "' AND iAnswerType='" + (Rbl_AnswerType.SelectedIndex + 1) + "'"; myDB.ExecuteNonQuery(strPreUpdateSQL); } string strUpdateSQL = "UPDATE StudentAnsType SET cAnswerContent='" + sNewAnswerContent + "', bIsCorrect='" + bIsCorrectAnswer + "'" + "WHERE cAnswerContent = '" + Session["currentAnswerContent"].ToString() + "' AND cVPAID='" + hfVPAID.Value.ToString() + "'"; myDB.ExecuteNonQuery(strUpdateSQL); DoCancelEidt(); }
public static void saveVPAnswer_BasicQuestionList(string strVPAID, string strCurrentProType, string strVPResponseType, string strVPAnsTitle, string strResponseContent, string strGroupID) { string strSQL = ""; strSQL = "SELECT * FROM VP_AnswerSet WHERE cVPAID = '" + strVPAID + "' AND cVPResponseType='" + strVPResponseType + "' "; clsHintsDB HintsDB = new clsHintsDB(); DataSet dsCheck = HintsDB.getDataSet(strSQL); if (dsCheck.Tables[0].Rows.Count > 0) { strSQL = "UPDATE VP_AnswerSet SET cVPResponseContent='" + strResponseContent + "' WHERE cVPAID = '" + strVPAID + "' AND cVPResponseType='" + strVPResponseType + "'"; } else { strSQL = "INSERT INTO VP_AnswerSet (cVPAID , cProblemType, cVPResponseType , cVPResponseContent, cGroupID) " + "VALUES ('" + strVPAID + "' , '" + strCurrentProType + "' , '" + strVPResponseType + "', '" + strResponseContent + "', '" + strGroupID + "') "; } HintsDB.ExecuteNonQuery(strSQL); string strUpdateSQL = "UPDATE VP_AnswerSet SET cVPAnsTitle='" + strVPAnsTitle + "' WHERE cVPAID = '" + strVPAID + "'"; HintsDB.ExecuteNonQuery(strUpdateSQL); }
public static void ItemForConversation_DeleteAllCaseItem(string CaseID, int ClinicNumber, string SectionName) { try { clsHintsDB database = new clsHintsDB(); string sql = "DELETE FROM ItemForConversation " + " WHERE cCaseID='" + CaseID + "' AND sClinicNum=" + ClinicNumber + " AND cSectionName='" + SectionName + "' "; database.ExecuteNonQuery(sql); } catch { } }
/// <summary> /// 更新答案項目 /// </summary> /// <param name="CaseID"></param> /// <param name="ClinicNumber"></param> /// <param name="SectionName"></param> /// <param name="cQID"></param> /// <param name="cAID"></param> public static void ItemForConversation_UPDATE_Answer(string CaseID, int ClinicNumber, string SectionName, string cQID, string cAID) { try { clsHintsDB database = new clsHintsDB(); string strSetSQLAnswer = ""; strSetSQLAnswer = "UPDATE ItemForConversation SET cAID= '" + cAID + "' " + " WHERE cCaseID='" + CaseID + "' AND sClinicNum=" + Convert.ToInt16(ClinicNumber) + " AND cSectionName='" + SectionName + "' AND cQID='" + cQID + "' "; database.ExecuteNonQuery(strSetSQLAnswer); } catch { } }
/// <summary> /// 更新答案資料 /// </summary> /// <param name="strQID"></param> /// <param name="strAID"></param> /// <param name="strAnswer"></param> /// <param name="strAnswerContentType"></param> public static void Conversation_Answer_UPDATE_Answer(string strQID, string strAID, string strAnswer, string strAnswerContentType) { string strSQLUpdateAnswer = ""; clsHintsDB HintsDB = new clsHintsDB(); strSQLUpdateAnswer = "Update Conversation_Answer SET cAnswer = '" + strAnswer + "' , cAnswerContentType = '" + strAnswerContentType + "' " + "WHERE cQID = '" + strQID + "' AND cAID = '" + strAID + "' "; try { HintsDB.ExecuteNonQuery(strSQLUpdateAnswer); } catch { } }
protected void btn_del_Ans_Click(object sender, EventArgs e) { string DeleteAns = ((Button)sender).CommandArgument; //DELETE ANS和OID相同的 string strSQL = "DELETE Question_Simulator WHERE cQID LIKE '" + hf_QID.Value + "' AND cAnswer LIKE '" + DeleteAns + "'"; clsHintsDB MLASDB = new clsHintsDB(); MLASDB.ExecuteNonQuery(strSQL); clsHintsDB sqlDB = new clsHintsDB(); //draw the answer table pl_ans.Controls.Clear(); Ansdisplay(); //init hf_Delte.Value = ""; //draw the edit table DataTable dtredraw = new DataTable(); dtredraw.Columns.Add("name", typeof(string)); dtredraw.Columns.Add("order", typeof(string)); //重新讀取資料 strSQL = "SELECT * FROM Question_Simulator_ans WHERE cQuestion_simulator_ID LIKE '" + hf_QID.Value + "' "; DataTable dt_data_temp = sqlDB.getDataSet(strSQL).Tables[0]; for (int n = 0; n < dt_data_temp.Rows.Count; n++) { DataRow dr_in = dtredraw.NewRow(); dr_in["name"] = dt_data_temp.Rows[n]["cName"].ToString(); dr_in["order"] = dt_data_temp.Rows[n]["cOrder"].ToString(); dtredraw.Rows.Add(dr_in); } //draw the edit table PL_table.Controls.Clear(); if (RB1.Checked == true) { table_O_display(dtredraw); //editdisplay(); } else if (RB2.Checked == true) { noorderdisplay(dtredraw); } }
//先寫一筆預設的資料到VRTeachingAssistant protected void insertToVRTeachingAssistant() { DateTime myDate = DateTime.Now; string date = myDate.ToString("yyyyMMddhhmmffff"); string strSQL = "INSERT INTO VRTeachingAssistant VALUES('" + "VRTAid" + date + "','" + strQID + "','false','1','true','Text@Suggest@','true')"; try { hintsDB.ExecuteNonQuery(strSQL); } catch { //this.RegisterClientScriptBlock("", "<script> alert('error'); </script>"); } }
/// <summary> /// Save text question /// </summary> private void SaveQuestionText() { //儲存題目 clsTextQuestion myText = new clsTextQuestion(); string strQTextContent = txtQuestionEdit.Text; strQTextContent = strQTextContent.Replace("<", "<"); strQTextContent = strQTextContent.Replace(">", ">"); clsConversation.saveConversation_Question(strQID, strQTextContent, strPaperID, strGroupDivisionID, strGroupID, hiddenQuestionMode.Value); if (Request.QueryString["OpenGroupID"] != null) // 若從Search頁面開啟,儲存時要額外Insert一筆資料到QuestionMode,表示在OpenGroupID中也要有這類題目 老詹 2015/09/06 { clsHintsDB sqldb = new clsHintsDB(); string strGetOpenGroupName = "SELECT cNodeName FROM QuestionGroupTree WHERE cNodeID='" + Request.QueryString["OpenGroupID"].ToString() + "'"; DataTable dtGetOpenGroupName = sqldb.getDataSet(strGetOpenGroupName).Tables[0]; if (dtGetOpenGroupName.Rows.Count > 0) { string strCheckRepeat = "SELECT * FROM QuestionMode WHERE cQID='" + strQID + "' AND cQuestionGroupID = '" + Request.QueryString["OpenGroupID"].ToString() + "'"; DataTable dtCheckRepeat = sqldb.getDataSet(strCheckRepeat).Tables[0]; if (dtCheckRepeat.Rows.Count <= 0) { string strInsertOtherGroupSQL = "INSERT INTO QuestionMode(cQID,cQuestionGroupID,cQuestionGroupName,cQuestionMode,cQuestionType) VALUES ('" + strQID + "','" + Request.QueryString["OpenGroupID"].ToString() + "','" + dtGetOpenGroupName.Rows[0]["cNodeName"].ToString() + "','General','4')"; sqldb.ExecuteNonQuery(strInsertOtherGroupSQL); } } } //儲存Problem Type AuthoringTool.QuestionEditLevel.QuestionLevel.QuestionLevel_INSERT_QuestionSymptoms(strQID, "All"); //如果是Specific題目則需儲存一筆資料至Paper_Content if (hiddenQuestionMode.Value == "Specific") { DataReceiver myReceiver = new DataReceiver(); int intContentSeq = myReceiver.getPaperContentMaxSeq(strPaperID) + 1; SQLString mySQL = new SQLString(); mySQL.SaveToQuestionContent(strPaperID, strQID, "0", "2", hiddenQuestionMode.Value, intContentSeq.ToString()); } }
protected void Btn_finish_Click(object sender, EventArgs e) { SqlDB myDB = new SqlDB(System.Configuration.ConfigurationSettings.AppSettings["connstr"]); //刪除q_s_a中的記錄 string strSQL = "DELETE Question_Simulator_ans WHERE cQuestion_simulator_ID LIKE '" + hf_QID.Value + "'"; clsHintsDB MLASDB = new clsHintsDB(); MLASDB.ExecuteNonQuery(strSQL); //UPDATE response //strSQL = "SELECT * FROM Question_Simulator WHERE cQID LIKE '" + hf_QID.Value + "'"; //DataTable dt_firstTime = MLASDB.getDataSet(strSQL).Tables[0]; //for (int i = 0; i > dt_firstTime.Rows.Count; i++) //{ // Label LB_temp = (Label)this.FindControl("form1").FindControl("Res_" + dt_firstTime.Rows[i]["cAnsID"].ToString()); // strSQL = "UPDATE Question_Simulator SET cAnsID=@cAnsID WHERE cResponse LIKE @cResponse "; // object[] pList = { dt_firstTime.Rows[i]["cAnsID"].ToString(), LB_temp.Text }; // myDB.ExecuteNonQuery(strSQL, pList); //} //go to next step Response.Redirect("Paper_QuestionViewNew.aspx?GroupID=" + Session["GroupID"].ToString()); }