/// <summary> /// เรียกดูข้อมูลจากตาราง TQF2SEC3PLANDETAIL /// </summary> /// <returns>ข้อมูลจากตาราง TQF2SEC3PLANDETAIL</returns> public List <TQF2Sec3PlanDetail> getTQF2Sec3PlanDetail() { List <TQF2Sec3PlanDetail> TQF2Sec3PlanDetailData = new List <TQF2Sec3PlanDetail>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = "Select * From TQF2SEC3PLANDETAIL Order By CURRCODE"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { TQF2Sec3PlanDetail TQF2Sec3PlanDetailRow = new TQF2Sec3PlanDetail(); TQF2Sec3PlanDetailRow.T2S3No = rowData["T2S3NO"].ToString(); TQF2Sec3PlanDetailRow.CurrCode = rowData["CURRCODE"].ToString(); TQF2Sec3PlanDetailRow.YearVersion = rowData["YEARVERSION"].ToString(); TQF2Sec3PlanDetailRow.CurrFormatCode = rowData["CURRFORMATCODE"].ToString(); TQF2Sec3PlanDetailRow.CurrTypeCode = rowData["CURRTYPECODE"].ToString(); TQF2Sec3PlanDetailRow.MajorCode = rowData["MAJORCODE"].ToString(); TQF2Sec3PlanDetailRow.CourseGroupCode = rowData["COURSEGROUPCODE"].ToString(); TQF2Sec3PlanDetailRow.CategoryCode = rowData["CATEGORYCODE"].ToString(); TQF2Sec3PlanDetailRow.CourseTypeCode = rowData["COURSETYPECODE"].ToString(); TQF2Sec3PlanDetailRow.CourseCode = rowData["COURSECODE"].ToString(); TQF2Sec3PlanDetailRow.EducationYear = rowData["EDUCATIONYEAR"].ToString(); TQF2Sec3PlanDetailRow.EducationSemester = rowData["EDUCATIONSEMESTER"].ToString(); //TQF2Sec3PlanDetailRow.SUFlag = rowData["SUFLAG"].ToString(); //TQF2Sec3PlanDetailRow.MinCredits = rowData["MINCREDITS"].ToString(); //TQF2Sec3PlanDetailRow.Comments = rowData["COMMENTS"].ToString(); TQF2Sec3PlanDetailData.Add(TQF2Sec3PlanDetailRow); } return(TQF2Sec3PlanDetailData); }
protected void btnOK_Click(object sender, EventArgs e) { //เช็คว่ามีข้อมูลอยู่จริงหรือไม่ string sql = "Select * From TQF2SEC3PLANDETAIL Where T2S3NO='" + T2S3No + "' And CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And COURSETYPECODE='" + CourseTypeCode + "' And COURSECODE='" + CourseCode + "'"; List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql); if (tqf2Sec3PlanDetail.Count > 0) { //ลบข้อมูลในตาราง TQF2SEC3PLANDETAIL string sql2 = "Delete From TQF2SEC3PLANDETAIL Where T2S3NO='" + T2S3No + "' And CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And COURSETYPECODE='" + CourseTypeCode + "' And COURSECODE='" + CourseCode + "'"; string deleteTQF2Sec3PlanDetail = new TQF2Sec3PlanDetail().deleteTQF2Sec3PlanDetailManual(sql2); if (deleteTQF2Sec3PlanDetail == "Success") { //เช็คว่ามีข้อมูลอยู่จริงหรือไม่ string sql3 = "Select * From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSETYPECODE='" + CourseTypeCode + "' And COURSECODE='" + CourseCode + "'"; List <PreRequisite> preRequisite = new PreRequisite().getPreRequisiteManual(sql3); if (preRequisite.Count > 0) { //ลบข้อมูลในตาราง PREREQUISITE string sql4 = "Delete From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSETYPECODE='" + CourseTypeCode + "' And COURSECODE='" + CourseCode + "'"; string deletePreRequisite = new PreRequisite().deletePreRequisiteManual(sql4); if (deletePreRequisite == "Success") { //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR6.aspx Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; //Session["MajorCode"] = MajorCode; Response.Redirect("Faculty_add_CURR6.aspx"); } } else { //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR6.aspx Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; //Session["MajorCode"] = MajorCode; Response.Redirect("Faculty_add_CURR6.aspx"); } } } else { //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR6.aspx Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; //Session["MajorCode"] = MajorCode; Response.Redirect("Faculty_add_CURR6.aspx"); } }
protected void btnSave_Click(object sender, EventArgs e) { foreach (TableRow row in tblCourse.Rows) { var cell = row.Cells[0]; foreach (Control control in cell.Controls) { var checkBox = control as CheckBox; if (checkBox != null) { if (checkBox.Checked == true) { //Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('ข้อมูลซ้ำ!');", true); string sql = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSETYPECODE='" + CourseTypeCode + "' And COURSECODE='" + row.Cells[4].Text + "'"; List <TQF2Sec3PlanDetail> chkTQF2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql); if (chkTQF2Sec3PlanDetail.Count > 0) { continue; } else { TQF2Sec3PlanDetail dataInsert = new TQF2Sec3PlanDetail(); dataInsert.T2S3No = new TQF.TQFUtility().getMaxID("T2S3NO", "TQF2SEC3PLANDETAIL"); dataInsert.CurrCode = CurrCode; dataInsert.YearVersion = YearVersion; dataInsert.CurrFormatCode = CurrFormatCode; dataInsert.CurrTypeCode = CurrTypeCode; dataInsert.MajorCode = MajorCode; dataInsert.CourseGroupCode = CourseGroupCode; dataInsert.CategoryCode = CategoryCode; dataInsert.CourseTypeCode = CourseTypeCode; dataInsert.CourseCode = row.Cells[4].Text; dataInsert.EducationYear = ""; dataInsert.EducationSemester = ""; string insertTQF2Sec3PlanDetail = new TQF2Sec3PlanDetail().insertTQF2Sec3PlanDetail(dataInsert); //if (insertTQF2Sec3PlanDetail == "Success") //{ //} } } } } } //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR6.aspx Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; //Session["MajorCode"] = MajorCode; 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"); } }
/// <summary> /// เพิ่มข้อมูลลงตาราง TQF2SEC3PLANDETAIL /// </summary> /// <param name="dataInsert">TQF2Sec3PlanDetail Object</param> /// <returns>Success</returns> public string insertTQF2Sec3PlanDetail(TQF2Sec3PlanDetail dataInsert) { string response = ""; int sleepTime = 5000; string T2S3No = dataInsert.T2S3No; for (int i = 0; i < 10; i++) { if (getTQF2Sec3PlanDetail(T2S3No).T2S3No != null) { Thread.Sleep(sleepTime); T2S3No = new utility().getMaxID("T2S3NO", "TQF2SEC3PLANDETAIL"); sleepTime += 5000; } else { dataInsert.T2S3No = T2S3No; break; } } ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); string sql = "Insert into TQF2SEC3PLANDETAIL (T2S3NO, CURRCODE, YEARVERSION, CURRFORMATCODE, CURRTYPECODE, MAJORCODE, COURSEGROUPCODE, CATEGORYCODE, COURSETYPECODE, COURSECODE, EDUCATIONYEAR, EDUCATIONSEMESTER) values ('" + dataInsert.T2S3No + "','" + dataInsert.CurrCode + "','" + dataInsert.YearVersion + "','" + dataInsert.CurrFormatCode + "','" + dataInsert.CurrTypeCode + "','" + dataInsert.MajorCode + "','" + dataInsert.CourseGroupCode + "','" + dataInsert.CategoryCode + "','" + dataInsert.CourseTypeCode + "','" + dataInsert.CourseCode + "','" + dataInsert.EducationYear + "','" + dataInsert.EducationSemester + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "Success"; } } catch (Exception e) { string exception = e.Message; HttpContext.Current.Session["response"] = "insertTQF2Sec3PlanDetail: " + exception; HttpContext.Current.Response.Redirect("../err_response.aspx"); } return(response); }
/// <summary> /// เรียกดูข้อมูลจากตาราง TQF2SEC3PLANDETAIL /// </summary> /// <param name="sql">SQL Command</param> /// <returns>ข้อมูลจากตาราง TQF2SEC3PLANDETAIL</returns> public List <TQF2Sec3PlanDetail> getDistinctCourseCodeTQF2Sec3PlanDetailManual(string sql) { List <TQF2Sec3PlanDetail> TQF2Sec3PlanDetailData = new List <TQF2Sec3PlanDetail>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { TQF2Sec3PlanDetail TQF2Sec3PlanDetailRow = new TQF2Sec3PlanDetail(); TQF2Sec3PlanDetailRow.CourseCode = rowData["COURSECODE"].ToString(); TQF2Sec3PlanDetailData.Add(TQF2Sec3PlanDetailRow); } return(TQF2Sec3PlanDetailData); }
/// <summary> /// เรียกดูข้อมูลจากตาราง TQF2SEC3PLANDETAIL /// </summary> /// <param name="sql">SQL Command</param> /// <returns>ข้อมูลจากตาราง TQF2SEC3PLANDETAIL</returns> public List <TQF2Sec3PlanDetail> getDistinctCourseCodeTQF2Sec3PlanDetail(string CurrCode, string YearVersion) { List <TQF2Sec3PlanDetail> TQF2Sec3PlanDetailData = new List <TQF2Sec3PlanDetail>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = "Select Distinct COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' Order By COURSECODE"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { TQF2Sec3PlanDetail TQF2Sec3PlanDetailRow = new TQF2Sec3PlanDetail(); TQF2Sec3PlanDetailRow.CourseCode = rowData["COURSECODE"].ToString(); TQF2Sec3PlanDetailData.Add(TQF2Sec3PlanDetailRow); } return(TQF2Sec3PlanDetailData); }
/// <summary> /// แก้ไขข้อมูลจากตาราง TQF2SEC3PLANDETAIL /// </summary> /// <param name="updateData">TQF2Sec3PlanDetail Object</param> /// <returns>Success</returns> public string updateTQF2Sec3PlanDetail(TQF2Sec3PlanDetail updateData) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); string sql = "Update TQF2SEC3PLANDETAIL Set COURSECODE = '" + updateData.CourseCode + "', EDUCATIONYEAR = '" + updateData.EducationYear + "', EDUCATIONSEMESTER = '" + updateData.EducationSemester + "'Where T2S3NO = '" + updateData.T2S3No + "' And CURRCODE = '" + updateData.CurrCode + "' And YEARVERSION = '" + updateData.YearVersion + "' And CURRFORMATCODE = '" + updateData.CurrFormatCode + "' And CURRTYPECODE = '" + updateData.CurrTypeCode + "' And MAJORCODE = '" + updateData.MajorCode + "' And COURSEGROUPCODE = '" + updateData.CourseGroupCode + "' And CATEGORYCODE = '" + updateData.CategoryCode + "' And COURSETYPECODE = '" + updateData.CourseTypeCode + "'"; oracleObj.UpdateCommand = sql; try { if (oracleObj.Update() == 1) { response = "Success"; } } catch (Exception e) { string exception = e.Message; HttpContext.Current.Session["response"] = "updateTQF2Sec3PlanDetail: " + exception; HttpContext.Current.Response.Redirect("../err_response.aspx"); } return(response); }
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 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 htmlGenerateTab5(string MajorCode, string CurrFormatCode, string TotalCredits, string YearVersion, string CurrTypeCode) { string html = ""; html += "<div class=\"box-group-data\">"; html += "<table class=\"table-course\">"; //Body Table List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getDistinctCourseCodeTQF2Sec3PlanDetail(CurrCode, YearVersion); foreach (TQF2Sec3PlanDetail row in tqf2Sec3PlanDetail) { TQF.Course course = new TQF.Course().getCourse(row.CourseCode); html += "<tr>"; html += "<td><strong>" + course.CourseCode + "</strong></td>"; html += "<td><strong>"; html += course.CourseThName + "<BR>"; html += course.CourseEnName; html += "</strong></td>"; html += "<td><strong>"; html += course.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")"; html += "</strong></td>"; html += "</tr>"; html += "<tr>"; html += "<td> </td>"; html += "<td colspan=\"2\">"; html += "<table class=\"table-description\">"; html += "<tr>"; html += "<td>วิชาบังคับก่อน: </td>"; html += "<td>"; string sqlPreRequisite = "Select * From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And COURSECODE='" + course.CourseCode + "'"; List <PreRequisite> preRequisite = new PreRequisite().getPreRequisiteManual(sqlPreRequisite); foreach (PreRequisite data in preRequisite) { html += data.PreRequisiteCourseCode + " " + new TQF.Course().getCourse(data.PreRequisiteCourseCode).CourseThName + "<br>"; } html += "</td>"; html += "</tr>"; html += "</table>"; html += "</td>"; html += "</tr>"; html += "<tr>"; html += "<td> </td>"; html += "<td colspan=\"2\">"; html += "<table class=\"table-description\">"; html += "<tr>"; html += "<td>PreRequisite: "; html += "<td>"; foreach (PreRequisite data in preRequisite) { html += data.PreRequisiteCourseCode + " " + new TQF.Course().getCourse(data.PreRequisiteCourseCode).CourseEnName + "<br>"; } html += "</td>"; html += "</tr>"; html += "</table>"; html += "</td>"; html += "</tr>"; html += "<tr>"; html += "<td> </td>"; html += "<td colspan=\"2\" class=\"course-description\">" + course.CourseThDesc + "</td>"; html += "</tr>"; html += "<tr>"; html += "<td> </td>"; html += "<td colspan=\"2\" class=\"course-description\">" + course.CourseEnDesc + "</td>"; html += "</tr>"; html += "<tr>"; html += "<td> </td>"; html += "<td> </td>"; html += "<td> </td>"; html += "</tr>"; } html += "</table>"; html += "</div>"; Label lblHTML5 = new Label(); lblHTML5.Text = html; placeHTML5.Controls.Add(lblHTML5); }
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 CurrTypeCode, string MajorCode, string CourseGroupCode, string CategoryCode, string CourseTypeCode) { string sql = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSETYPECODE='" + CourseTypeCode + "' Order By COURSECODE"; List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql); 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 + "&CurrCode=" + row.CurrCode + "&YearVersion=" + row.YearVersion; HyperLink hypShow = new HyperLink(); hypShow.Attributes.Add("data-target", "#showModal"); hypShow.Attributes.Add("data-toggle", "modal"); hypShow.Text = course.CourseCode + courseElective.CourseElectiveCode; 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); TableCell cellPreReq = new TableCell(); string urlAddCourse = "addCOURSE_to_PREREQ.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 + "&CourseCode=" + row.CourseCode; HyperLink hypPreReq = new HyperLink(); //hypPreReq.Attributes.Add("data-target", "#deleteCURR4"); //hypPreReq.Attributes.Add("data-toggle", "modal"); hypPreReq.Text = "<h4><i class=\"fa fa-clipboard\"></i></h4>"; hypPreReq.NavigateUrl = urlAddCourse; hypPreReq.ToolTip = "กำหนด Prerequisite"; cellPreReq.Controls.Add(hypPreReq); cellPreReq.CssClass = "text-center"; cellPreReq.Width = 60; tRowBody.Cells.Add(cellPreReq); TableCell cellDel = new TableCell(); string urlDel = "delete_CURR6.aspx?T2S3No=" + row.T2S3No + "&CurrCode=" + row.CurrCode + "&YearVersion=" + row.YearVersion + "&CurrFormatCode=" + row.CurrFormatCode + "&CurrTypeCode=" + row.CurrTypeCode + "&MajorCode=" + row.MajorCode + "&CategoryCode=" + row.CategoryCode + "&CourseGroupCode=" + row.CourseGroupCode + "&CourseTypeCode=" + row.CourseTypeCode + "&CourseCode=" + row.CourseCode; HyperLink hypDel = new HyperLink(); hypDel.Attributes.Add("data-target", "#deleteCURR6"); 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 = 60; tRowBody.Cells.Add(cellDel); tblName.Rows.Add(tRowBody); } }
protected void tableBody(Table tblName) { List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getDistinctCourseCodeTQF2Sec3PlanDetail(CurrCode, YearVersion); foreach (TQF2Sec3PlanDetail row in tqf2Sec3PlanDetail) { TQF.Course course = new TQF.Course().getCourse(row.CourseCode); CourseElective courseElective = new CourseElective().getCourseElectiveId(row.CourseCode); TQF2Sec3PlanDetail rowCourseCode = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailCourseCode(row.CourseCode); string sql = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='999999999' And COURSECODE='" + row.CourseCode + "'"; List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail2 = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql); //ถ้าเป็นรายวิชาในหลักสูตรบริการให้ข้าม if (tqf2Sec3PlanDetail2.Count > 0 && rowCourseCode.CurrCode != "999999999") { continue; } //ถ้าเป็นรายวิชาเลือก (วิชา xxx) ให้ข้าม else if (row.CourseCode == courseElective.Id) { continue; } else { TableRow tRowBody = new TableRow(); tRowBody.TableSection = TableRowSection.TableBody; //Cell [0] TableCell cellCourseCode = new TableCell(); //string urlShow = "showCOURSE.aspx?token=" + course.CourseCode; string urlShow = "showCOURSE.aspx?token=" + course.CourseCode + "&CurrCode=" + CurrCode + "&YearVersion=" + YearVersion; HyperLink hypShow = new HyperLink(); hypShow.Attributes.Add("data-target", "#showModal"); hypShow.Attributes.Add("data-toggle", "modal"); hypShow.Text = course.CourseCode + " " + course.CourseThName + "<BR>" + course.CourseEnName; hypShow.Text = course.CourseThName + courseElective.CourseElectiveThName + "<BR>"; hypShow.Text += course.CourseEnName + courseElective.CourseElectiveEnName; hypShow.NavigateUrl = urlShow; hypShow.ToolTip = "Course details"; cellCourseCode.Controls.Add(hypShow); //cellCourseCode.CssClass = "text-center"; cellCourseCode.Width = 200; tRowBody.Cells.Add(cellCourseCode); TableCell cellDomain1 = new TableCell(); string urlDomain1 = "edit_Curri_Mapping.aspx?CurrCode=" + rowCourseCode.CurrCode + "&CourseCode=" + row.CourseCode + "&DomainTypeCode=1&YearVersion=" + rowCourseCode.YearVersion + ""; HyperLink hypDomain1 = new HyperLink(); hypDomain1.Attributes.Add("data-target", "#editDomain_Modal"); hypDomain1.Attributes.Add("data-toggle", "modal"); List <TQF2Sec4CurriculumMapping> chk1 = new TQF2Sec4CurriculumMapping().getTQF2Sec4CurriculumMapping(rowCourseCode.CurrCode, row.CourseCode, "1", rowCourseCode.YearVersion); if (chk1.Count == 0) { hypDomain1.Text = "<div class=\"btn btn-primary padding-5\"><i class=\"fa fa-edit\"></i> Edit</div> "; } else { hypDomain1.Text = "<div class=\"btn btn-success padding-5\"><i class=\"fa fa-check-square-o\"></i> Edited</div> "; } hypDomain1.NavigateUrl = urlDomain1; hypDomain1.ToolTip = "Click to edit"; cellDomain1.Controls.Add(hypDomain1); cellDomain1.CssClass = "text-center"; cellDomain1.Width = 100; tRowBody.Cells.Add(cellDomain1); //Cell [1] TableCell cellDomain2 = new TableCell(); string urlDomain2 = "edit_Curri_Mapping.aspx?CurrCode=" + rowCourseCode.CurrCode + "&CourseCode=" + row.CourseCode + "&DomainTypeCode=2&YearVersion=" + rowCourseCode.YearVersion + ""; HyperLink hypDomain2 = new HyperLink(); hypDomain2.Attributes.Add("data-target", "#editDomain_Modal"); hypDomain2.Attributes.Add("data-toggle", "modal"); List <TQF2Sec4CurriculumMapping> chk2 = new TQF2Sec4CurriculumMapping().getTQF2Sec4CurriculumMapping(rowCourseCode.CurrCode, row.CourseCode, "2", rowCourseCode.YearVersion); if (chk2.Count == 0) { hypDomain2.Text = "<div class=\"btn btn-primary padding-5\"><i class=\"fa fa-edit\"></i> Edit</div> "; } else { hypDomain2.Text = "<div class=\"btn btn-success padding-5\"><i class=\"fa fa-check-square-o\"></i> Edited</div> "; } hypDomain2.NavigateUrl = urlDomain2; hypDomain2.ToolTip = "Click to edit"; cellDomain2.Controls.Add(hypDomain2); cellDomain2.CssClass = "text-center"; cellDomain2.Width = 100; tRowBody.Cells.Add(cellDomain2); //Cell [2] TableCell cellDomain3 = new TableCell(); string urlDomain3 = "edit_Curri_Mapping.aspx?CurrCode=" + rowCourseCode.CurrCode + "&CourseCode=" + row.CourseCode + "&DomainTypeCode=3&YearVersion=" + rowCourseCode.YearVersion + ""; HyperLink hypDomain3 = new HyperLink(); hypDomain3.Attributes.Add("data-target", "#editDomain_Modal"); hypDomain3.Attributes.Add("data-toggle", "modal"); List <TQF2Sec4CurriculumMapping> chk3 = new TQF2Sec4CurriculumMapping().getTQF2Sec4CurriculumMapping(rowCourseCode.CurrCode, row.CourseCode, "3", rowCourseCode.YearVersion); if (chk3.Count == 0) { hypDomain3.Text = "<div class=\"btn btn-primary padding-5\"><i class=\"fa fa-edit\"></i> Edit</div> "; } else { hypDomain3.Text = "<div class=\"btn btn-success padding-5\"><i class=\"fa fa-check-square-o\"></i> Edited</div> "; } hypDomain3.NavigateUrl = urlDomain3; hypDomain3.ToolTip = "Click to edit"; cellDomain3.Controls.Add(hypDomain3); cellDomain3.CssClass = "text-center"; cellDomain3.Width = 100; tRowBody.Cells.Add(cellDomain3); //Cell [3] TableCell cellDomain4 = new TableCell(); string urlDomain4 = "edit_Curri_Mapping.aspx?CurrCode=" + rowCourseCode.CurrCode + "&CourseCode=" + rowCourseCode.CourseCode + "&DomainTypeCode=4&YearVersion=" + rowCourseCode.YearVersion + ""; HyperLink hypDomain4 = new HyperLink(); hypDomain4.Attributes.Add("data-target", "#editDomain_Modal"); hypDomain4.Attributes.Add("data-toggle", "modal"); List <TQF2Sec4CurriculumMapping> chk4 = new TQF2Sec4CurriculumMapping().getTQF2Sec4CurriculumMapping(rowCourseCode.CurrCode, row.CourseCode, "4", rowCourseCode.YearVersion); if (chk4.Count == 0) { hypDomain4.Text = "<div class=\"btn btn-primary padding-5\"><i class=\"fa fa-edit\"></i> Edit</div> "; } else { hypDomain4.Text = "<div class=\"btn btn-success padding-5\"><i class=\"fa fa-check-square-o\"></i> Edited</div> "; } hypDomain4.NavigateUrl = urlDomain4; hypDomain4.ToolTip = "Click to edit"; cellDomain4.Controls.Add(hypDomain4); cellDomain4.CssClass = "text-center"; cellDomain4.Width = 100; tRowBody.Cells.Add(cellDomain4); //Cell [4] TableCell cellDomain5 = new TableCell(); string urlDomain5 = "edit_Curri_Mapping.aspx?CurrCode=" + rowCourseCode.CurrCode + "&CourseCode=" + row.CourseCode + "&DomainTypeCode=5&YearVersion=" + rowCourseCode.YearVersion + ""; HyperLink hypDomain5 = new HyperLink(); hypDomain5.Attributes.Add("data-target", "#editDomain_Modal"); hypDomain5.Attributes.Add("data-toggle", "modal"); List <TQF2Sec4CurriculumMapping> chk5 = new TQF2Sec4CurriculumMapping().getTQF2Sec4CurriculumMapping(rowCourseCode.CurrCode, row.CourseCode, "5", rowCourseCode.YearVersion); if (chk5.Count == 0) { hypDomain5.Text = "<div class=\"btn btn-primary padding-5\"><i class=\"fa fa-edit\"></i> Edit</div> "; } else { hypDomain5.Text = "<div class=\"btn btn-success padding-5\"><i class=\"fa fa-check-square-o\"></i> Edited</div> "; } hypDomain5.NavigateUrl = urlDomain5; hypDomain5.ToolTip = "Click to edit"; cellDomain5.Controls.Add(hypDomain5); cellDomain5.CssClass = "text-center"; cellDomain5.Width = 100; tRowBody.Cells.Add(cellDomain5); //Cell [5] TableCell cellDomain6 = new TableCell(); string urlDomain6 = "edit_Curri_Mapping.aspx?CurrCode=" + rowCourseCode.CurrCode + "&CourseCode=" + row.CourseCode + "&DomainTypeCode=6&YearVersion=" + rowCourseCode.YearVersion + ""; HyperLink hypDomain6 = new HyperLink(); hypDomain6.Attributes.Add("data-target", "#editDomain_Modal"); hypDomain6.Attributes.Add("data-toggle", "modal"); List <TQF2Sec4CurriculumMapping> chk6 = new TQF2Sec4CurriculumMapping().getTQF2Sec4CurriculumMapping(rowCourseCode.CurrCode, row.CourseCode, "6", rowCourseCode.YearVersion); if (chk6.Count == 0) { hypDomain6.Text = "<div class=\"btn btn-primary padding-5\"><i class=\"fa fa-edit\"></i> Edit</div> "; } else { hypDomain6.Text = "<div class=\"btn btn-success padding-5\"><i class=\"fa fa-check-square-o\"></i> Edited</div> "; } hypDomain6.NavigateUrl = urlDomain6; hypDomain6.ToolTip = "Click to edit"; cellDomain6.Controls.Add(hypDomain6); cellDomain6.CssClass = "text-center"; cellDomain6.Width = 100; tRowBody.Cells.Add(cellDomain6); tblName.Rows.Add(tRowBody); } } }
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"]; Year = Request.QueryString["Year"]; Semester = Request.QueryString["Semester"]; if (!Page.IsPostBack) { lblHead.Text = new CurrType().getCurrType(CurrTypeCode).CurrTypeName + ": " + new CurrFormat().getCurrFormat(CurrFormatCode).CurrFormatName + " (แขนงวิชา " + new TQF.Major().getMajor(MajorCode).MajorThName + ")"; ddlEDUCATIONYEAR.Items.FindByValue(Year).Selected = true; ddlEDUCATIONSEMESTER.Items.FindByValue(Semester).Selected = true; } // Head Table string[] ar = { "เลือก", "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต" }; tblCourse.Attributes.Add("class", "table table-bordered table-striped table-hover"); tblCourse.Attributes.Add("id", "dt_basic"); TableHeaderRow tRowHead = new TableHeaderRow(); tRowHead.TableSection = TableRowSection.TableHeader; for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++) { // Create a new cell and add it to the row. TableHeaderCell cellHead = new TableHeaderCell(); cellHead.Text = ar[cellCtr - 1]; tRowHead.Cells.Add(cellHead); switch (cellCtr) { case 1: cellHead.Width = 50; break; case 2: cellHead.Width = 80; break; case 3: break; case 4: cellHead.Width = 80; break; case 5: cellHead.Width = 80; break; } } tblCourse.Rows.Add(tRowHead); //string sql = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' Order By COURSECODE"; //List<TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql); //List<TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getDistinctCourseCodeTQF2Sec3PlanDetail(CurrCode, YearVersion); string sql1 = "Select Distinct COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And MAJORCODE='" + MajorCode + "' Order By COURSECODE"; List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getDistinctCourseCodeTQF2Sec3PlanDetailManual(sql1); int i = 0; foreach (TQF2Sec3PlanDetail data in tqf2Sec3PlanDetail) { i++; TableRow tRowBody = new TableRow(); tRowBody.TableSection = TableRowSection.TableBody; //Cell [0] TableCell cellCheck = new TableCell(); CheckBox chk = new CheckBox(); chk.ID = data.CourseCode + i.ToString(); cellCheck.Controls.Add(chk); cellCheck.CssClass = "text-center"; cellCheck.Width = 50; tRowBody.Cells.Add(cellCheck); //Cell [1] TableCell cellCourseCode = new TableCell(); cellCourseCode.Text = data.CourseCode; cellCourseCode.CssClass = "text-center"; cellCourseCode.Width = 80; tRowBody.Cells.Add(cellCourseCode); //Cell [2] TQF.Course course = new TQF.Course().getCourse(data.CourseCode); CourseElective courseElective = new CourseElective().getCourseElective(data.CourseCode); TableCell cellCourseEnName = new TableCell(); //cellCourseEnName.Text = course.CourseThName + "<br>" + course.CourseEnName; cellCourseEnName.Text = course.CourseThName + courseElective.CourseElectiveThName + "<BR>"; cellCourseEnName.Text += course.CourseEnName + courseElective.CourseElectiveEnName; tRowBody.Cells.Add(cellCourseEnName); //Cell [3] TableCell cellCredit = new TableCell(); cellCredit.Text = course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")"; tRowBody.Cells.Add(cellCredit); //Cell [4] //เลือกค่า Id ของตาราง Elective course ไปเก็บ ไม่แสดงผลออกทางหน้าจอ TableCell cellId = new TableCell(); cellId.Visible = false; cellId.Text = "null"; tRowBody.Cells.Add(cellId); tblCourse.Rows.Add(tRowBody); } TQF.Curriculum curriculum = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion); //แสดงวิชาเลือก -> วิชา xxx List <CourseElective> electiveCourse = new List <CourseElective>(); string sql2 = "Select * From COURSEELECTIVE Order By COURSEELECTIVECODE"; electiveCourse = new CourseElective().getCourseElectiveManual(sql2); int k = 0; foreach (CourseElective data in electiveCourse) { k++; string sql3 = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And COURSECODE='" + data.CourseElectiveCode + "'"; List <TQF2Sec3PlanDetail> chkDupTqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql3); TableRow tRowBody = new TableRow(); tRowBody.TableSection = TableRowSection.TableBody; if (chkDupTqf2Sec3PlanDetail.Count > 0) { continue; } else { //Cell [0] TableCell cellCheck = new TableCell(); CheckBox chk = new CheckBox(); chk.ID = data.CourseElectiveCode + k.ToString(); cellCheck.Controls.Add(chk); cellCheck.CssClass = "text-center"; cellCheck.Width = 50; tRowBody.Cells.Add(cellCheck); //Cell [1] TableCell cellCourseCode = new TableCell(); cellCourseCode.Text = data.CourseElectiveCode; cellCourseCode.CssClass = "text-center"; cellCourseCode.Width = 80; tRowBody.Cells.Add(cellCourseCode); //Cell [2] TableCell cellCourseEnName = new TableCell(); cellCourseEnName.Text = data.CourseElectiveThName + "<BR>"; cellCourseEnName.Text += data.CourseElectiveEnName; tRowBody.Cells.Add(cellCourseEnName); //Cell [3] TableCell cellCredit = new TableCell(); cellCredit.Text = data.Credit + " (" + "-" + "-" + ")"; tRowBody.Cells.Add(cellCredit); //Cell [4] //เลือกค่า Id ของตาราง Elective course ไปเก็บ ไม่แสดงผลออกทางหน้าจอ TableCell cellId = new TableCell(); cellId.Visible = false; cellId.Text = data.Id; tRowBody.Cells.Add(cellId); tblCourse.Rows.Add(tRowBody); } } }