/// <summary> /// เรียกผลรวมหน่วยกิตจากตาราง TQF2SEC3STRUCTURETYPE /// </summary> /// <param name="summaryData">Tqf2Sec3StructureType Object</param> /// <returns></returns> public int getSumStructureType(Tqf2Sec3StructureType summaryData) { int summary = 0; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = "select SUM(TYPECREDITS) As SUMCREDITS from TQF2SEC3STRUCTURETYPE Where CURRCODE='" + summaryData.CurrCode + "' And YEARVERSION='" + summaryData.YearVersion + "' And CURRFORMATCODE='" + summaryData.CurrFormatCode + "' And CURRTYPECODE='" + summaryData.CurrTypeCode + "' And MAJORCODE='" + summaryData.MajorCode + "' And CATEGORYCODE='" + summaryData.CategoryCode + "' And COURSEGROUPCODE='" + summaryData.CourseGroupCode + "'"; try { DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { 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> /// เรียกดูข้อมูลจากตาราง TQF2SEC3STRUCTURETYPE /// </summary> /// <param name="CurrCode">รหัสหลักสูตร(Curriculum)</param> /// <returns>ข้อมูลจากตาราง TQF2SEC3STRUCTURETYPE</returns> public Tqf2Sec3StructureType getTqf2Sec3StructureType(string CurrCode) { Tqf2Sec3StructureType Tqf2Sec3StructureTypeData = new Tqf2Sec3StructureType(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = "Select * From TQF2SEC3STRUCTURETYPE Where CURRCODE='" + CurrCode + "'"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { Tqf2Sec3StructureTypeData.CurrCode = rowData["CURRCODE"].ToString(); Tqf2Sec3StructureTypeData.YearVersion = rowData["YEARVERSION"].ToString(); Tqf2Sec3StructureTypeData.CurrFormatCode = rowData["CURRFORMATCODE"].ToString(); Tqf2Sec3StructureTypeData.CurrTypeCode = rowData["CURRTYPECODE"].ToString(); Tqf2Sec3StructureTypeData.MajorCode = rowData["MAJORCODE"].ToString(); Tqf2Sec3StructureTypeData.CategoryCode = rowData["CATEGORYCODE"].ToString(); Tqf2Sec3StructureTypeData.CourseGroupCode = rowData["COURSEGROUPCODE"].ToString(); Tqf2Sec3StructureTypeData.CourseTypeCode = rowData["COURSETYPECODE"].ToString(); Tqf2Sec3StructureTypeData.TypeCredits = rowData["TYPECREDITS"].ToString(); } return(Tqf2Sec3StructureTypeData); }
/// <summary> /// แก้ไขข้อมูลจากตาราง TQF2SEC3STRUCTURETYPE /// </summary> /// <param name="updateData">Tqf2Sec3StructureType Object</param> /// <returns>Success</returns> public string updateTqf2Sec3StructureType(Tqf2Sec3StructureType updateData) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); string sql = "Update TQF2SEC3STRUCTURETYPE Set COURSETYPECODE = '" + updateData.CourseTypeCode + "', TYPECREDITS='" + updateData.TypeCredits + "'Where CURRCODE = '" + updateData.CurrCode + "' And YEARVERSION = '" + updateData.YearVersion + "' And CURRFORMATCODE = '" + updateData.CurrFormatCode + "' And CURRTYPECODE = '" + updateData.CurrTypeCode + "' And MAJORCODE = '" + updateData.MajorCode + "' And CATEGORYCODE = '" + updateData.CategoryCode + "' And COURSEGROUPCODE = '" + updateData.CourseGroupCode + "'"; oracleObj.UpdateCommand = sql; try { if (oracleObj.Update() == 1) { response = "Success"; } } catch (Exception e) { string exception = e.Message; HttpContext.Current.Session["response"] = "updateTqf2Sec3StructureType: " + exception; HttpContext.Current.Response.Redirect("../err_response.aspx"); } return(response); }
/// <summary> /// เพิ่มข้อมูลลงตาราง TQF2SEC3STRUCTURETYPE /// </summary> /// <param name="dataInsert">Tqf2Sec3StructureType Object</param> /// <returns>Success</returns> public string insertTqf2Sec3StructureType(Tqf2Sec3StructureType dataInsert) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); string sql = "Insert into TQF2SEC3STRUCTURETYPE (CURRCODE,YEARVERSION,CURRFORMATCODE,CURRTYPECODE,MAJORCODE,CATEGORYCODE,COURSEGROUPCODE,COURSETYPECODE,TYPECREDITS) values ('" + dataInsert.CurrCode + "','" + dataInsert.YearVersion + "','" + dataInsert.CurrFormatCode + "','" + dataInsert.CurrTypeCode + "','" + dataInsert.MajorCode + "','" + dataInsert.CategoryCode + "','" + dataInsert.CourseGroupCode + "','" + dataInsert.CourseTypeCode + "','" + dataInsert.TypeCredits + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "Success"; } } catch (Exception e) { string exception = e.Message; HttpContext.Current.Session["response"] = "insertTqf2Sec3StructureType: " + exception; HttpContext.Current.Response.Redirect("../err_response.aspx"); } return(response); }
/// <summary> /// เรียกดูข้อมูลจากตาราง TQF2SEC3STRUCTURETYPE /// </summary> /// <param name="sql">SQL Command</param> /// <returns>ข้อมูลจากตาราง TQF2SEC3STRUCTURETYPE</returns> public List <Tqf2Sec3StructureType> getTqf2Sec3StructureTypeManual(string sql) { List <Tqf2Sec3StructureType> Tqf2Sec3StructureTypeData = new List <Tqf2Sec3StructureType>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { Tqf2Sec3StructureType Tqf2Sec3StructureTypeRow = new Tqf2Sec3StructureType(); Tqf2Sec3StructureTypeRow.CurrCode = rowData["CURRCODE"].ToString(); Tqf2Sec3StructureTypeRow.YearVersion = rowData["YEARVERSION"].ToString(); Tqf2Sec3StructureTypeRow.CurrFormatCode = rowData["CURRFORMATCODE"].ToString(); Tqf2Sec3StructureTypeRow.CurrTypeCode = rowData["CURRTYPECODE"].ToString(); Tqf2Sec3StructureTypeRow.MajorCode = rowData["MAJORCODE"].ToString(); Tqf2Sec3StructureTypeRow.CategoryCode = rowData["CATEGORYCODE"].ToString(); Tqf2Sec3StructureTypeRow.CourseGroupCode = rowData["COURSEGROUPCODE"].ToString(); Tqf2Sec3StructureTypeRow.CourseTypeCode = rowData["COURSETYPECODE"].ToString(); Tqf2Sec3StructureTypeRow.TypeCredits = rowData["TYPECREDITS"].ToString(); Tqf2Sec3StructureTypeData.Add(Tqf2Sec3StructureTypeRow); } return(Tqf2Sec3StructureTypeData); }
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 TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "'"; List <TQF2Sec3StructureGroup> tqf2Sec3StructureGroup; tqf2Sec3StructureGroup = new TQF2Sec3StructureGroup().getTQF2Sec3StructureGroupManual(sql); if (tqf2Sec3StructureGroup.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 + "' And COURSEGROUPCODE='" + CourseGroupCode + "'"; 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 + "' And COURSEGROUPCODE='" + CourseGroupCode + "'"; 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 + "' And COURSEGROUPCODE='" + CourseGroupCode + "'"; 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 + "' And COURSEGROUPCODE='" + CourseGroupCode + "'"; string deleteTQF2Sec3StructureGroup = new TQF2Sec3StructureGroup().deleteTQF2Sec3StructureGroupManual(sql3); //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR5.aspx Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; //Session["MajorCode"] = MajorCode; Response.Redirect("Faculty_add_CURR5.aspx"); } else { //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR5.aspx Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; //Session["MajorCode"] = MajorCode; Response.Redirect("Faculty_add_CURR5.aspx"); } }
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) { 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 tableBody(Table tblName, string CurrFormatCode, string CurrTypeCode, string MajorCode, string CategoryCode, string CourseGroupCode) { totalCredit = 0; string sql = "Select * From TQF2SEC3STRUCTURETYPE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "'"; List <Tqf2Sec3StructureType> tqf2Sec3StructureType = new Tqf2Sec3StructureType().getTqf2Sec3StructureTypeManual(sql); foreach (Tqf2Sec3StructureType row in tqf2Sec3StructureType) { totalCredit += int.Parse(row.TypeCredits); TableRow tRowBody = new TableRow(); tRowBody.TableSection = TableRowSection.TableBody; TableCell cellCategoryName = new TableCell(); cellCategoryName.Text = new CourseSubjectType().getCourseSubjectType(row.CourseTypeCode).CourseTypeThaiName; tRowBody.Cells.Add(cellCategoryName); TableCell cellNumCredit = new TableCell(); cellNumCredit.Text = row.TypeCredits; cellNumCredit.Width = 80; tRowBody.Cells.Add(cellNumCredit); TableCell cellDel = new TableCell(); string urlDel = "delete_CURR5_1.aspx?CurrCode=" + row.CurrCode + "&YearVersion=" + row.YearVersion + "&CurrFormatCode=" + row.CurrFormatCode + "&CurrTypeCode=" + row.CurrTypeCode + "&MajorCode=" + row.MajorCode + "&CategoryCode=" + row.CategoryCode + "&CourseGroupCode=" + row.CourseGroupCode + "&CourseTypeCode=" + row.CourseTypeCode; HyperLink hypDel = new HyperLink(); hypDel.Attributes.Add("data-target", "#delete"); 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 = 80; 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 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 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); }
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-success\">"; 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-success\">"; html += " <div class=\"panel-heading\">"; html += " <h4 class=\"panel-title\">"; Label label0 = new Label(); label0.Text = data.CurrCode + data.CurrFormatCode + data.CurrTypeCode + data.MajorCode + data.CategoryCode; 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=\"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> tqf2s3StructureCategory2 = new TQF2Sec3StructureGroup().getTQF2Sec3StructureGroupManual(sql2); foreach (TQF2Sec3StructureGroup rowGroup in tqf2s3StructureCategory2) { Label label2 = new Label(); label2.Text = new CourseGroup().getCourseGroup(rowGroup.CourseGroupCode).CourseGroupThName + " (" + rowGroup.GroupCredits + " หน่วยกิต)"; html += " <div class=\"row\">"; html += " <section class=\"col col-6\">"; html += " <span style=\"color: #996633; font-size: Large; font-weight: bold;\" id=\"Label1\">" + label2.Text + "</span>"; html += " </section>"; 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) { Label label3 = new Label(); label3.Text = new CourseSubjectType().getCourseSubjectType(rowType.CourseTypeCode).CourseTypeThaiName + " (" + rowType.TypeCredits + " หน่วยกิต)"; html += " <div class=\"row\">"; html += " <section class=\"col col-6\" style=\"padding-left: 50px\">"; html += " <span style=\"color: #009933; font-size: Large; font-weight: bold;\" id=\"Label3\">" + label3.Text + "</span>"; html += " </section>"; html += " <section class=\"col col-3 pull-right text-align-right\">"; html += " <a id=\"HyperLink2\" title=\"เพิ่มรายวิชา\" class=\"pull-right\" href=\"addCOURSE_to_CURR.aspx?CurrCode=" + rowType.CurrCode + "&YearVersion=" + rowType.YearVersion + "&CurrFormatCode=" + rowType.CurrFormatCode + "&CurrTypeCode=" + rowType.CurrTypeCode + "&MajorCode=" + rowType.MajorCode + "&CategoryCode=" + rowType.CategoryCode + "&CourseGroupCode=" + rowType.CourseGroupCode + "&CourseTypeCode=" + rowType.CourseTypeCode + "\">"; html += " <img id=\"lnk1\" src=\"../img/button_add.png\">"; html += " </a>"; html += " </section>"; html += " </div>"; html += " <section>"; Table tblGroupCategory = new Table(); htmlWriter(tblGroupCategory, "header", rowType.CurrFormatCode, rowType.CurrTypeCode, rowType.MajorCode, rowType.CourseGroupCode, rowType.CategoryCode, rowType.CourseTypeCode); //html += htmlTableHeader; htmlWriter(tblGroupCategory, "body", rowType.CurrFormatCode, rowType.CurrTypeCode, rowType.MajorCode, rowType.CourseGroupCode, rowType.CategoryCode, rowType.CourseTypeCode); 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 btnADD_Click(object sender, EventArgs e) { Tqf2Sec3StructureType dataInsert = new Tqf2Sec3StructureType(); dataInsert.CurrCode = CurrCode; dataInsert.YearVersion = YearVersion; dataInsert.CurrFormatCode = CurrFormatCode; dataInsert.CurrTypeCode = CurrTypeCode; dataInsert.MajorCode = MajorCode; dataInsert.CategoryCode = CategoryCode; dataInsert.CourseGroupCode = CourseGroupCode; dataInsert.CourseTypeCode = ddlCOURSE_TYPE.SelectedValue; dataInsert.TypeCredits = txtGROUP_CREDITS.Text; string sql = "Select * From TQF2SEC3STRUCTURETYPE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And COURSETYPECODE='" + ddlCOURSE_TYPE.SelectedValue + "'"; List <Tqf2Sec3StructureType> tqf2Sec3StructureType = new Tqf2Sec3StructureType().getTqf2Sec3StructureTypeManual(sql); if (tqf2Sec3StructureType.Count > 0) { //lblError.Visible = true; Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('ข้อมูลซ้ำ!');", true); } else { //เช็คหน่วยกิตเกินกว่ากำหนด int totalCredit; int allCredit; int newCredit; Tqf2Sec3StructureType summaryData = new Tqf2Sec3StructureType(); summaryData.CurrCode = CurrCode; summaryData.YearVersion = YearVersion; summaryData.CurrFormatCode = CurrFormatCode; summaryData.CurrTypeCode = CurrTypeCode; summaryData.MajorCode = MajorCode; summaryData.CategoryCode = CategoryCode; summaryData.CourseGroupCode = CourseGroupCode; allCredit = new Tqf2Sec3StructureType().getSumStructureType(summaryData); string sql2 = "Select * From TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "'"; List <TQF2Sec3StructureGroup> tqf2Sec3StructureGroup = new TQF2Sec3StructureGroup().getTQF2Sec3StructureGroupManual(sql2); totalCredit = int.Parse(tqf2Sec3StructureGroup[0].GroupCredits); newCredit = int.Parse(txtGROUP_CREDITS.Text); if ((allCredit + newCredit) > totalCredit) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('หน่วยกิตเกินกว่ากำหนด!');", true); } else { string insertTqf2Sec3StructureType = new Tqf2Sec3StructureType().insertTqf2Sec3StructureType(dataInsert); if (insertTqf2Sec3StructureType == "Success") { //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR5_1.aspx Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; //Session["MajorCode"] = MajorCode; Response.Redirect("Faculty_add_CURR5_1.aspx"); } } } }