protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["pj_id"] != null) { string strPJ_ID = Request.QueryString["pj_id"]; ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); answer ans = new answer(); mgCookie.UpdateCookies("pj_id", strPJ_ID); mgCookie.UpdateCookies("qset_id", ans.getLatestAnswerQSetID(strPJ_ID)); mgCookie.UpdateCookies("q2_id", ans.getLatestAnswerQ2(ck.pj_id, ck.qset_id)); if (Request.QueryString["fm"] == "submitted") { Response.Redirect("project_summary_submitted.aspx"); } else if (Request.QueryString["fm"] == "simnotsubmitted" || Request.QueryString["fm"] == "realnotsubmitted") { Response.Redirect("project_summary.aspx"); } else if (Request.QueryString["fm"] == "simnotcomplete" || Request.QueryString["fm"] == "realnotcomplete") { projects pj = new projects(); if (pj.redirectToPendingProjectDetails(ck.pj_id).Contains(".aspx")) { Response.Redirect(pj.redirectToPendingProjectDetails(ck.pj_id)); } } else if (Request.QueryString["fm"] == "notReqApproval") { Response.Redirect("project_summary.aspx?fm=notReqApproval"); } else { switch (ck.q2_id) { default: Response.Redirect("project_pickquestion.aspx"); break; } } } }
protected void Page_Load(object sender, EventArgs e) { ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); string max = ""; if (ck != null) { string strSQL1 = "select * from question1 q1, question2 q2, question3 q3 where q1.qset_id = 1 and q1.q1_id = q2.q1_id and q2.q2_id = q3.q2_id and q1.q1_id = 1"; SqlDataSource1.SelectCommand = strSQL1; SqlDataSource1.DataBind(); DataView dv1 = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); //ประเด็นที่หนึ่ง lblQuestion1.Text = "ประเด็นที่ " + dv1.Table.Rows[0]["q1_order"].ToString() + " " + dv1.Table.Rows[0]["q1_text"].ToString(); lblAssumption.Text = "สมมุติฐาน " + dv1.Table.Rows[0]["q1_order"].ToString() + " " + dv1.Table.Rows[0]["q1_assumption"].ToString(); lblQuestion2_1.Text = "คำถามที่ " + dv1.Table.Rows[0]["q2_order"].ToString() + " " + dv1.Table.Rows[0]["q2_text"].ToString(); lblQuestion3_1.Text = dv1.Table.Rows[0]["q3_order"].ToString() + " " + dv1.Table.Rows[0]["q3_text"].ToString(); lblQuestion3_2.Text = dv1.Table.Rows[1]["q3_order"].ToString() + " " + dv1.Table.Rows[1]["q3_text"].ToString(); lblQuestion3_3.Text = dv1.Table.Rows[2]["q3_order"].ToString() + " " + dv1.Table.Rows[2]["q3_text"].ToString(); lblQuestion3_4.Text = dv1.Table.Rows[3]["q3_order"].ToString() + " " + dv1.Table.Rows[3]["q3_text"].ToString(); lblQuestion3_5.Text = dv1.Table.Rows[4]["q3_order"].ToString() + " " + dv1.Table.Rows[4]["q3_text"].ToString(); //ประเด็นที่สอง string strSQL2 = "select * from question1 q1, question2 q2, question3 q3 where q1.qset_id = 1 and q1.q1_id = q2.q1_id and q2.q2_id = q3.q2_id and q1.q1_id = 2"; SqlDataSource2.SelectCommand = strSQL2; SqlDataSource2.DataBind(); DataView dv2 = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); lblQuestion2.Text = "ประเด็นที่ " + dv2.Table.Rows[0]["q1_order"].ToString() + " " + dv2.Table.Rows[0]["q1_text"].ToString(); lblAssumption2.Text = "สมมุติฐาน " + dv2.Table.Rows[0]["q1_order"].ToString() + " " + dv2.Table.Rows[0]["q1_assumption"].ToString(); lblQuestion2_2.Text = "คำถามที่ " + dv2.Table.Rows[0]["q2_order"].ToString() + " " + dv2.Table.Rows[0]["q2_text"].ToString(); lblQuestion3_6.Text = dv2.Table.Rows[0]["q3_order"].ToString() + " " + dv2.Table.Rows[0]["q3_text"].ToString(); lblQuestion3_7.Text = dv2.Table.Rows[1]["q3_order"].ToString() + " " + dv2.Table.Rows[1]["q3_text"].ToString(); lblQuestion3_8.Text = dv2.Table.Rows[2]["q3_order"].ToString() + " " + dv2.Table.Rows[2]["q3_text"].ToString(); mgCookie.UpdateCookies("qset_id", "1"); //คำถามชุด ก. if (!Page.IsPostBack) { // ต้น comment //string strQ2ID = ck.q2_id; #region ต้น answer ans = new answer(); max = ans.getLatestAnswerQ2(ck.pj_id, ans.getLatestAnswerQSetID(ck.pj_id)); string strQ2ID = string.IsNullOrEmpty(max) ? "0" : max; #endregion if (strQ2ID != null) { // ค่า max ที่ได้คือข้อล่าสุดที่ได้ทำไป ดังนั้นข้อต่อไปคือ max + 1 if (strQ2ID == "0") { panel1.Visible = true; panel2.Visible = false; } else if (strQ2ID == "1") { panel1.Visible = false; panel2.Visible = true; } else if (strQ2ID == "2") { litfinish.Text = "เสร็จสิ้นการประเมินชุด ก: ขั้นตอนการริเริ่มแผนงาน/โครงการและวิเคราะห์เบื้องต้น โปรดดำเนินการต่อ"; litfinish.Visible = true; btnToQB.Visible = true; panel1.Visible = false; panel2.Visible = false; } else { litfinish.Visible = false; btnToQB.Visible = false; panel1.Visible = false; panel2.Visible = false; } } } if (panel1.Visible == true) { mgCookie.UpdateCookies("q1_id", "1"); //ประเด็นที่หนึ่ง //mgCookie.UpdateCookies("q2_id", dv1.Table.Rows[0]["q2_id"].ToString()); mgCookie.UpdateCookies("q2_id", "1"); } else if (panel2.Visible == true) { mgCookie.UpdateCookies("q1_id", "2"); //ประเด็นที่สอง //mgCookie.UpdateCookies("q2_id", dv2.Table.Rows[0]["q2_id"].ToString()); mgCookie.UpdateCookies("q2_id", "2"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); string max = ""; if (ck != null) { answer ans = new answer(); max = ans.getLatestAnswerQ2(ck.pj_id, ans.getLatestAnswerQSetID(ck.pj_id)); string strSQL1 = string.Format(@"select * from question1 q1, question2 q2, question3 q3 where q1.qset_id = 3 and q1.q1_id = q2.q1_id and q2.q2_id = q3.q2_id;"); SqlDataSource1.SelectCommand = strSQL1; SqlDataSource1.DataBind(); DataView dv1 = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); //ประเด็นที่หนึ่ง lblQuestion1.Text = "ประเด็นที่ " + dv1.Table.Rows[0]["q1_order"].ToString() + " " + dv1.Table.Rows[0]["q1_text"].ToString(); lblAssumption.Text = "สมมุติฐาน " + dv1.Table.Rows[0]["q1_order"].ToString() + " " + dv1.Table.Rows[0]["q1_assumption"].ToString(); lblQuestion2_1.Text = "คำถามที่ " + dv1.Table.Rows[0]["q2_order"].ToString() + " " + dv1.Table.Rows[0]["q2_text"].ToString(); lblQuestion3_1.Text = dv1.Table.Rows[0]["q3_order"].ToString() + " " + dv1.Table.Rows[0]["q3_text"].ToString(); lblQuestion3_2.Text = dv1.Table.Rows[1]["q3_order"].ToString() + " " + dv1.Table.Rows[1]["q3_text"].ToString(); //lblQuestion3_3.Text = dv1.Table.Rows[2]["q3_order"].ToString() + " " + dv1.Table.Rows[2]["q3_text"].ToString(); mgCookie.UpdateCookies("qset_id", "3"); //คำถามชุด ค. #region ต้น string strQ2ID = max; //ton.JavaScript.MessageBox(strQ2ID); if (strQ2ID != null) { if (strQ2ID == "8") { panel1.Visible = true; litfinish.Visible = false; btnToQB.Visible = false; } else if (strQ2ID == "9") { panel1.Visible = false; litfinish.Text = "เสร็จสิ้นการประเมินชุด ค: ขั้นตอนการริเริ่มแผนงาน/โครงการและวิเคราะห์เบื้องต้น โปรดดำเนินการต่อ"; litfinish.Visible = true; btnToQB.Visible = true; } else { panel1.Visible = false; litfinish.Visible = false; btnToQB.Visible = false; } } #endregion if (panel1.Visible == true) { mgCookie.UpdateCookies("q1_id", "3"); //ประเด็นที่หนึ่ง mgCookie.UpdateCookies("q2_id", dv1.Table.Rows[0]["q2_id"].ToString()); } } else { Response.Redirect(ton.config.Global_config.RootURL); } } }
protected void Page_Load(object sender, EventArgs e) { #region loadData qset.qset_id = "2"; qset.loadQuestionSet(); qset.loadQuestionL1(); lbl_qset_text.Text = qset.qset_text; for (int q1_i = 0; q1_i < qset.qL1_list.Count; q1_i++) { question q1 = qset.qL1_list[q1_i]; q1.loadQuestionL2(); for (int q2_i = 0; q2_i < q1.qL2_list.Count; q2_i++) { questionL2 q2 = q1.qL2_list[q2_i]; q2.loadQuestionL3(); } } #endregion #region MapQuestion to Interface //--------------ประเด็น3--------------------------- lblQuestion_1.Text = qset.qL1_list[0].q1_text; lblAssumption_1.Text = qset.qL1_list[0].q1_assumption; lblQuestion_id_1.Text = qset.qL1_list[0].q1_id; lblQuestion_id_praden_1.Text = lblQuestion_id_1.Text; //---------------คำถาม---------------------------- lblQuestion2_1.Text = Q2Seq + qset.qL1_list[0].qL2_list[0].q2_order + " " + qset.qL1_list[0].qL2_list[0].q2_text; //--------------คำถามย่อย-------------------------------- lblQuestion3_1_1.Text = qset.qL1_list[0].qL2_list[0].qL3_list[0].q3_order + " " + qset.qL1_list[0].qL2_list[0].qL3_list[0].q3_text; lblQuestion3_1_2.Text = qset.qL1_list[0].qL2_list[0].qL3_list[1].q3_order + " " + qset.qL1_list[0].qL2_list[0].qL3_list[1].q3_text; lblQuestion3_1_3.Text = qset.qL1_list[0].qL2_list[0].qL3_list[2].q3_order + " " + qset.qL1_list[0].qL2_list[0].qL3_list[2].q3_text; //---------------คำถาม---------------------------- lblQuestion2_2.Text = Q2Seq + qset.qL1_list[0].qL2_list[1].q2_order + " " + qset.qL1_list[0].qL2_list[1].q2_text; //--------------คำถามย่อย-------------------------------- lblQuestion3_2_1.Text = qset.qL1_list[0].qL2_list[1].qL3_list[0].q3_order + " " + qset.qL1_list[0].qL2_list[1].qL3_list[0].q3_text; //---------------คำถาม---------------------------- lblQuestion2_3.Text = Q2Seq + qset.qL1_list[0].qL2_list[2].q2_order + " " + qset.qL1_list[0].qL2_list[2].q2_text; //--------------คำถามย่อย-------------------------------- lblQuestion3_3_1.Text = qset.qL1_list[0].qL2_list[2].qL3_list[0].q3_order + " " + qset.qL1_list[0].qL2_list[2].qL3_list[0].q3_text; //---------------คำถาม---------------------------- lblQuestion2_4.Text = Q2Seq + qset.qL1_list[0].qL2_list[3].q2_order + " " + qset.qL1_list[0].qL2_list[3].q2_text; //--------------คำถามย่อย-------------------------------- lblQuestion3_4_1.Text = qset.qL1_list[0].qL2_list[3].qL3_list[0].q3_order + " " + qset.qL1_list[0].qL2_list[3].qL3_list[0].q3_text; lblQuestion3_4_2.Text = qset.qL1_list[0].qL2_list[3].qL3_list[1].q3_order + " " + qset.qL1_list[0].qL2_list[3].qL3_list[1].q3_text; lblQuestion3_4_3.Text = qset.qL1_list[0].qL2_list[3].qL3_list[2].q3_order + " " + qset.qL1_list[0].qL2_list[3].qL3_list[2].q3_text; lblQuestion3_4_4.Text = qset.qL1_list[0].qL2_list[3].qL3_list[3].q3_order + " " + qset.qL1_list[0].qL2_list[3].qL3_list[3].q3_text; //-----------จบ ประเด็น3-------------------------------- //--------------ประเด็น4--------------------------- lblQuestion_2.Text = qset.qL1_list[1].q1_text; lblAssumption_2.Text = qset.qL1_list[1].q1_assumption; lblQuestion_id_2.Text = qset.qL1_list[1].q1_id; lblQuestion_id_praden_2.Text = lblQuestion_id_2.Text; lblQuestion2_5_1.Text = Q2Seq + qset.qL1_list[1].qL2_list[0].q2_order + " " + qset.qL1_list[1].qL2_list[0].q2_text; lblQuestion3_4_1_1.Text = qset.qL1_list[1].qL2_list[0].qL3_list[0].q3_order + " " + qset.qL1_list[1].qL2_list[0].qL3_list[0].q3_text; //-----------จบ ประเด็น4-------------------------------- //--------------ประเด็น5--------------------------- lblQuestion_3.Text = qset.qL1_list[2].q1_text; lblAssumption_3.Text = qset.qL1_list[2].q1_assumption; lblQuestion_id_3.Text = qset.qL1_list[2].q1_id; lblQuestion_id_praden_3.Text = lblQuestion_id_3.Text; lblQuestion2_6_1.Text = Q2Seq + qset.qL1_list[2].qL2_list[0].q2_order + " " + qset.qL1_list[2].qL2_list[0].q2_text; lblQuestion3_5_1_1.Text = qset.qL1_list[2].qL2_list[0].qL3_list[0].q3_order + " " + qset.qL1_list[2].qL2_list[0].qL3_list[0].q3_text; lblQuestion3_5_1_2.Text = qset.qL1_list[2].qL2_list[0].qL3_list[1].q3_order + " " + qset.qL1_list[2].qL2_list[0].qL3_list[1].q3_text; //-----------จบ ประเด็น5-------------------------------- #endregion ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); string max = ""; if (ck != null) { mgCookie.UpdateCookies("qset_id", qset.qset_id); //คำถามชุด ข. answer ans = new answer(); max = ans.getLatestAnswerQ2(ck.pj_id, ans.getLatestAnswerQSetID(ck.pj_id)); //if (pnlQL1_3.Visible == true) //{ // //ประเด็น 3 // mgCookie.UpdateCookies("q1_id", qset.qL1_list[0].q1_id); // mgCookie.UpdateCookies("q2_id", qset.qL1_list[0].qL2_list[0].q2_id); //} //else if (pnlQL1_4.Visible == true) //{ // //ประเด็นที่ 4 // mgCookie.UpdateCookies("q1_id", qset.qL1_list[1].q1_id); // mgCookie.UpdateCookies("q2_id", qset.qL1_list[1].qL2_list[0].q2_id); //} //else if (pnlQL1_5.Visible == true) //{ // //ประเด็นที่ 5 // mgCookie.UpdateCookies("q1_id", qset.qL1_list[2].q1_id); // mgCookie.UpdateCookies("q2_id", qset.qL1_list[2].qL2_list[0].q2_id); //} } else { Response.Redirect(ton.config.Global_config.RootURL); } //ไม่ใช่ if ((!Page.IsPostBack) && (ck != null)) { //-------get latest------ string strQ2ID = max; //ton.JavaScript.MessageBox(strQ2ID); if (strQ2ID != null) { if (strQ2ID == "2") { // Origin Q2_1 pnlQL1_3.Visible = true; // Nested Panel inside pnlQL1_3 //--Only 1st Question visible pnlQL2_1.Visible = true; pnlQL2_2.Visible = false; pnlQL2_3.Visible = false; pnlQL2_4.Visible = false; //-----End Nested Panel ----- pnlQL1_4.Visible = false; pnlQL1_5.Visible = false; } else if (strQ2ID == "3") { // Next is Q2_2 pnlQL1_3.Visible = true; // Nested Panel inside pnlQL1_3 //--Only 1st Question visible pnlQL2_1.Visible = false; pnlQL2_2.Visible = true; pnlQL2_3.Visible = false; pnlQL2_4.Visible = false; //-----End Nested Panel ----- pnlQL1_4.Visible = false; pnlQL1_5.Visible = false; } else if (strQ2ID == "4") { // Next is Q2_3 pnlQL1_3.Visible = true; // Nested Panel inside pnlQL1_3 //--Only 1st Question visible pnlQL2_1.Visible = false; pnlQL2_2.Visible = false; pnlQL2_3.Visible = true; pnlQL2_4.Visible = false; //-----End Nested Panel ----- pnlQL1_4.Visible = false; pnlQL1_5.Visible = false; } else if (strQ2ID == "5") { // Next is Q2_4 pnlQL1_3.Visible = true; // Nested Panel inside pnlQL1_3 //--Only 1st Question visible pnlQL2_1.Visible = false; pnlQL2_2.Visible = false; pnlQL2_3.Visible = false; pnlQL2_4.Visible = true; //-----End Nested Panel ----- pnlQL1_4.Visible = false; pnlQL1_5.Visible = false; } else if (strQ2ID == "6") { // Next is Q2_5 pnlQL1_3.Visible = false; // Nested Panel inside pnlQL1_3 //--Only 1st Question visible pnlQL2_1.Visible = false; pnlQL2_2.Visible = false; pnlQL2_3.Visible = false; pnlQL2_4.Visible = false; //-----End Nested Panel ----- pnlQL1_4.Visible = true; pnlQL1_5.Visible = false; } else if (strQ2ID == "7") { // Next is Q2_6 pnlQL1_3.Visible = false; // Nested Panel inside pnlQL1_3 //--Only 1st Question visible pnlQL2_1.Visible = false; pnlQL2_2.Visible = false; pnlQL2_3.Visible = false; pnlQL2_4.Visible = false; //-----End Nested Panel ----- pnlQL1_4.Visible = false; pnlQL1_5.Visible = true; } else if (strQ2ID == "8") { // Next is QSet C ค. litfinish.Text = "เสร็จสิ้นการแก้ไขประเมิน" + qset.qset_text; litfinish.Visible = true; btnToQB.Visible = true; pnlQL1_3.Visible = false; pnlQL1_4.Visible = false; pnlQL1_5.Visible = false; } else { // Origin Q2_1 pnlQL1_3.Visible = false; // Nested Panel inside pnlQL1_3 //--Only 1st Question visible pnlQL2_1.Visible = false; pnlQL2_2.Visible = false; pnlQL2_3.Visible = false; pnlQL2_4.Visible = false; //-----End Nested Panel ----- pnlQL1_4.Visible = false; pnlQL1_5.Visible = false; } } //------------------ /* #region LoadData_from_DB * // Load and Map DB Data For Edit Mode only * string strSQL1 = ""; * SqlCommand cmd = new SqlCommand(); * DataView dv1 = new DataView(); * // Load and Map Data from DB to interface * //คำตอบ * // ประเด็นที่ 3 #region คำตอบ คำถามที่ 1 * strSQL1 = "select * from dbo.answer_q2 q2, answer_q3 q3 " + " where q2.qset_id = @qset_id and " + "q2.pj_id = @pj_id and " + "q2.q2_id = @q2_id and " + "q2.answer_q2_id = q3.answer_q2_id"; + + cmd = new SqlCommand(strSQL1); + cmd.Parameters.AddWithValue("@qset_id", qset.qset_id); + cmd.Parameters.AddWithValue("@pj_id", ck.pj_id); + cmd.Parameters.AddWithValue("@q2_id", qset.qL1_list[0].qL2_list[0].q2_id); + + + dv1 = ton.Data.DBHelper.getDataSet(cmd).Tables[0].DefaultView; + + + radanswer2_1.SelectedValue = dv1.Table.Rows[0]["answer_q2_text"].ToString(); + txtAnswerQuestion3_1_1.Text = dv1.Table.Rows[0]["answer_q3_text"].ToString(); + txtAnswerQuestion3_1_2.Text = dv1.Table.Rows[1]["answer_q3_text"].ToString(); + txtAnswerQuestion3_1_3.Text = dv1.Table.Rows[2]["answer_q3_text"].ToString(); #endregion + #region คำตอบ คำถามที่ 2 + strSQL1 = "select * from dbo.answer_q2 q2, answer_q3 q3 " + " where q2.qset_id = @qset_id and " + "q2.pj_id = @pj_id and " + "q2.q2_id = @q2_id and " + "q2.answer_q2_id = q3.answer_q2_id"; + + cmd = new SqlCommand(strSQL1); + cmd.Parameters.AddWithValue("@qset_id", qset.qset_id); + cmd.Parameters.AddWithValue("@pj_id", ck.pj_id); + cmd.Parameters.AddWithValue("@q2_id", qset.qL1_list[0].qL2_list[1].q2_id); + + + dv1 = ton.Data.DBHelper.getDataSet(cmd).Tables[0].DefaultView; + + radanswer2_2.SelectedValue = dv1.Table.Rows[0]["answer_q2_text"].ToString(); + txtAnswerQuestion3_2_1.Text = dv1.Table.Rows[0]["answer_q3_text"].ToString(); #endregion + #region คำตอบ คำถามที่ 3 + strSQL1 = "select * from dbo.answer_q2 q2, answer_q3 q3 " + " where q2.qset_id = @qset_id and " + "q2.pj_id = @pj_id and " + "q2.q2_id = @q2_id and " + "q2.answer_q2_id = q3.answer_q2_id"; + + cmd = new SqlCommand(strSQL1); + cmd.Parameters.AddWithValue("@qset_id", qset.qset_id); + cmd.Parameters.AddWithValue("@pj_id", ck.pj_id); + cmd.Parameters.AddWithValue("@q2_id", qset.qL1_list[0].qL2_list[2].q2_id); + + + dv1 = ton.Data.DBHelper.getDataSet(cmd).Tables[0].DefaultView; + + radanswer2_3.SelectedValue = dv1.Table.Rows[0]["answer_q2_text"].ToString(); + txtAnswerQuestion3_3_1.Text = dv1.Table.Rows[0]["answer_q3_text"].ToString(); #endregion + #region คำตอบ คำถามที่ 4 + strSQL1 = "select * from dbo.answer_q2 q2, answer_q3 q3 " + " where q2.qset_id = @qset_id and " + "q2.pj_id = @pj_id and " + "q2.q2_id = @q2_id and " + "q2.answer_q2_id = q3.answer_q2_id"; + + cmd = new SqlCommand(strSQL1); + cmd.Parameters.AddWithValue("@qset_id", qset.qset_id); + cmd.Parameters.AddWithValue("@pj_id", ck.pj_id); + cmd.Parameters.AddWithValue("@q2_id", qset.qL1_list[0].qL2_list[3].q2_id); + + + dv1 = ton.Data.DBHelper.getDataSet(cmd).Tables[0].DefaultView; + + radanswer2_4.SelectedValue = dv1.Table.Rows[0]["answer_q2_text"].ToString(); + txtAnswerQuestion3_4_1.Text = dv1.Table.Rows[0]["answer_q3_text"].ToString(); + txtAnswerQuestion3_4_2.Text = dv1.Table.Rows[1]["answer_q3_text"].ToString(); + txtAnswerQuestion3_4_3.Text = dv1.Table.Rows[2]["answer_q3_text"].ToString(); + txtAnswerQuestion3_4_4.Text = dv1.Table.Rows[3]["answer_q3_text"].ToString(); #endregion + + //ประเด็นที่ 4 #region คำตอบ คำถามที่ 5 + strSQL1 = "select * from dbo.answer_q2 q2, answer_q3 q3 " + " where q2.qset_id = @qset_id and " + "q2.pj_id = @pj_id and " + "q2.q2_id = @q2_id and " + "q2.answer_q2_id = q3.answer_q2_id"; + + cmd = new SqlCommand(strSQL1); + cmd.Parameters.AddWithValue("@qset_id", qset.qset_id); + cmd.Parameters.AddWithValue("@pj_id", ck.pj_id); + cmd.Parameters.AddWithValue("@q2_id", qset.qL1_list[1].qL2_list[0].q2_id); + + + dv1 = ton.Data.DBHelper.getDataSet(cmd).Tables[0].DefaultView; + + radanswer2_5_1.SelectedValue = dv1.Table.Rows[0]["answer_q2_text"].ToString(); + txtAnswerQuestion3_4_1_1.Text = dv1.Table.Rows[0]["answer_q3_text"].ToString(); #endregion + + //ประเด็นที่ 5 #region คำตอบ คำถามที่ 6 + strSQL1 = "select * from dbo.answer_q2 q2, answer_q3 q3 " + " where q2.qset_id = @qset_id and " + "q2.pj_id = @pj_id and " + "q2.q2_id = @q2_id and " + "q2.answer_q2_id = q3.answer_q2_id"; + + cmd = new SqlCommand(strSQL1); + cmd.Parameters.AddWithValue("@qset_id", qset.qset_id); + cmd.Parameters.AddWithValue("@pj_id", ck.pj_id); + cmd.Parameters.AddWithValue("@q2_id", qset.qL1_list[2].qL2_list[0].q2_id); + + + dv1 = ton.Data.DBHelper.getDataSet(cmd).Tables[0].DefaultView; + + radanswer2_6_1.SelectedValue = dv1.Table.Rows[0]["answer_q2_text"].ToString(); + txtAnswerQuestion3_5_1_1.Text = dv1.Table.Rows[0]["answer_q3_text"].ToString(); + txtAnswerQuestion3_5_1_2.Text = dv1.Table.Rows[1]["answer_q3_text"].ToString(); + #endregion #endregion */ } // set cookies to keep the lastest question Set , Q2 #region set cookies follow to visible panel #region ไม่ใช้ //if (pnlQL1_3.Visible == true) //{ // mgCookie.UpdateCookies("q1_id", "3"); //ประเด็นที่สาม // if (pnlQL2_1.Visible == true) // { // mgCookie.UpdateCookies("q2_id", "3"); //คำถามที่1 , IDคำถามเริ่มที่3 // } // else if (pnlQL2_2.Visible == true) // { // mgCookie.UpdateCookies("q2_id", "4"); //คำถามที่2 // } // else if (pnlQL2_3.Visible == true) // { // mgCookie.UpdateCookies("q2_id", "5"); //คำถามที่3 // } // else if (pnlQL2_4.Visible == true) // { // mgCookie.UpdateCookies("q2_id", "6"); //คำถามที่3 // } //} //else if (pnlQL1_4.Visible == true) //{ // mgCookie.UpdateCookies("q1_id", "4"); //ประเด็นที่สี่ // mgCookie.UpdateCookies("q2_id", "7"); //คำถามที่ห้า //} //else if (pnlQL1_5.Visible == true) //{ // mgCookie.UpdateCookies("q1_id", "5"); //ประเด็นที่ห้า // mgCookie.UpdateCookies("q2_id", "8"); //คำถามที่หก //} #endregion #endregion //---------------------------------------- //คำถามที่ 1 if (radanswer2_1.SelectedValue == "มี") // ตอบว่า มี { txtAnswerQuestion3_1_1.Enabled = txtAnswerQuestion3_1_2.Enabled = txtAnswerQuestion3_1_3.Enabled = true; reqvld_3_1_1.Enabled = reqvld_3_1_2.Enabled = reqvld_3_1_3.Enabled = true; } else { txtAnswerQuestion3_1_1.Enabled = txtAnswerQuestion3_1_2.Enabled = txtAnswerQuestion3_1_3.Enabled = false; reqvld_3_1_1.Enabled = reqvld_3_1_2.Enabled = reqvld_3_1_3.Enabled = false; } //คำถามที่ 2 if (radanswer2_2.SelectedValue == "มี") // ตอบว่า มี { txtAnswerQuestion3_2_1.Enabled = true; reqvld_3_2_1.Enabled = true; } else { txtAnswerQuestion3_2_1.Enabled = false; reqvld_3_2_1.Enabled = false; } //คำถามที่ 3 if (radanswer2_3.SelectedValue == "มี") // ตอบว่า มี { txtAnswerQuestion3_3_1.Enabled = true; reqvld_3_3_1.Enabled = true; } else { txtAnswerQuestion3_3_1.Enabled = false; reqvld_3_3_1.Enabled = false; } //คำถามที่ 4 if (radanswer2_4.SelectedValue == "มี") // ตอบว่า มี { txtAnswerQuestion3_4_1.Enabled = txtAnswerQuestion3_4_2.Enabled = txtAnswerQuestion3_4_3.Enabled = txtAnswerQuestion3_4_4.Enabled = true; reqvld_3_4_1.Enabled = reqvld_3_4_2.Enabled = reqvld_3_4_3.Enabled = reqvld_3_4_4.Enabled = true; } else { txtAnswerQuestion3_4_1.Enabled = txtAnswerQuestion3_4_2.Enabled = txtAnswerQuestion3_4_3.Enabled = txtAnswerQuestion3_4_4.Enabled = false; reqvld_3_4_1.Enabled = reqvld_3_4_2.Enabled = reqvld_3_4_3.Enabled = reqvld_3_4_4.Enabled = false; } //คำถามที่ 5 if ((radanswer2_5_1.SelectedValue == "มี") || (radanswer2_5_1.SelectedValue == "มีบางส่วน")) // ตอบว่า มี หรือ มีบางส่วน { txtAnswerQuestion3_4_1_1.Enabled = true; reqvld3_4_1_1.Enabled = true; } else { txtAnswerQuestion3_4_1_1.Enabled = false; reqvld3_4_1_1.Enabled = false; } //คำถามที่ 6 if (radanswer2_6_1.SelectedValue == "มี") // ตอบว่า มี หรือ มีบางส่วน { txtAnswerQuestion3_5_1_1.Enabled = txtAnswerQuestion3_5_1_2.Enabled = true; reqvld_3_5_1_1.Enabled = reqvld_3_5_1_2.Enabled = true; } else { txtAnswerQuestion3_5_1_1.Enabled = txtAnswerQuestion3_5_1_2.Enabled = false; reqvld_3_5_1_1.Enabled = reqvld_3_5_1_2.Enabled = false; } }
protected void Page_Load(object sender, EventArgs e) { enableValidation(); ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); string max = ""; if (ck != null) { string strSQL1 = "select * from question1 q1, question2 q2, question3 q3 where q1.qset_id = 4 and q1.q1_id = q2.q1_id and q2.q2_id = q3.q2_id and q1.q1_id = 7"; SqlDataSource1.SelectCommand = strSQL1; SqlDataSource1.DataBind(); DataView dv1 = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); //ประเด็นที่ 7 lblQuestion7.Text = "ประเด็นที่ " + dv1.Table.Rows[0]["q1_order"].ToString() + " " + dv1.Table.Rows[0]["q1_text"].ToString(); lblAssumption7.Text = "สมมุติฐาน " + dv1.Table.Rows[0]["q1_order"].ToString() + " " + dv1.Table.Rows[0]["q1_assumption"].ToString(); lblQuestion7_1.Text = "คำถามที่ " + dv1.Table.Rows[0]["q2_order"].ToString() + " " + dv1.Table.Rows[0]["q2_text"].ToString(); lblQuestion7_2.Text = "คำถามที่ " + dv1.Table.Rows[1]["q2_order"].ToString() + " " + dv1.Table.Rows[1]["q2_text"].ToString(); lblQuestion7_3.Text = "คำถามที่ " + dv1.Table.Rows[2]["q2_order"].ToString() + " " + dv1.Table.Rows[2]["q2_text"].ToString(); lblQuestion7_1_1.Text = dv1.Table.Rows[0]["q3_order"].ToString() + " " + dv1.Table.Rows[0]["q3_text"].ToString(); lblQuestion7_2_1.Text = dv1.Table.Rows[1]["q3_order"].ToString() + " " + dv1.Table.Rows[1]["q3_text"].ToString(); lblQuestion7_3_1.Text = dv1.Table.Rows[2]["q3_order"].ToString() + " " + dv1.Table.Rows[2]["q3_text"].ToString(); //ประเด็นที่ 8 string strSQL2 = "select * from question1 q1, question2 q2, question3 q3 where q1.qset_id = 4 and q1.q1_id = q2.q1_id and q2.q2_id = q3.q2_id and q1.q1_id = 8"; SqlDataSource2.SelectCommand = strSQL2; SqlDataSource2.DataBind(); dv1 = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); lblQuestion8.Text = "ประเด็นที่ " + dv1.Table.Rows[0]["q1_order"].ToString() + " " + dv1.Table.Rows[0]["q1_text"].ToString(); lblAssumption8.Text = "สมมุติฐาน " + dv1.Table.Rows[0]["q1_order"].ToString() + " " + dv1.Table.Rows[0]["q1_assumption"].ToString(); lblQuestion8_4.Text = "คำถามที่ " + dv1.Table.Rows[0]["q2_order"].ToString() + " " + dv1.Table.Rows[0]["q2_text"].ToString(); lblQuestion8_5.Text = "คำถามที่ " + dv1.Table.Rows[1]["q2_order"].ToString() + " " + dv1.Table.Rows[1]["q2_text"].ToString(); lblQuestion8_4_1.Text = dv1.Table.Rows[0]["q3_order"].ToString() + " " + dv1.Table.Rows[0]["q3_text"].ToString(); lblQuestion8_5_1.Text = dv1.Table.Rows[1]["q3_order"].ToString() + " " + dv1.Table.Rows[1]["q3_text"].ToString(); //ประเด็นที่ 9 string strSQL3 = "select * from question1 q1, question2 q2, question3 q3 where q1.qset_id = 4 and q1.q1_id = q2.q1_id and q2.q2_id = q3.q2_id and q1.q1_id = 9"; SqlDataSource2.SelectCommand = strSQL3; SqlDataSource2.DataBind(); dv1 = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); lblQuestion9.Text = "ประเด็นที่ " + dv1.Table.Rows[0]["q1_order"].ToString() + " " + dv1.Table.Rows[0]["q1_text"].ToString(); lblAssumption9.Text = "สมมุติฐาน " + dv1.Table.Rows[0]["q1_order"].ToString() + " " + dv1.Table.Rows[0]["q1_assumption"].ToString(); lblQuestion9_6.Text = "คำถามที่ " + dv1.Table.Rows[0]["q2_order"].ToString() + " " + dv1.Table.Rows[0]["q2_text"].ToString(); //lblQuestion9_7.Text = "คำถามที่ " + dv1.Table.Rows[1]["q2_order"].ToString() + " " + dv1.Table.Rows[1]["q2_text"].ToString(); lblQuestion9_6_1.Text = dv1.Table.Rows[0]["q3_order"].ToString() + " " + dv1.Table.Rows[0]["q3_text"].ToString(); lblQuestion9_6_2.Text = dv1.Table.Rows[1]["q3_order"].ToString() + " " + dv1.Table.Rows[1]["q3_text"].ToString(); if (!Page.IsPostBack) { #region ต้น answer ans = new answer(); max = ans.getLatestAnswerQ2(ck.pj_id, ans.getLatestAnswerQSetID(ck.pj_id)); #endregion string strPendingQ1 = string.Empty; string strPendingQ2 = string.Empty; //// เริ่มที่ ต้น comment //if (Request["q1"] != null && Request["q2"] != null) //{ // strPendingQ1 = Request["q1"].ToString(); // strPendingQ2 = Request["q2"].ToString(); // switch (strPendingQ1) // { // case "1": // panel1.Visible = true; // panel2.Visible = false; // panel3.Visible = false; // break; // case "2": // panel1.Visible = false; // panel2.Visible = true; // panel3.Visible = false; // break; // case "3": // panel1.Visible = false; // panel2.Visible = false; // panel3.Visible = true; // break; // default: // panel1.Visible = true; // panel2.Visible = false; // panel3.Visible = false; // break; // } // switch (strPendingQ2) // { // case "1": // pnl7_1.Visible = true; // pnl7_2.Visible = false; // pnl7_3.Visible = false; // pnl8_4.Visible = false; // pnl8_5.Visible = false; // pnl9_6.Visible = false; // break; // case "2": // pnl7_1.Visible = false; // pnl7_2.Visible = true; // pnl7_3.Visible = false; // pnl8_4.Visible = false; // pnl8_5.Visible = false; // pnl9_6.Visible = false; // break; // case "3": // pnl7_1.Visible = false; // pnl7_2.Visible = false; // pnl7_3.Visible = true; // pnl8_4.Visible = false; // pnl8_5.Visible = false; // pnl9_6.Visible = false; // break; // case "4": // pnl7_1.Visible = false; // pnl7_2.Visible = false; // pnl7_3.Visible = false; // pnl8_4.Visible = true; // pnl8_5.Visible = false; // pnl9_6.Visible = false; // break; // case "5": // pnl7_1.Visible = false; // pnl7_2.Visible = false; // pnl7_3.Visible = false; // pnl8_4.Visible = false; // pnl8_5.Visible = true; // pnl9_6.Visible = false; // break; // case "6": // pnl7_1.Visible = false; // pnl7_2.Visible = false; // pnl7_3.Visible = false; // pnl8_4.Visible = false; // pnl8_5.Visible = false; // pnl9_6.Visible = true; // break; // default: // pnl7_1.Visible = true; // pnl7_2.Visible = false; // pnl7_3.Visible = false; // pnl8_4.Visible = false; // pnl8_5.Visible = false; // pnl9_6.Visible = false; // break; // } //} //else //// หมด ที่ต้น comment { //answer ans = new answer(); //string strQ2ID = ans.getLatestAnswerQ2(ck.pj_id, "4"); //string strQ2ID = ck.q2_id; #region ต้น string strQ2ID = max; //ton.JavaScript.MessageBox(strQ2ID); #endregion if (strQ2ID != "0") { switch (strQ2ID) { //case "10": case "9": panel1.Visible = true; panel2.Visible = false; panel3.Visible = false; pnl7_1.Visible = true; pnl7_2.Visible = false; pnl7_3.Visible = false; pnl8_4.Visible = false; pnl8_5.Visible = false; pnl9_6.Visible = false; break; //case "11": case "10": panel1.Visible = true; panel2.Visible = false; panel3.Visible = false; pnl7_1.Visible = false; pnl7_2.Visible = true; pnl7_3.Visible = false; pnl8_4.Visible = false; pnl8_5.Visible = false; pnl9_6.Visible = false; break; //case "12": case "11": panel1.Visible = true; panel2.Visible = false; panel3.Visible = false; pnl7_1.Visible = false; pnl7_2.Visible = false; pnl7_3.Visible = true; pnl8_4.Visible = false; pnl8_5.Visible = false; pnl9_6.Visible = false; break; //case "13": case "12": panel1.Visible = false; panel2.Visible = true; panel3.Visible = false; pnl7_1.Visible = false; pnl7_2.Visible = false; pnl7_3.Visible = false; pnl8_4.Visible = true; pnl8_5.Visible = false; pnl9_6.Visible = false; break; //case "14": case "13": panel1.Visible = false; panel2.Visible = true; panel3.Visible = false; pnl7_1.Visible = false; pnl7_2.Visible = false; pnl7_3.Visible = false; pnl8_4.Visible = false; pnl8_5.Visible = true; pnl9_6.Visible = false; break; //case "15": case "14": panel1.Visible = false; panel2.Visible = false; panel3.Visible = true; pnl7_1.Visible = false; pnl7_2.Visible = false; pnl7_3.Visible = false; pnl8_4.Visible = false; pnl8_5.Visible = false; pnl9_6.Visible = true; break; case "15": // Go To Quest E จ panel1.Visible = false; panel2.Visible = false; panel3.Visible = false; pnl7_1.Visible = false; pnl7_2.Visible = false; pnl7_3.Visible = false; pnl8_4.Visible = false; pnl8_5.Visible = false; pnl9_6.Visible = false; pnl_fin.Visible = true; litfinish.Text = "เสร็จสิ้นการประเมินชุด ง: ขั้นตอนการริเริ่มแผนงาน/โครงการและวิเคราะห์เบื้องต้น โปรดดำเนินการต่อ"; litfinish.Visible = true; btnToQB.Visible = true; break; default: // 1 เคยเป็น true panel1.Visible = false; panel2.Visible = false; panel3.Visible = false; // 7.1 เคยเป็น true pnl7_1.Visible = false; pnl7_2.Visible = false; pnl7_3.Visible = false; pnl8_4.Visible = false; pnl8_5.Visible = false; pnl9_6.Visible = false; break; } } } } } }