protected void btnADD_Click(object sender, EventArgs e) { TQF2Sec3StructureCategory dataInsert = new TQF2Sec3StructureCategory(); dataInsert.CurrCode = CurrCode; dataInsert.YearVersion = YearVersion; dataInsert.CurrFormatCode = CurrFormatCode; dataInsert.CurrTypeCode = CurrTypeCode; dataInsert.MajorCode = MajorCode; dataInsert.CategoryCode = ddlCATEGORY.SelectedValue; dataInsert.CategoryCredits = txtCATEGORYCREDITS.Text; string sql = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + ddlCATEGORY.SelectedValue + "'"; List <TQF2Sec3StructureCategory> tqf2Sec3StructureCategory = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sql); if (tqf2Sec3StructureCategory.Count > 0) { //lblError.Visible = true; Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('ข้อมูลซ้ำ!');", true); } else { //เช็คหน่วยกิตเกินกว่ากำหนด int totalCredit; int allCredit; int newCredit; TQF2Sec3StructureCategory summaryData = new TQF2Sec3StructureCategory(); summaryData.CurrCode = CurrCode; summaryData.YearVersion = YearVersion; summaryData.CurrFormatCode = CurrFormatCode; summaryData.CurrTypeCode = CurrTypeCode; summaryData.MajorCode = MajorCode; allCredit = new TQF2Sec3StructureCategory().getSumCategoryCredits(summaryData); string sqlStructurePlan = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And MAJORCODE='" + MajorCode + "' And CURRFORMATCODE='" + CurrFormatCode + "'"; List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sqlStructurePlan); totalCredit = int.Parse(dataStructurePlan[0].TotalCredits); newCredit = int.Parse(txtCATEGORYCREDITS.Text); if ((allCredit + newCredit) > totalCredit) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('หน่วยกิตเกินกว่ากำหนด!');", true); } else { string insertTQF2Sec3StructureCategory = new TQF2Sec3StructureCategory().insertTQF2Sec3StructureCategory(dataInsert); if (insertTQF2Sec3StructureCategory == "Success") { //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR4.aspx Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; //Session["MajorCode"] = MajorCode; Response.Redirect("Faculty_add_CURR4.aspx"); } } } }
protected void btnNEXT_Click(object sender, EventArgs e) { string sql = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'"; List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sql); foreach (StructurePlan row in dataStructurePlan) { TQF2Sec3StructureCategory data = new TQF2Sec3StructureCategory(); data.CurrCode = row.CurrCode; data.YearVersion = row.YearVersion; data.CurrFormatCode = row.CurrFormatCode; data.CurrTypeCode = row.CurrTypeCode; data.MajorCode = row.MajorCode; int credit = data.getSumCategoryCredits(data); if (int.Parse(row.TotalCredits) != credit) { Response.Redirect("addCURR_GEN_EDU4.aspx?msg=error&CurrTypeCode=" + row.CurrTypeCode + ""); } } //สร้าง session CurrCode ไว้ใช้สำหรับทุกหน้าในการสร้างหลักสูตร Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; Session["NumTQF1"] = NumTQF1; Response.Redirect("addCURR_GEN_EDU4.aspx"); }
/// <summary> /// เรียกผลรวมหน่วยกิตจากตาราง TQF2SEC3STRUCTURECATEGORY /// </summary> /// <param name="summaryData">TQF2Sec3StructureCategory Object</param> /// <returns></returns> public int getSumCategoryCredits(TQF2Sec3StructureCategory summaryData) { int summary = 0; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = "select SUM(CATEGORYCREDITS) As SUMCREDITS from TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + summaryData.CurrCode + "' And YEARVERSION='" + summaryData.YearVersion + "' And CURRFORMATCODE='" + summaryData.CurrFormatCode + "' And CURRTYPECODE='" + summaryData.CurrTypeCode + "' And MAJORCODE='" + summaryData.MajorCode + "'"; try { DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { //summary = int.Parse(rowData["SUMCREDITS"].ToString()); if (rowData["SUMCREDITS"].ToString() == "") { summary = 0; } else { summary = int.Parse(rowData["SUMCREDITS"].ToString()); } } } catch { HttpContext.Current.Session["response"] = "Unit Test:getSumCategoryCredits" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(summary); }
/// <summary> /// แก้ไขข้อมูลจากตาราง TQF2SEC3STRUCTURECATEGORY /// </summary> /// <param name="updateData">TQF2Sec3StructureCategory Object</param> /// <returns>Success</returns> public string updateTQF2Sec3StructureCategory(TQF2Sec3StructureCategory updateData) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); string sql = "Update TQF2SEC3STRUCTURECATEGORY Set CATEGORYCREDITS = '" + updateData.CategoryCredits + "' Where CURRCODE = '" + updateData.CurrCode + "' And YEARVERSION = '" + updateData.YearVersion + "' And CURRFORMATCODE = '" + updateData.CurrFormatCode + "' And CURRTYPECODE = '" + updateData.CurrTypeCode + "' And MAJORCODE = '" + updateData.MajorCode + "' And CATEGORYCODE = '" + updateData.CategoryCode + "'"; oracleObj.UpdateCommand = sql; try { if (oracleObj.Update() == 1) { response = "Success"; } } catch (Exception e) { string exception = e.Message; HttpContext.Current.Session["response"] = "updateTQF2Sec3StructureCategory: " + exception; HttpContext.Current.Response.Redirect("../err_response.aspx"); } return(response); }
/// <summary> /// เพิ่มข้อมูลลงตาราง TQF2SEC3STRUCTURECATEGORY /// </summary> /// <param name="dataInsert">TQF2Sec3StructureCategory Object</param> /// <returns>Success</returns> public string insertTQF2Sec3StructureCategory(TQF2Sec3StructureCategory dataInsert) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); string sql = "Insert into TQF2SEC3STRUCTURECATEGORY (CURRCODE, YEARVERSION, CURRFORMATCODE, CURRTYPECODE, MAJORCODE, CATEGORYCODE, CATEGORYCREDITS) values ('" + dataInsert.CurrCode + "','" + dataInsert.YearVersion + "','" + dataInsert.CurrFormatCode + "','" + dataInsert.CurrTypeCode + "','" + dataInsert.MajorCode + "','" + dataInsert.CategoryCode + "','" + dataInsert.CategoryCredits + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "Success"; } } catch (Exception e) { string exception = e.Message; HttpContext.Current.Session["response"] = "insertTQF2Sec3StructureCategory: " + exception; HttpContext.Current.Response.Redirect("../err_response.aspx"); } return(response); }
/// <summary> /// เรียกดูข้อมูลจากตาราง TQF2SEC3STRUCTURECATEGORY /// </summary> /// <param name="sql">SQL Command</param> /// <returns>ข้อมูลจากตาราง TQF2SEC3STRUCTURECATEGORY</returns> public List <TQF2Sec3StructureCategory> getTQF2Sec3StructureCategoryManual(string sql) { List <TQF2Sec3StructureCategory> TQF2Sec3StructureCategoryData = new List <TQF2Sec3StructureCategory>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { TQF2Sec3StructureCategory TQF2Sec3StructureCategoryRow = new TQF2Sec3StructureCategory(); TQF2Sec3StructureCategoryRow.CurrCode = rowData["CURRCODE"].ToString(); TQF2Sec3StructureCategoryRow.YearVersion = rowData["YEARVERSION"].ToString(); TQF2Sec3StructureCategoryRow.CurrFormatCode = rowData["CURRFORMATCODE"].ToString(); TQF2Sec3StructureCategoryRow.CurrTypeCode = rowData["CURRTYPECODE"].ToString(); TQF2Sec3StructureCategoryRow.MajorCode = rowData["MAJORCODE"].ToString(); TQF2Sec3StructureCategoryRow.CategoryCode = rowData["CATEGORYCODE"].ToString(); TQF2Sec3StructureCategoryRow.CategoryCredits = rowData["CATEGORYCREDITS"].ToString(); TQF2Sec3StructureCategoryData.Add(TQF2Sec3StructureCategoryRow); } return(TQF2Sec3StructureCategoryData); }
protected void btnNext_Click(object sender, EventArgs e) { string sql = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'"; List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sql); foreach (StructurePlan row in dataStructurePlan) { string sql2 = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + row.CurrFormatCode + "' And CURRTYPECODE='" + row.CurrTypeCode + "' And MAJORCODE='" + row.MajorCode + "'"; List <TQF2Sec3StructureCategory> tqf2s3StructureCategory = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sql2); foreach (TQF2Sec3StructureCategory row2 in tqf2s3StructureCategory) { TQF2Sec3StructureGroup data = new TQF2Sec3StructureGroup(); data.CurrCode = row2.CurrCode; data.YearVersion = row2.YearVersion; data.CurrFormatCode = row2.CurrFormatCode; data.CurrTypeCode = row2.CurrTypeCode; data.MajorCode = row2.MajorCode; data.CategoryCode = row2.CategoryCode; int credit = data.getSumStructureGroupCredits(data); if (int.Parse(row2.CategoryCredits) != credit) { Response.Redirect("Faculty_add_CURR5.aspx?msg=error&CategoryCode=" + row2.CategoryCode + "&CurrTypeCode=" + row2.CurrTypeCode + "&MajorCode=" + row2.MajorCode + ""); } } } //สร้าง session CurrCode ไว้ใช้สำหรับทุกหน้าในการสร้างหลักสูตร Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; Session["NumTQF1"] = NumTQF1; Response.Redirect("Faculty_add_CURR5_1.aspx"); }
protected void btnNext_Click(object sender, EventArgs e) { string sql = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'"; List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sql); //แผน foreach (StructurePlan row in dataStructurePlan) { string sql2 = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + row.CurrFormatCode + "' And CURRTYPECODE='" + row.CurrTypeCode + "' And MAJORCODE='" + row.MajorCode + "'"; List <TQF2Sec3StructureCategory> tqf2s3StructureCategory = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sql2); //หมวด foreach (TQF2Sec3StructureCategory row2 in tqf2s3StructureCategory) { string sql3 = "Select * From TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + row2.CurrCode + "' And YEARVERSION='" + row2.YearVersion + "' And CURRFORMATCODE='" + row2.CurrFormatCode + "' And CURRTYPECODE='" + row2.CurrTypeCode + "' And MAJORCODE='" + row2.MajorCode + "' And CATEGORYCODE='" + row2.CategoryCode + "'"; List <TQF2Sec3StructureGroup> tqf2s3StructureGroup = new TQF2Sec3StructureGroup().getTQF2Sec3StructureGroupManual(sql3); //กลุ่ม foreach (TQF2Sec3StructureGroup row3 in tqf2s3StructureGroup) { string sql4 = "Select * From TQF2SEC3STRUCTURETYPE Where CURRCODE='" + row3.CurrCode + "' And YEARVERSION='" + row3.YearVersion + "' And CURRFORMATCODE='" + row3.CurrFormatCode + "' And CURRTYPECODE='" + row3.CurrTypeCode + "' And MAJORCODE='" + row3.MajorCode + "' And CATEGORYCODE='" + row3.CategoryCode + "' And COURSEGROUPCODE='" + row3.CourseGroupCode + "'"; List <Tqf2Sec3StructureType> tqf2Sec3StructureType = new Tqf2Sec3StructureType().getTqf2Sec3StructureTypeManual(sql4); if (tqf2Sec3StructureType.Count == 0) { Response.Redirect("Faculty_add_CURR5_1.aspx?msg=error&CategoryCode=" + row3.CategoryCode + "&CurrTypeCode=" + row3.CurrTypeCode + "&CourseGroupCode=" + row3.CourseGroupCode + ""); } else { //ชนิดวิชา foreach (Tqf2Sec3StructureType row4 in tqf2Sec3StructureType) { Tqf2Sec3StructureType data = new Tqf2Sec3StructureType(); data.CurrCode = row4.CurrCode; data.YearVersion = row4.YearVersion; data.CurrFormatCode = row4.CurrFormatCode; data.CurrTypeCode = row4.CurrTypeCode; data.MajorCode = row4.MajorCode; data.CategoryCode = row4.CategoryCode; data.CourseGroupCode = row4.CourseGroupCode; int credit = data.getSumStructureType(data); if (int.Parse(row3.GroupCredits) != credit) { Response.Redirect("Faculty_add_CURR5_1.aspx?msg=error&CategoryCode=" + row4.CategoryCode + "&CurrTypeCode=" + row4.CurrTypeCode + "&CourseGroupCode=" + row4.CourseGroupCode + ""); } } } } } } //สร้าง session CurrCode ไว้ใช้สำหรับทุกหน้าในการสร้างหลักสูตร Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; Session["NumTQF1"] = NumTQF1; Response.Redirect("Faculty_add_CURR6.aspx"); }
protected void btnOK_Click(object sender, EventArgs e) { string sql = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "'"; List <TQF2Sec3StructureCategory> tqf2Sec3StructureCategory; tqf2Sec3StructureCategory = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sql); if (tqf2Sec3StructureCategory.Count > 0) { //[Step 8] ลบข้อมูลในตาราง TQF2SEC3SEMESTERPLAN string sql8 = "Delete From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'"; string deleteTQF2SemesterPlan = new TQF2Sec3SemesterPlan().deleteTQF2Sec3SemesterPlanManual(sql8); //[Step 7] ลบข้อมูลในตาราง TQF2SEC4CURRICULUMMAPPING string sql7 = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'"; List <TQF2Sec3PlanDetail> TQF2Sec3PlanDetailData = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql7); foreach (TQF2Sec3PlanDetail row in TQF2Sec3PlanDetailData) { string sql7_1 = "Delete From TQF2SEC4CURRICULUMMAPPING Where CURRCODE ='" + row.CurrCode + "'"; string deleteTQF2Sec4CurriculumMapping = new TQF2Sec4CurriculumMapping().deleteTQF2Sec4CurriculumMappingManual(sql7_1); } //[Step 6-1] ลบข้อมูลในตาราง PREREQUISITE string sql6 = "Delete From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "'"; string deletePreRequisite = new PreRequisite().deletePreRequisiteManual(sql6); //[Step 6] ลบข้อมูลในตาราง TQF2SEC3PLANDETAIL string sql5 = "Delete From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "'"; string deleteTQF2Sec3PlanDetail = new TQF2Sec3PlanDetail().deleteTQF2Sec3PlanDetailManual(sql5); //[Step 5_1] ลบข้อมูลในตาราง TQF2SEC3STRUCTURETYPE string sql4 = "Delete From TQF2SEC3STRUCTURETYPE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "'"; string deleteTqf2Sec3StructureType = new Tqf2Sec3StructureType().deleteTqf2Sec3StructureTypeManual(sql4); //[Step 5] ลบข้อมูลในตาราง TQF2SEC3STRUCTUREGROUP string sql3 = "Delete From TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "'"; string deleteTQF2Sec3StructureGroup = new TQF2Sec3StructureGroup().deleteTQF2Sec3StructureGroupManual(sql3); //[Step 4] ลบข้อมูลในตาราง TQF2SEC3STRUCTURECATEGORY string sql2 = "Delete From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "'"; string deleteTQF2Sec3StructureCategory = new TQF2Sec3StructureCategory().deleteTQF2Sec3StructureCategoryManual(sql2); //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR4.aspx Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; Response.Redirect("Faculty_add_CURR4.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { CurrCode = Request.QueryString["CurrCode"]; YearVersion = Request.QueryString["YearVersion"]; CurrFormatCode = Request.QueryString["CurrFormatCode"]; CurrTypeCode = Request.QueryString["CurrTypeCode"]; MajorCode = Request.QueryString["MajorCode"]; CategoryCode = Request.QueryString["CategoryCode"]; string sql = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "'"; List <TQF2Sec3StructureCategory> tqf2Sec3StructureCategory; tqf2Sec3StructureCategory = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sql); if (tqf2Sec3StructureCategory.Count > 0) { lblTextToRemove.Text = new Category().getCategory(CategoryCode).CategoryThName + " " + new CurrFormat().getCurrFormat(CurrFormatCode).CurrFormatName + " (" + new TQF.Major().getMajor(MajorCode).MajorThName + ")"; } }
/// <summary> /// เรียกดูข้อมูลจากตาราง TQF2SEC3STRUCTURECATEGORY /// </summary> /// <param name="CurrCode">รหัสหลักสูตร(Curriculum)</param> /// <returns>ข้อมูลจากตาราง TQF2SEC3STRUCTURECATEGORY</returns> public TQF2Sec3StructureCategory getTQF2Sec3StructureCategory(string CurrCode) { TQF2Sec3StructureCategory TQF2Sec3StructureCategoryData = new TQF2Sec3StructureCategory(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "'"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { TQF2Sec3StructureCategoryData.CurrCode = rowData["CURRCODE"].ToString(); TQF2Sec3StructureCategoryData.YearVersion = rowData["YEARVERSION"].ToString(); TQF2Sec3StructureCategoryData.CurrFormatCode = rowData["CURRFORMATCODE"].ToString(); TQF2Sec3StructureCategoryData.CurrTypeCode = rowData["CURRTYPECODE"].ToString(); TQF2Sec3StructureCategoryData.MajorCode = rowData["MAJORCODE"].ToString(); TQF2Sec3StructureCategoryData.CategoryCode = rowData["CATEGORYCODE"].ToString(); TQF2Sec3StructureCategoryData.CategoryCredits = rowData["CATEGORYCREDITS"].ToString(); } return(TQF2Sec3StructureCategoryData); }
protected void htmlGenerate(string MajorCode, string CurrFormatCode, string TotalCredits, string YearVersion, string CurrTypeCode) { string html = ""; html += "<section>"; html += " <div class=\"title-data-newStd\"><i class=\"fa fa-file-text-o\"></i> " + new CurrType().getCurrType(CurrTypeCode).CurrTypeName + " " + new CurrFormat().getCurrFormat(CurrFormatCode).CurrFormatName + " (แขนงวิชา " + new TQF.Major().getMajor(MajorCode).MajorThName + ")" + "</div>"; html += "</section>"; html += "<section>"; html += " <div id=\"accordion1\" class=\"panel-group smart-accordion-default\">"; html += " <div class=\"panel panel-info\">"; string sql = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'"; List <TQF2Sec3StructureCategory> tqf2s3StructureCategory = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sql); foreach (TQF2Sec3StructureCategory data in tqf2s3StructureCategory) { html += " <div class=\"panel panel-info\">"; html += " <div class=\"panel-heading\">"; html += " <h4 class=\"panel-title\">"; Label label0 = new Label(); Guid gid = new Guid(); gid = System.Guid.NewGuid(); label0.Text = gid.ToString(); html += " <a class=\"collapsed\" href=\"#" + label0.Text + "\" data-parent=\"#accordion1\" data-toggle=\"collapse\">"; html += " <i class=\"fa fa-lg fa-angle-down pull-right\"></i>"; html += " <i class=\"fa fa-lg fa-angle-up pull-right\"></i>"; Label label1 = new Label(); label1.Text = new Category().getCategory(data.CategoryCode).CategoryThName + " (" + data.CategoryCredits + " หน่วยกิต)"; html += " <span id=\"ContentPlaceHolder1_Label23\">" + label1.Text + "</span>"; html += " </a>"; html += " </h4>"; html += " </div>"; html += " <div class=\"panel-collapse collapse\" id=\"" + label0.Text + "\" style=\"height: 0px;\">"; html += " <div class=\"panel-body padding-10 well\">"; string sql2 = "Select * From TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + data.CurrCode + "' And YEARVERSION='" + data.YearVersion + "' And CURRFORMATCODE='" + data.CurrFormatCode + "' And CURRTYPECODE='" + data.CurrTypeCode + "' And MAJORCODE='" + data.MajorCode + "' And CATEGORYCODE='" + data.CategoryCode + "'"; List <TQF2Sec3StructureGroup> tqf2s3StructureGroup = new TQF2Sec3StructureGroup().getTQF2Sec3StructureGroupManual(sql2); foreach (TQF2Sec3StructureGroup row in tqf2s3StructureGroup) { Label label2 = new Label(); label2.Text = new CourseGroup().getCourseGroup(row.CourseGroupCode).CourseGroupThName + " (" + row.GroupCredits + " หน่วยกิต)"; html += " <div class=\"row\">"; html += " <section class=\"col col-6\">"; html += " <span style=\"color: #996633; font-size: Large; font-weight: bold;\" id=\"ContentPlaceHolder1_Label1\">" + label2.Text + "</span>"; html += " </section>"; html += " <section class=\"col col-3 pull-right\">"; html += " <a id=\"HyperLink2\" title=\"เพิ่มชนิดวิชา\" class=\"pull-right\" data-toggle=\"modal\" data-target=\"#add\" href=\"addTYPE_to_CURR.aspx?CurrCode=" + data.CurrCode + "&YearVersion=" + data.YearVersion + "&CurrFormatCode=" + row.CurrFormatCode + "&CurrTypeCode=" + row.CurrTypeCode + "&MajorCode=" + row.MajorCode + "&CategoryCode=" + row.CategoryCode + "&CourseGroupCode=" + row.CourseGroupCode + "\">"; html += " <img src=\"../img/button_add.png\" id=\"ContentPlaceHolder1_Image1\">"; html += " </a>"; html += " </section>"; html += " </div>"; html += " <section>"; Table tblGroupCategory = new Table(); htmlWriter(tblGroupCategory, "header", row.CurrFormatCode, row.CurrTypeCode, row.MajorCode, row.CategoryCode, row.CourseGroupCode); //html += htmlTableHeader; htmlWriter(tblGroupCategory, "body", row.CurrFormatCode, row.CurrTypeCode, row.MajorCode, row.CategoryCode, row.CourseGroupCode); html += htmlTableBody; html += " </section>"; } html += " </div>"; html += " </div>"; html += " </div>"; } html += "</section>"; Label la = new Label(); la.Text = html; placeHTML.Controls.Add(la); }
//protected void btnNEXT_Click(object sender, EventArgs e) //{ // Response.RedirectPermanent("./addCURR_GEN_EDU1.aspx"); //} protected void btnNext_Click(object sender, EventArgs e) { if (rBtnNEW_CURR.Checked) { Response.Redirect("addCURR_GEN_EDU1.aspx"); } if (rBtnMINOR_MODI_CURR.Checked || rBtnMAJOR_MODI_CURR.Checked) { string sql = "Select * From CURRICULUM Where CURRCODE='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; List <TQF.Curriculum> curriculum = new TQF.Curriculum().getCurriculumManual(sql); //เช็คหลักสูตรซ้ำ if (curriculum.Count > 0) { btnNext.Visible = false; divError.Visible = true; } else { /////***STEP 1***///// string sqlCurriculumInsert = "Insert into CURRICULUM (CURRCODE,YEARVERSION) Values (" + txtCURR_CODE.Text + "," + txtCURR_YEAR_VERSION.Text + ")"; string insertCurriculum = new TQF.Curriculum().insertCurriculumManual(sqlCurriculumInsert); string sqlCurriculumUpdate = "Update CURRICULUM Set (LEVELCODE,FACULTYCODE,DEPARTMENTCODE,DIVISIONNO,CURRTHNAME,CURRENNAME,CURRSTATUS,APPROVESTATUS,BEGINYEAR,BEGINSEMESTER,DIPLOMACODE,NUMYEAR,MAXNUMYEAR,MAJORSTATUS,NUMTQF1,CURRSHORTTHNAME,CURRSHORTENNAME) = (Select LEVELCODE,FACULTYCODE,DEPARTMENTCODE,DIVISIONNO,CURRTHNAME,CURRENNAME,CURRSTATUS,APPROVESTATUS,BEGINYEAR,BEGINSEMESTER,DIPLOMACODE,NUMYEAR,MAXNUMYEAR,MAJORSTATUS,NUMTQF1,CURRSHORTTHNAME,CURRSHORTENNAME From CURRICULUM Where CURRCODE='" + ddlCOPY_CURR_CODE.SelectedValue + "' And YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "') Where CURRCODE='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string updateCurriculum = new TQF.Curriculum().updateCurriculumManual(sqlCurriculumUpdate); TQF.Curriculum curriculumData = new TQF.Curriculum().getCurriculum(txtCURR_CODE.Text, txtCURR_YEAR_VERSION.Text); /////---> ชื่อหลักสูตร, ชื่อย่อหลักสูตร, ชื่อเต็มปริญญา, ชื่อย่อปริญญา Diploma diploma = new Diploma().getDiploma(curriculumData.DiplomaCode); Diploma diplomaData = new Diploma(); diplomaData.YearVersion = txtCURR_YEAR_VERSION.Text; diplomaData.DiplomaCode = new TQF.TQFUtility().getMaxID("DIPLOMACODE", "DIPLOMA"); diplomaData.CurrCode = txtCURR_CODE.Text; diplomaData.DomainThName = diploma.DomainThName; diplomaData.DomainEnName = diploma.DomainEnName; diplomaData.DomainThShortName = diploma.DomainThShortName; diplomaData.DomainEnShortName = diploma.DomainEnShortName; string insertDiploma = new Diploma().insertDiploma(diplomaData); /////<--- /////---> สาขาวิชา //เรียกดูค่า DivisionNo ก่อน Insert ลงตาราง CURRICULUM string sqlDivisionExtension = "Select * From DIVISIONEXTENSION Where CURRCODE='" + ddlCOPY_CURR_CODE.SelectedValue + "' And YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "'"; List <DivisionExtension> DivisionNoList = new DivisionExtension().getDivisionExtensionManual(sqlDivisionExtension); int DivisionNo = int.Parse(new TQF.TQFUtility().getMaxID("DIVISIONNO", "DIVISIONEXTENSION")); foreach (DivisionExtension li in DivisionNoList) { DivisionExtension row = new DivisionExtension(); row.CurrCode = txtCURR_CODE.Text; row.YearVersion = txtCURR_YEAR_VERSION.Text; row.DivisionNo = DivisionNo.ToString();; row.DivisionCode = li.DivisionCode; string insertDivisionExtension = new DivisionExtension().insertDivisionExtension(row); if (insertDivisionExtension == "Success") { continue; } else { string sql2 = "Delete From DIVISIONEXTENSION Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteDivisionExtension = new DivisionExtension().deleteDivisionExtensionMaual(sql2); Response.Redirect("Faculty_add_CURR0.aspx"); } } /////<--- /////---> อาจารย์ประจำหลักสูตร string sqlAboutLecturer = "Select * From ABOUTLECTURER Where CURRCODE='" + ddlCOPY_CURR_CODE.SelectedValue + "' And YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "'"; List <AboutLecturer> aboutLecturer2 = new AboutLecturer().getAboutLecturerManual(sqlAboutLecturer); foreach (AboutLecturer li in aboutLecturer2) { int sequence = int.Parse(new TQF.TQFUtility().getMaxID("SEQUENCE", "ABOUTLECTURER")); AboutLecturer aboutlecturer = new AboutLecturer(); aboutlecturer.CurrCode = txtCURR_CODE.Text; aboutlecturer.YearVersion = txtCURR_YEAR_VERSION.Text; aboutlecturer.LectIdentity = li.LectIdentity; aboutlecturer.LoadTypeCode = li.LoadTypeCode; //1 = อาจารย์ประจำหลักสูตร (ข้อมูลจากตาราง LoadType) aboutlecturer.Sequence = sequence.ToString(); aboutlecturer.MajorCode = li.MajorCode; string insertAboutlecturer = new AboutLecturer().insertAboutLecturer(aboutlecturer); if (insertAboutlecturer == "Success") { continue; } else { string sqlDeleteAboutLecturer = "Delete From ABOUTLECTURER Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteAboutLecturer = new AboutLecturer().deleteAboutLecturerManual(sqlDeleteAboutLecturer); Response.Redirect("Faculty_add_CURR0.aspx"); } } /////<--- //Update สุดท้าย string sqlCurriculumUpdate2 = "Update CURRICULUM Set DIVISIONNO='" + DivisionNo.ToString() + "', APPROVESTATUS='N', BEGINYEAR='" + txtCURR_YEAR_VERSION.Text + "',DIPLOMACODE='" + diplomaData.DiplomaCode + "' Where CURRCODE='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string updateCurriculum2 = new TQF.Curriculum().updateCurriculumManual(sqlCurriculumUpdate2); /////***STEP 1_1***///// /////---> แขนงวิชา string sqlMajor = "Select * From MAJOR Where CURRCODE='" + ddlCOPY_CURR_CODE.SelectedValue + "' And YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "'"; List <TQF.Major> majorList = new TQF.Major().getMajorManual(sqlMajor); foreach (TQF.Major rowMajor in majorList) { //เก็บข้อมูลแขนงวิชาลงตาราง Major TQF.Major major = new TQF.Major(); major.MajorCode = rowMajor.MajorCode; major.MajorThName = rowMajor.MajorThName; major.MajorEnName = rowMajor.MajorEnName; major.CurrCode = txtCURR_CODE.Text; major.YearVersion = txtCURR_YEAR_VERSION.Text; string insertMajor = new TQF.Major().insertMajor(major); if (insertMajor == "Success") { continue; } else { string sqlDeleteMajor = "Delete From MAJOR Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteMajor = new TQF.Major().deleteMajorManual(sqlDeleteMajor); Response.Redirect("Faculty_add_CURR0.aspx"); } } /////<--- /////***STEP 2***///// /////---> มาตรฐานผลการเรียนรู้ string sqlTQF2Sec4Sub1 = "Select * From TQF2SEC4SUB1 Where CURRCODE='" + ddlCOPY_CURR_CODE.SelectedValue + "' And YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "'"; List <TQF2Sec4Sub1> tqf2Sec4Sub1 = new TQF2Sec4Sub1().getTQF2Sec4Sub1Manual(sqlTQF2Sec4Sub1); foreach (TQF2Sec4Sub1 rowTQF2Sec4Sub1 in tqf2Sec4Sub1) { TQF2Sec4Sub1 data = new TQF2Sec4Sub1(); data.T2S4Sub1No = new TQF.TQFUtility().getMaxID("T2S4SUB1NO", "TQF2SEC4SUB1"); data.CurrCode = txtCURR_CODE.Text; data.DomainTypeCode = rowTQF2Sec4Sub1.DomainTypeCode; data.DetailType = rowTQF2Sec4Sub1.DetailType; data.Detail = rowTQF2Sec4Sub1.Detail; data.YearVersion = txtCURR_YEAR_VERSION.Text; string insertTQF2Sec4Sub1 = new TQF2Sec4Sub1().insertTQF2Sec4Sub1(data); if (insertTQF2Sec4Sub1 == "Success") { continue; } else { string sqlDeleteTQF2Sec4Sub1 = "Delete From TQF2SEC4SUB1 Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteTQF2Sec4Sub1 = new TQF2Sec4Sub1().deleteTQF2Sec4Sub1Manual(sqlDeleteTQF2Sec4Sub1); Response.Redirect("Faculty_add_CURR0.aspx"); } } /////<--- /////***STEP 3***///// /////---> โครงสร้างหลักสูตร string sqlStructurePlan = "Select * From STRUCTUREPLAN Where CURRCODE='" + ddlCOPY_CURR_CODE.SelectedValue + "' And YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "'"; List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sqlStructurePlan); if (dataStructurePlan.Count > 0) { foreach (StructurePlan data in dataStructurePlan) { StructurePlan structurePlanData = new StructurePlan(); structurePlanData.CurrCode = txtCURR_CODE.Text; structurePlanData.YearVersion = txtCURR_YEAR_VERSION.Text; structurePlanData.CurrFormatCode = data.CurrFormatCode; structurePlanData.CurrTypeCode = data.CurrTypeCode; structurePlanData.MajorCode = data.MajorCode; structurePlanData.StructureType = data.StructureType; structurePlanData.TotalCredits = data.TotalCredits; string insertStructurePlan = new StructurePlan().insertStructurePlan(structurePlanData); if (insertStructurePlan == "Success") { continue; } else { string sqlDeleteStructurePlan = "Delete From TQF2SEC4SUB1 Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteStructurePlan = new StructurePlan().deleteStructurePlanManual(sqlDeleteStructurePlan); Response.Redirect("Faculty_add_CURR0.aspx"); } } } /////<--- /////***STEP 4***///// /////---> หมวดวิชา string sqlTQF2Sec3StructureCategory = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + ddlCOPY_CURR_CODE.SelectedValue + "' And YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "'"; List <TQF2Sec3StructureCategory> tqf2s3StructureCategory = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sqlTQF2Sec3StructureCategory); foreach (TQF2Sec3StructureCategory row in tqf2s3StructureCategory) { TQF2Sec3StructureCategory summaryData = new TQF2Sec3StructureCategory(); summaryData.CurrCode = txtCURR_CODE.Text; summaryData.YearVersion = txtCURR_YEAR_VERSION.Text; summaryData.CurrFormatCode = row.CurrFormatCode; summaryData.CurrTypeCode = row.CurrTypeCode; summaryData.MajorCode = row.MajorCode; summaryData.CategoryCode = row.CategoryCode; summaryData.CategoryCredits = row.CategoryCredits; string insertTQF2Sec3StructureCategory = new TQF2Sec3StructureCategory().insertTQF2Sec3StructureCategory(summaryData); if (insertTQF2Sec3StructureCategory == "Success") { continue; } else { string sqlDeleteStructureCategory = "Delete From TQF2SEC3STRUCTURECATEGORY Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteTQF2Sec3StructureCategory = new TQF2Sec3StructureCategory().deleteTQF2Sec3StructureCategoryManual(sqlDeleteStructureCategory); Response.Redirect("Faculty_add_CURR0.aspx"); } } /////<--- /////***STEP 5***///// /////---> กลุ่มวิชา string sqlTQF2Sec3StructureGroup = "Select * From TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + ddlCOPY_CURR_CODE.SelectedValue + "' And YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "'"; List <TQF2Sec3StructureGroup> tqf2Sec3StructureGroup = new TQF2Sec3StructureGroup().getTQF2Sec3StructureGroupManual(sqlTQF2Sec3StructureGroup); foreach (TQF2Sec3StructureGroup row in tqf2Sec3StructureGroup) { TQF2Sec3StructureGroup dataInsert = new TQF2Sec3StructureGroup(); dataInsert.CurrCode = txtCURR_CODE.Text;; dataInsert.YearVersion = txtCURR_YEAR_VERSION.Text; dataInsert.CurrFormatCode = row.CurrFormatCode; dataInsert.CurrTypeCode = row.CurrTypeCode; dataInsert.MajorCode = row.MajorCode; dataInsert.CategoryCode = row.CategoryCode; dataInsert.CourseGroupCode = row.CourseGroupCode; dataInsert.GroupCredits = row.GroupCredits; dataInsert.CourseGroupFlag = row.CourseGroupFlag; string insertTQF2Sec3StructureGroup = new TQF2Sec3StructureGroup().insertTQF2Sec3StructureGroup(dataInsert); if (insertTQF2Sec3StructureGroup == "Success") { continue; } else { string sqlDeleteStructureGroup = "Delete From TQF2SEC3STRUCTUREGROUP Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteTQF2Sec3StructureGroup = new TQF2Sec3StructureGroup().deleteTQF2Sec3StructureGroupManual(sqlDeleteStructureGroup); Response.Redirect("Faculty_add_CURR0.aspx"); } } /////<--- /////***STEP 5_1***///// /////---> กลุ่มวิชา string sqlTqf2Sec3StructureType = "Select * From TQF2SEC3STRUCTURETYPE Where CURRCODE='" + ddlCOPY_CURR_CODE.SelectedValue + "' And YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "'"; List <Tqf2Sec3StructureType> tqf2Sec3StructureType = new Tqf2Sec3StructureType().getTqf2Sec3StructureTypeManual(sqlTqf2Sec3StructureType); foreach (Tqf2Sec3StructureType row in tqf2Sec3StructureType) { Tqf2Sec3StructureType dataInsert = new Tqf2Sec3StructureType(); dataInsert.CurrCode = txtCURR_CODE.Text; dataInsert.YearVersion = txtCURR_YEAR_VERSION.Text; dataInsert.CurrFormatCode = row.CurrFormatCode; dataInsert.CurrTypeCode = row.CurrTypeCode; dataInsert.MajorCode = row.MajorCode; dataInsert.CategoryCode = row.CategoryCode; dataInsert.CourseGroupCode = row.CourseGroupCode; dataInsert.CourseTypeCode = row.CourseTypeCode; dataInsert.TypeCredits = row.TypeCredits; string insertTqf2Sec3StructureType = new Tqf2Sec3StructureType().insertTqf2Sec3StructureType(dataInsert); if (insertTqf2Sec3StructureType == "Success") { continue; } else { string sqlDeleteStructureType = "Delete From TQF2SEC3STRUCTURETYPE Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteTqf2Sec3StructureType = new Tqf2Sec3StructureType().deleteTqf2Sec3StructureTypeManual(sqlDeleteStructureType); Response.Redirect("Faculty_add_CURR0.aspx"); } } /////<--- /////***STEP 6***///// /////---> รายวิชา string sqlTQF2Sec3PlanDetail = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + ddlCOPY_CURR_CODE.SelectedValue + "' And YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "'"; List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sqlTQF2Sec3PlanDetail); foreach (TQF2Sec3PlanDetail row in tqf2Sec3PlanDetail) { TQF2Sec3PlanDetail dataInsert = new TQF2Sec3PlanDetail(); dataInsert.T2S3No = new TQF.TQFUtility().getMaxID("T2S3NO", "TQF2SEC3PLANDETAIL"); dataInsert.CurrCode = txtCURR_CODE.Text; dataInsert.YearVersion = txtCURR_YEAR_VERSION.Text; dataInsert.CurrFormatCode = row.CurrFormatCode; dataInsert.CurrTypeCode = row.CurrTypeCode; dataInsert.MajorCode = row.MajorCode; dataInsert.CourseGroupCode = row.CourseGroupCode; dataInsert.CategoryCode = row.CategoryCode; dataInsert.CourseTypeCode = row.CourseTypeCode; dataInsert.CourseCode = row.CourseCode; dataInsert.EducationYear = row.EducationYear; dataInsert.EducationSemester = row.EducationSemester; string insertTQF2Sec3PlanDetail = new TQF2Sec3PlanDetail().insertTQF2Sec3PlanDetail(dataInsert); if (insertTQF2Sec3PlanDetail == "Success") { continue; } else { string sqlDeletePlanDetail = "Delete From TQF2SEC3PLANDETAIL Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteTQF2Sec3PlanDetail = new TQF2Sec3PlanDetail().deleteTQF2Sec3PlanDetailManual(sqlDeletePlanDetail); Response.Redirect("Faculty_add_CURR0.aspx"); } } /////<--- /////***STEP 7***///// /////---> กำหนด Curriculum Mapping string sqlTQF2Sec4CurriculumMapping = "Select * From TQF2SEC4CURRICULUMMAPPING Where CURRCODE='" + ddlCOPY_CURR_CODE.SelectedValue + "' And YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "'"; List <TQF2Sec4CurriculumMapping> tqf2Sec4CurriculumMapping = new TQF2Sec4CurriculumMapping().getTQF2Sec4CurriculumMappingManual(sqlTQF2Sec4CurriculumMapping); foreach (TQF2Sec4CurriculumMapping row in tqf2Sec4CurriculumMapping) { TQF2Sec4CurriculumMapping tqf2Sec4CurriculumMappingData = new TQF2Sec4CurriculumMapping(); tqf2Sec4CurriculumMappingData.CurrCode = txtCURR_CODE.Text; tqf2Sec4CurriculumMappingData.CourseCode = row.CourseCode; tqf2Sec4CurriculumMappingData.DomainTypeCode = row.DomainTypeCode; tqf2Sec4CurriculumMappingData.ResponseStatus = row.ResponseStatus; tqf2Sec4CurriculumMappingData.YearVersion = txtCURR_YEAR_VERSION.Text; tqf2Sec4CurriculumMappingData.T2S4Sub1No = row.T2S4Sub1No; string insertCurriculumMapping = new TQF2Sec4CurriculumMapping().insertTQF2Sec4CurriculumMapping(tqf2Sec4CurriculumMappingData); if (insertCurriculumMapping == "Success") { continue; } else { string sqlDeleteCurriculumMapping = "Delete From TQF2SEC4CURRICULUMMAPPING Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteTQF2Sec4CurriculumMapping = new TQF2Sec4CurriculumMapping().deleteTQF2Sec4CurriculumMappingManual(sqlDeleteCurriculumMapping); Response.Redirect("Faculty_add_CURR0.aspx"); } } /////<--- /////***STEP 8***///// /////---> กำหนดแผนการศึกษา string sqlTQF2Sec3SemesterPlan = "Select * From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + ddlCOPY_CURR_CODE.SelectedValue + "' And YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "'"; List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan = new TQF2Sec3SemesterPlan().getTQF2Sec3SemesterPlanManual(sqlTQF2Sec3SemesterPlan); foreach (TQF2Sec3SemesterPlan row in tqf2Sec3SemesterPlan) { TQF2Sec3SemesterPlan dataInsert = new TQF2Sec3SemesterPlan(); dataInsert.CurrCode = txtCURR_CODE.Text; dataInsert.YearVersion = txtCURR_YEAR_VERSION.Text; dataInsert.CurrFormatCode = row.CurrFormatCode; dataInsert.CurrTypeCode = row.CurrTypeCode; dataInsert.MajorCode = row.MajorCode; dataInsert.CourseCode = row.CourseCode; dataInsert.EducationYear = row.EducationYear; dataInsert.EducationSemester = row.EducationSemester; string insertTQF2Sec3SemesterPlan = new TQF2Sec3SemesterPlan().insertTQF2Sec3SemesterPlan(dataInsert); if (insertTQF2Sec3SemesterPlan == "Success") { continue; } else { string sqlDeleteTQF2Sec3SemesterPlan = "Delete From TQF2SEC3SEMESTERPLAN Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteTQF2Sec3SemesterPlan = new TQF2Sec3SemesterPlan().deleteTQF2Sec3SemesterPlanManual(sqlDeleteTQF2Sec3SemesterPlan); Response.Redirect("Faculty_add_CURR0.aspx"); } } /////<--- //สร้าง session CurrCode ไว้ใช้สำหรับทุกหน้าในการสร้างหลักสูตร Session["CurrCode"] = curriculumData.CurrCode; Session["YearVersion"] = curriculumData.YearVersion; Session["NumTQF1"] = curriculumData.NumTQF1; Response.Redirect("Faculty_edit_CURR.aspx?CurrCode=" + curriculumData.CurrCode + "&YearVersion=" + curriculumData.YearVersion); } } }
protected void htmlGenerateTab3(string MajorCode, string CurrFormatCode, string TotalCredits, string YearVersion, string CurrTypeCode) { string html = ""; html += "<table class=\"table-curr\">"; html += "<tr>"; Label lblPlanTitle = new Label(); lblPlanTitle.Text = new CurrType().getCurrType(CurrTypeCode).CurrTypeName + " แขนงวิชา" + new TQF.Major().getMajor(MajorCode).MajorThName; html += "<th>หลักสูตร " + lblPlanTitle.Text + "</th>"; html += "<th></th>"; html += "<th></th>"; html += "</tr>"; Label label7 = new Label(); label7.Text = new StructurePlan().getTotalCreditsStructurePlan(CurrCode, YearVersion, CurrFormatCode, CurrTypeCode, MajorCode).TotalCredits; html += "</table>"; html += "<div class=\"box-group-data\">"; html += "<table class=\"table-curr\">"; //<!-- 1. หมวดวิชาศึกษาทั่วไป --> string sqlTQF2Sec3StructureCategory = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'"; List <TQF2Sec3StructureCategory> TQF2Sec3StructureCategory = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sqlTQF2Sec3StructureCategory); int i = 0; foreach (TQF2Sec3StructureCategory data in TQF2Sec3StructureCategory) { i++; Label label1 = new Label(); Label label2 = new Label(); label1.Text = new Category().getCategory(data.CategoryCode).CategoryThName; label2.Text = data.CategoryCredits; html += "<tr>"; html += "<th><span class=\"report-indent-1em\">" + i + ") " + label1.Text + "</span></th>"; html += "<th>" + label2.Text + "</th>"; html += "<th>หน่วยกิต</th>"; html += "</tr>"; //กลุ่มวิชาสังคมศาสตร์ string sqlTQF2Sec3StructureGroup = "Select * From TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + data.CurrCode + "' And YEARVERSION='" + data.YearVersion + "' And CURRFORMATCODE='" + data.CurrFormatCode + "' And CURRTYPECODE='" + data.CurrTypeCode + "' And MAJORCODE='" + data.MajorCode + "' And CATEGORYCODE='" + data.CategoryCode + "'"; List <TQF2Sec3StructureGroup> TQF2Sec3StructureGroup = new TQF2Sec3StructureGroup().getTQF2Sec3StructureGroupManual(sqlTQF2Sec3StructureGroup); foreach (TQF2Sec3StructureGroup row in TQF2Sec3StructureGroup) { Label label3 = new Label(); Label label4 = new Label(); label3.Text = new CourseGroup().getCourseGroup(row.CourseGroupCode).CourseGroupThName; label4.Text = row.GroupCredits; html += "<tr>"; html += "<th><span class=\"report-indent-2em\">" + label3.Text + "</span></th>"; html += "<th>" + label4.Text + "</th>"; html += "<th>หน่วยกิต</th>"; html += "</tr>"; //วิชาเลือก string sqlTqf2Sec3StructureType = "Select * From TQF2SEC3STRUCTURETYPE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + row.CategoryCode + "' And COURSEGROUPCODE='" + row.CourseGroupCode + "'"; List <Tqf2Sec3StructureType> Tqf2Sec3StructureType = new Tqf2Sec3StructureType().getTqf2Sec3StructureTypeManual(sqlTqf2Sec3StructureType); foreach (Tqf2Sec3StructureType row2 in Tqf2Sec3StructureType) { Label label5 = new Label(); Label label6 = new Label(); label5.Text = new CourseSubjectType().getCourseSubjectType(row2.CourseTypeCode).CourseTypeThaiName; label6.Text = row2.TypeCredits; html += "<tr>"; html += "<th><span class=\"report-indent-3em\">" + label5.Text + "</span></th>"; html += "<th>" + label6.Text + "</th>"; html += "<th>หน่วยกิต</th>"; html += "</tr>"; html += "<tr><td colspan=3>"; html += "<table width=100%>"; Table tblGroupCategory = new Table(); tblGroupCategory.Attributes.Add("class", "table-course"); //Body Table string sqlPlan = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + row2.CourseGroupCode + "' And CATEGORYCODE='" + row2.CategoryCode + "' And COURSETYPECODE='" + row2.CourseTypeCode + "' Order By COURSECODE"; List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sqlPlan); foreach (TQF2Sec3PlanDetail row3 in tqf2Sec3PlanDetail) { TQF.Course course = new TQF.Course().getCourse(row3.CourseCode); CourseElective courseElective = new CourseElective().getCourseElective(row3.CourseCode); html += "<tr>"; html += "<td class=\"text-align-left\" width=10%>" + row3.CourseCode + "</td>"; html += "<td class=\"text-align-left\" width=80%>" + course.CourseThName + courseElective.CourseElectiveThName + "<br>" + course.CourseEnName + courseElective.CourseElectiveEnName + "</td>"; html += "<td width=10%>" + course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")" + "</td>"; html += "</tr>"; } html += "</table>"; html += "</td></tr>"; } } } html += "</table>"; html += "</div>"; Label lblHTML3 = new Label(); lblHTML3.Text = html; placeHTML3.Controls.Add(lblHTML3); }
protected void tableBody(Table tblName, string CurrFormatCode, string MajorCode, string CurrTypeCode) { totalCredit = 0; string sql = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "'And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'"; List <TQF2Sec3StructureCategory> tqf2s3StructureCategory = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sql); foreach (TQF2Sec3StructureCategory row in tqf2s3StructureCategory) { totalCredit += int.Parse(row.CategoryCredits); TableRow tRowBody = new TableRow(); tRowBody.TableSection = TableRowSection.TableBody; TableCell cellCategoryName = new TableCell(); cellCategoryName.Text = new Category().getCategory(row.CategoryCode).CategoryThName; tRowBody.Cells.Add(cellCategoryName); TableCell cellNumCredit = new TableCell(); cellNumCredit.Text = row.CategoryCredits; cellNumCredit.Width = 50; tRowBody.Cells.Add(cellNumCredit); TableCell cellDel = new TableCell(); string urlDel = "delete_CURR4.aspx?CurrCode=" + CurrCode + "&YearVersion=" + YearVersion + "&CurrFormatCode=" + CurrFormatCode + "&CurrTypeCode=" + row.CurrTypeCode + "&MajorCode=" + row.MajorCode + "&CategoryCode=" + row.CategoryCode; HyperLink hypDel = new HyperLink(); hypDel.Attributes.Add("data-target", "#deleteCATEGORY"); hypDel.Attributes.Add("data-toggle", "modal"); hypDel.Text = "<h4><i class='fa fa-trash-o'></i></h4>"; hypDel.NavigateUrl = urlDel; hypDel.ToolTip = "Delete"; cellDel.Controls.Add(hypDel); cellDel.CssClass = "text-center"; cellDel.Width = 50; tRowBody.Cells.Add(cellDel); tblName.Rows.Add(tRowBody); } TableRow tRowBodyCredit = new TableRow(); tRowBodyCredit.TableSection = TableRowSection.TableBody; TableCell cellCategoryName1 = new TableCell(); cellCategoryName1.Text = "<strong>รวมหน่วยกิตทั้งหมด</strong>"; tRowBodyCredit.Cells.Add(cellCategoryName1); TableCell cellCategoryName2 = new TableCell(); cellCategoryName2.Text = "<strong>" + totalCredit.ToString() + "</strong>"; tRowBodyCredit.Cells.Add(cellCategoryName2); TableCell cellCategoryName3 = new TableCell(); cellCategoryName3.Text = ""; tRowBodyCredit.Cells.Add(cellCategoryName3); tblName.Rows.Add(tRowBodyCredit); }
protected void htmlGenerateTab2(string MajorCode, string CurrFormatCode, string TotalCredits, string YearVersion, string CurrTypeCode) { string html = ""; html += "<div class=\"row\" style=\"margin:0 10px\">"; html += "<div class=\"col col-10\">"; html += "<h3 class=\"txt-title-blue\">"; html += "<i class=\"fa fa-file-text-o\"></i> "; Label lblPlanTitle = new Label(); lblPlanTitle.Font.Bold = true; lblPlanTitle.Text = new CurrType().getCurrType(CurrTypeCode).CurrTypeName + " (แขนงวิชา " + new TQF.Major().getMajor(MajorCode).MajorThName + ")"; html += lblPlanTitle.Text; html += "</h3>"; html += "</div>"; html += "</div>"; html += "<div class=\"row\" style=\"margin: 0 10px\">"; html += "<div class=\"col col-10\">"; html += "<table class=\"table table-bordered\">"; string sql1 = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'"; List <TQF2Sec3StructureCategory> tqf2s3StructureCategory1 = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sql1); foreach (TQF2Sec3StructureCategory data in tqf2s3StructureCategory1) { Label label1 = new Label(); Label label2 = new Label(); label1.Text = new Category().getCategory(data.CategoryCode).CategoryThName; label2.Text = "<strong>" + data.CategoryCredits + "</strong> หน่วยกิต"; html += "<tr class=\"success\">"; html += "<td>" + label1.Text + "</td>"; html += "<td style=\"width: 150px\">" + label2.Text + "</td>"; html += "</tr>"; string sql2 = "Select * From TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + data.CurrCode + "' And YEARVERSION='" + data.YearVersion + "' And CURRFORMATCODE='" + data.CurrFormatCode + "' And CURRTYPECODE='" + data.CurrTypeCode + "' And MAJORCODE='" + data.MajorCode + "' And CATEGORYCODE='" + data.CategoryCode + "'"; List <TQF2Sec3StructureGroup> tqf2s3StructureGroup = new TQF2Sec3StructureGroup().getTQF2Sec3StructureGroupManual(sql2); foreach (TQF2Sec3StructureGroup row in tqf2s3StructureGroup) { Label label3 = new Label(); Label label4 = new Label(); label3.Text = new CourseGroup().getCourseGroup(row.CourseGroupCode).CourseGroupThName; label4.Text = "<strong>" + row.GroupCredits + "</strong> หน่วยกิต"; html += "<tr class=\"danger\">"; html += "<td style=\"text-indent: 30px\">" + label3.Text + "</td>"; html += "<td style=\"text-indent: 30px\">" + label4.Text + "</td>"; html += "</tr>"; string sql3 = "Select * From TQF2SEC3STRUCTURETYPE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + row.CategoryCode + "' And COURSEGROUPCODE='" + row.CourseGroupCode + "'"; List <Tqf2Sec3StructureType> tqf2Sec3StructureType = new Tqf2Sec3StructureType().getTqf2Sec3StructureTypeManual(sql3); foreach (Tqf2Sec3StructureType row2 in tqf2Sec3StructureType) { Label label5 = new Label(); Label label6 = new Label(); label5.Text = new CourseSubjectType().getCourseSubjectType(row2.CourseTypeCode).CourseTypeThaiName; label6.Text = "<strong>" + row2.TypeCredits + "</strong> หน่วยกิต"; html += "<tr>"; html += "<td style=\"text-indent: 50px\">" + label5.Text + "</td>"; html += "<td style=\"text-indent: 50px\">" + label6.Text + "</td>"; html += "</tr>"; } } } Label label7 = new Label(); label7.Text = new StructurePlan().getTotalCreditsStructurePlan(CurrCode, YearVersion, CurrFormatCode, CurrTypeCode, MajorCode).TotalCredits; html += "<tr class=\"info\">"; html += "<td class=\"text-right\"><strong>รวมตลอดหลักสูตร</strong></td>"; html += "<td><strong>" + label7.Text + " หน่วยกิต</strong></td>"; html += "</tr>"; html += "</table>"; html += "</div>"; html += "</div>"; Label lblHTML2 = new Label(); lblHTML2.Text = html; placeHTML2.Controls.Add(lblHTML2); }
protected void htmlGenerateTab3(string MajorCode, string CurrFormatCode, string TotalCredits, string YearVersion, string CurrTypeCode) { string html = ""; html += "<div class=\"row\" style=\"margin: 0 10px\">"; html += " <div class=\"col col-10\">"; html += " <h3 class=\"txt-title-blue\">"; html += " <i class=\"fa fa-file-text-o\"></i> "; Label lblPlanTitle = new Label(); lblPlanTitle.Font.Bold = true; lblPlanTitle.Text = new CurrType().getCurrType(CurrTypeCode).CurrTypeName + " (แขนงวิชา " + new TQF.Major().getMajor(MajorCode).MajorThName + ")"; html += lblPlanTitle.Text; html += " </h3>"; html += " </div>"; html += "</div>"; string sql = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'"; List <TQF2Sec3StructureCategory> tqf2s3StructureCategory = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sql); foreach (TQF2Sec3StructureCategory data in tqf2s3StructureCategory) { html += "<div class=\"row\" style=\"margin: 0 10px\">"; html += " <div class=\"col col-10\">"; html += " <p class=\"text-center\">"; Label label0 = new Label(); label0.Text = new Category().getCategory(data.CategoryCode).CategoryThName; html += "<span id=\"Label11\" class=\"label bg-color-teal\" style=\"font-weight: bold; font-size: 16px\">" + label0.Text + "</span>"; html += " </p>"; html += " </div>"; html += "</div>"; string sql2 = "Select * From TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + data.CurrCode + "' And YEARVERSION='" + data.YearVersion + "' And CURRFORMATCODE='" + data.CurrFormatCode + "' And CURRTYPECODE='" + data.CurrTypeCode + "' And MAJORCODE='" + data.MajorCode + "' And CATEGORYCODE='" + data.CategoryCode + "'"; List <TQF2Sec3StructureGroup> tqf2s3StructureCategory2 = new TQF2Sec3StructureGroup().getTQF2Sec3StructureGroupManual(sql2); foreach (TQF2Sec3StructureGroup rowGroup in tqf2s3StructureCategory2) { html += "<div class=\"row\" style=\"margin: 0 10px\">"; html += " <div class=\"col col-10\">"; html += " <p>"; Label label2 = new Label(); label2.Font.Bold = true; label2.Text = new CourseGroup().getCourseGroup(rowGroup.CourseGroupCode).CourseGroupThName; html += "<span id=\"Label9\" style=\"font-weight: bold;\">" + label2.Text + "</span>"; html += " </p>"; html += " </div>"; html += "</div>"; string sql3 = "Select * From TQF2SEC3STRUCTURETYPE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + rowGroup.CurrFormatCode + "' And CURRTYPECODE='" + rowGroup.CurrTypeCode + "' And MAJORCODE='" + rowGroup.MajorCode + "' And CATEGORYCODE='" + rowGroup.CategoryCode + "' And COURSEGROUPCODE='" + rowGroup.CourseGroupCode + "'"; List <Tqf2Sec3StructureType> tqf2Sec3StructureType = new Tqf2Sec3StructureType().getTqf2Sec3StructureTypeManual(sql3); foreach (Tqf2Sec3StructureType rowType in tqf2Sec3StructureType) { html += "<div class=\"row\" style=\"margin: 0 10px\">"; html += " <div class=\"col col-10\">"; html += " <p>"; Label label3 = new Label(); label3.Font.Bold = true; label3.Text = new CourseSubjectType().getCourseSubjectType(rowType.CourseTypeCode).CourseTypeThaiName; html += label3.Text; html += " </p>"; html += " </div>"; html += "</div>"; html += "<div class=\"row\" style=\"margin: 0 10px; padding-bottom: 20px\">"; html += " <div class=\"col col-10\">"; Table tblGroupCategory = new Table(); // Head Table string[] ar = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต" }; tblGroupCategory.Attributes.Add("class", "table table-striped tb-curr-plan"); TableHeaderRow tRowHead = new TableHeaderRow(); tRowHead.CssClass = "success"; tRowHead.TableSection = TableRowSection.TableHeader; for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++) { TableHeaderCell cellHead = new TableHeaderCell(); cellHead.Text = ar[cellCtr - 1]; if (cellCtr == 1 || cellCtr == 3) { cellHead.Width = 100; } tRowHead.Cells.Add(cellHead); } tblGroupCategory.Rows.Add(tRowHead); //Body Table string sqlPlan = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + rowType.CourseGroupCode + "' And CATEGORYCODE='" + rowType.CategoryCode + "' And COURSETYPECODE='" + rowType.CourseTypeCode + "' Order By COURSECODE"; List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sqlPlan); foreach (TQF2Sec3PlanDetail row in tqf2Sec3PlanDetail) { TQF.Course course = new TQF.Course().getCourse(row.CourseCode); CourseElective courseElective = new CourseElective().getCourseElectiveId(row.CourseCode); TableRow tRowBody = new TableRow(); tRowBody.TableSection = TableRowSection.TableBody; TableCell cellCourseCode = new TableCell(); //string urlShow = "showCOURSE.aspx?token=" + row.CourseCode; string urlShow = "showCOURSE.aspx?token=" + row.CourseCode + "&CurrCode=" + CurrCode + "&YearVersion=" + YearVersion; HyperLink hypShow = new HyperLink(); hypShow.Attributes.Add("data-target", "#course_desModal"); hypShow.Attributes.Add("data-toggle", "modal"); hypShow.Text = course.CourseCode + courseElective.CourseElectiveCode; //row.CourseCode; hypShow.NavigateUrl = urlShow; hypShow.ToolTip = "Course details"; cellCourseCode.Controls.Add(hypShow); cellCourseCode.CssClass = "text-center"; cellCourseCode.Width = 80; tRowBody.Cells.Add(cellCourseCode); TableCell cellNCourseThName = new TableCell(); cellNCourseThName.Text = course.CourseThName + courseElective.CourseElectiveThName + "<BR>"; cellNCourseThName.Text += course.CourseEnName + courseElective.CourseElectiveEnName; tRowBody.Cells.Add(cellNCourseThName); TableCell cellNumCredit = new TableCell(); cellNumCredit.Text = course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")"; cellNumCredit.Width = 100; tRowBody.Cells.Add(cellNumCredit); tblGroupCategory.Rows.Add(tRowBody); } StringWriter htmlString = new StringWriter(); tblGroupCategory.RenderControl(new HtmlTextWriter(htmlString)); string htmlTableBody = htmlString.ToString(); html += htmlTableBody; html += "</div>"; html += "</div>"; } } } Label lblHTML3 = new Label(); lblHTML3.Text = html; placeHTML3.Controls.Add(lblHTML3); }
protected void htmlGenerateTab2(string MajorCode, string CurrFormatCode, string TotalCredits, string YearVersion, string CurrTypeCode) { Tab2No++; string html = ""; html += "<table class=\"table-curr\">"; html += "<tr>"; Label lblPlanTitle = new Label(); lblPlanTitle.Text = new CurrType().getCurrType(CurrTypeCode).CurrTypeName + " แขนงวิชา" + new TQF.Major().getMajor(MajorCode).MajorThName; html += "<th>" + Tab2No + ". หลักสูตร " + lblPlanTitle.Text + "</th>"; html += "<th></th>"; html += "<th></th>"; html += "</tr>"; Label label7 = new Label(); label7.Text = new StructurePlan().getTotalCreditsStructurePlan(CurrCode, YearVersion, CurrFormatCode, CurrTypeCode, MajorCode).TotalCredits; html += "<tr>"; html += "<th><span class=\"report-indent-1em\">" + Tab2No + ".1 จำนวนหน่วยกิตตลอดหลักสูตร</span></th>"; html += "<th>" + label7.Text + "</th>"; html += "<th>หน่วยกิต</th>"; html += "</tr>"; html += "<tr>"; html += "<th><span class=\"report-indent-1em\">" + Tab2No + ".2 โครงสร้างหลักสูตร</span></th>"; html += "<th></th>"; html += "<th></th>"; html += "</tr>"; html += "</table>"; html += "<div class=\"box-group-data\">"; html += "<table class=\"table-curr\">"; //<!-- 1. หมวดวิชาศึกษาทั่วไป --> string sqlTQF2Sec3StructureCategory = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'"; List <TQF2Sec3StructureCategory> TQF2Sec3StructureCategory = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sqlTQF2Sec3StructureCategory); int i = 0; foreach (TQF2Sec3StructureCategory data in TQF2Sec3StructureCategory) { i++; Label label1 = new Label(); Label label2 = new Label(); label1.Text = new Category().getCategory(data.CategoryCode).CategoryThName; label2.Text = data.CategoryCredits; html += "<tr>"; html += "<th><span class=\"report-indent-2em\">" + i + ") " + label1.Text + "</span></th>"; html += "<th>" + label2.Text + "</th>"; html += "<th>หน่วยกิต</th>"; html += "</tr>"; //กลุ่มวิชาสังคมศาสตร์ string sqlTQF2Sec3StructureGroup = "Select * From TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + data.CurrCode + "' And YEARVERSION='" + data.YearVersion + "' And CURRFORMATCODE='" + data.CurrFormatCode + "' And CURRTYPECODE='" + data.CurrTypeCode + "' And MAJORCODE='" + data.MajorCode + "' And CATEGORYCODE='" + data.CategoryCode + "'"; List <TQF2Sec3StructureGroup> TQF2Sec3StructureGroup = new TQF2Sec3StructureGroup().getTQF2Sec3StructureGroupManual(sqlTQF2Sec3StructureGroup); foreach (TQF2Sec3StructureGroup row in TQF2Sec3StructureGroup) { Label label3 = new Label(); Label label4 = new Label(); label3.Text = new CourseGroup().getCourseGroup(row.CourseGroupCode).CourseGroupThName; label4.Text = row.GroupCredits; html += "<tr>"; html += "<td><span class=\"report-indent-3em\">" + label3.Text + "</span></td>"; html += "<td>" + label4.Text + "</td>"; html += "<td>หน่วยกิต</td>"; html += "</tr>"; //วิชาเลือก string sqlTqf2Sec3StructureType = "Select * From TQF2SEC3STRUCTURETYPE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + row.CategoryCode + "' And COURSEGROUPCODE='" + row.CourseGroupCode + "'"; List <Tqf2Sec3StructureType> Tqf2Sec3StructureType = new Tqf2Sec3StructureType().getTqf2Sec3StructureTypeManual(sqlTqf2Sec3StructureType); foreach (Tqf2Sec3StructureType row2 in Tqf2Sec3StructureType) { Label label5 = new Label(); Label label6 = new Label(); label5.Text = new CourseSubjectType().getCourseSubjectType(row2.CourseTypeCode).CourseTypeThaiName; label6.Text = row2.TypeCredits; html += "<tr>"; html += "<td><span class=\"report-indent-4em\">" + label5.Text + "</span></td>"; html += "<td>" + label6.Text + "</td>"; html += "<td>หน่วยกิต</td>"; html += "</tr>"; } } } html += "</table>"; html += "</div>"; Label lblHTML2 = new Label(); lblHTML2.Text = html; placeHTML2.Controls.Add(lblHTML2); }