protected void btnADD_Click(object sender, EventArgs e) { StructurePlan structurePlanData = new StructurePlan(); structurePlanData.CurrCode = CurrCode; structurePlanData.YearVersion = YearVersion; structurePlanData.CurrFormatCode = ddlCURRFORMAT.SelectedValue; structurePlanData.CurrTypeCode = ddlCURRTYPE.SelectedValue; structurePlanData.MajorCode = ddlMAJOR.SelectedValue; structurePlanData.StructureType = "1"; //ddlCURRDISPLAY.SelectedValue; structurePlanData.TotalCredits = txtTOTALCREDITS.Text; string sql = "Select * From STRUCTUREPLAN Where CURRCODE='" + structurePlanData.CurrCode + "' And YEARVERSION='" + structurePlanData.YearVersion + "' And CURRFORMATCODE='" + structurePlanData.CurrFormatCode + "' And CURRTYPECODE='" + structurePlanData.CurrTypeCode + "' And MAJORCODE='" + structurePlanData.MajorCode + "'"; List <StructurePlan> checkStructurePlan = new StructurePlan().getStructurePlanManual(sql); //เช็คค่าซ้ำในตาราง if (checkStructurePlan.Count > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('ข้อมูลซ้ำ!');", true); } else { string insertStructurePlan = new StructurePlan().insertStructurePlan(structurePlanData); Response.Redirect("Faculty_add_CURR3.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["login_data"] == null) { Response.Redirect("../index.aspx"); } else { //ตรวจสอบสิทธิ์ login_data = (UserLoginData)Session["login_data"]; if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { // ======== Process =========== //ทดสอบ ชั่วคราว ลบออกเมื่อใช้งานจริง //Session["CurrCode"] = "707012555"; //Session["YearVersion"] = "2555"; //Session["NumTQF1"] = "001"; if (Session["CurrCode"] == null || Session["YearVersion"] == null || Session["NumTQF1"] == null) { Response.Redirect("listCURR.aspx"); } else { CurrCode = Session["CurrCode"].ToString(); YearVersion = Session["YearVersion"].ToString(); NumTQF1 = Session["NumTQF1"].ToString(); } TQF.Curriculum currTitle = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion); lblHeader1.Text = currTitle.CurrCode + " หลักสูตร" + currTitle.CurrThName; lblHeader2.Text = currTitle.CurrEnName; string currStatus; if (currTitle.CurrStatus == "1") { currStatus = "หลักสูตรใหม่"; lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")"; } if (currTitle.CurrStatus == "2") { currStatus = "หลักปรับปรุง"; lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")"; } string sql = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'"; List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sql); foreach (StructurePlan data in dataStructurePlan) { htmlGenerate(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode); } //============================= } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }
protected void btnNext_Click(object sender, EventArgs e) { string sql = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'"; List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sql); foreach (StructurePlan row in dataStructurePlan) { string sql2 = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + row.CurrFormatCode + "' And CURRTYPECODE='" + row.CurrTypeCode + "' And MAJORCODE='" + row.MajorCode + "'"; List <TQF2Sec3StructureCategory> tqf2s3StructureCategory = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sql2); foreach (TQF2Sec3StructureCategory row2 in tqf2s3StructureCategory) { TQF2Sec3StructureGroup data = new TQF2Sec3StructureGroup(); data.CurrCode = row2.CurrCode; data.YearVersion = row2.YearVersion; data.CurrFormatCode = row2.CurrFormatCode; data.CurrTypeCode = row2.CurrTypeCode; data.MajorCode = row2.MajorCode; data.CategoryCode = row2.CategoryCode; int credit = data.getSumStructureGroupCredits(data); if (int.Parse(row2.CategoryCredits) != credit) { Response.Redirect("Faculty_add_CURR5.aspx?msg=error&CategoryCode=" + row2.CategoryCode + "&CurrTypeCode=" + row2.CurrTypeCode + "&MajorCode=" + row2.MajorCode + ""); } } } //สร้าง session CurrCode ไว้ใช้สำหรับทุกหน้าในการสร้างหลักสูตร Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; Session["NumTQF1"] = NumTQF1; Response.Redirect("Faculty_add_CURR5_1.aspx"); }
/// <summary> /// แก้ไขข้อมูลจากตาราง STRUCTUREPLAN /// </summary> /// <param name="updateData">StructurePlan Object</param> /// <returns>Success</returns> public string updateStructurePlan(StructurePlan updateData) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); string sql = "Update STRUCTUREPLAN Set STRUCTURETYPE = '" + updateData.StructureType + "', TOTALCREDITS = '" + updateData.TotalCredits + "' Where CURRCODE = '" + updateData.CurrCode + "' And YEARVERSION = '" + updateData.YearVersion + "' And CURRFORMATCODE = '" + updateData.CurrFormatCode + "' And CURRTYPECODE = '" + updateData.CurrTypeCode + "' And MAJORCODE = '" + updateData.MajorCode + "'"; oracleObj.UpdateCommand = sql; try { if (oracleObj.Update() == 1) { response = "Success"; } } catch (Exception e) { string exception = e.Message; HttpContext.Current.Session["response"] = "updateStructurePlan: " + exception; HttpContext.Current.Response.Redirect("../err_response.aspx"); } return(response); }
protected void btnNEXT_Click(object sender, EventArgs e) { string sql = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'"; List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sql); foreach (StructurePlan row in dataStructurePlan) { TQF2Sec3StructureCategory data = new TQF2Sec3StructureCategory(); data.CurrCode = row.CurrCode; data.YearVersion = row.YearVersion; data.CurrFormatCode = row.CurrFormatCode; data.CurrTypeCode = row.CurrTypeCode; data.MajorCode = row.MajorCode; int credit = data.getSumCategoryCredits(data); if (int.Parse(row.TotalCredits) != credit) { Response.Redirect("addCURR_GEN_EDU4.aspx?msg=error&CurrTypeCode=" + row.CurrTypeCode + ""); } } //สร้าง session CurrCode ไว้ใช้สำหรับทุกหน้าในการสร้างหลักสูตร Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; Session["NumTQF1"] = NumTQF1; Response.Redirect("addCURR_GEN_EDU4.aspx"); }
protected void btnADD_Click(object sender, EventArgs e) { TQF2Sec3StructureCategory dataInsert = new TQF2Sec3StructureCategory(); dataInsert.CurrCode = CurrCode; dataInsert.YearVersion = YearVersion; dataInsert.CurrFormatCode = CurrFormatCode; dataInsert.CurrTypeCode = CurrTypeCode; dataInsert.MajorCode = MajorCode; dataInsert.CategoryCode = ddlCATEGORY.SelectedValue; dataInsert.CategoryCredits = txtCATEGORYCREDITS.Text; string sql = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + ddlCATEGORY.SelectedValue + "'"; List <TQF2Sec3StructureCategory> tqf2Sec3StructureCategory = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sql); if (tqf2Sec3StructureCategory.Count > 0) { //lblError.Visible = true; Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('ข้อมูลซ้ำ!');", true); } else { //เช็คหน่วยกิตเกินกว่ากำหนด int totalCredit; int allCredit; int newCredit; TQF2Sec3StructureCategory summaryData = new TQF2Sec3StructureCategory(); summaryData.CurrCode = CurrCode; summaryData.YearVersion = YearVersion; summaryData.CurrFormatCode = CurrFormatCode; summaryData.CurrTypeCode = CurrTypeCode; summaryData.MajorCode = MajorCode; allCredit = new TQF2Sec3StructureCategory().getSumCategoryCredits(summaryData); string sqlStructurePlan = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And MAJORCODE='" + MajorCode + "' And CURRFORMATCODE='" + CurrFormatCode + "'"; List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sqlStructurePlan); totalCredit = int.Parse(dataStructurePlan[0].TotalCredits); newCredit = int.Parse(txtCATEGORYCREDITS.Text); if ((allCredit + newCredit) > totalCredit) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('หน่วยกิตเกินกว่ากำหนด!');", true); } else { string insertTQF2Sec3StructureCategory = new TQF2Sec3StructureCategory().insertTQF2Sec3StructureCategory(dataInsert); if (insertTQF2Sec3StructureCategory == "Success") { //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR4.aspx Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; //Session["MajorCode"] = MajorCode; Response.Redirect("Faculty_add_CURR4.aspx"); } } } }
/// <summary> /// เพิ่มข้อมูลลงตาราง STRUCTUREPLAN /// </summary> /// <param name="dataInsert">StructurePlan Object</param> /// <returns>Success</returns> public string insertStructurePlan(StructurePlan dataInsert) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); string sql = "Insert into STRUCTUREPLAN (CURRCODE, YEARVERSION, CURRFORMATCODE, CURRTYPECODE, MAJORCODE, STRUCTURETYPE, TOTALCREDITS) values ('" + dataInsert.CurrCode + "','" + dataInsert.YearVersion + "','" + dataInsert.CurrFormatCode + "','" + dataInsert.CurrTypeCode + "','" + dataInsert.MajorCode + "','" + dataInsert.StructureType + "','" + dataInsert.TotalCredits + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "Success"; } } catch (Exception e) { string exception = e.Message; HttpContext.Current.Session["response"] = "insertStructurePlan: " + exception; HttpContext.Current.Response.Redirect("../err_response.aspx"); } return(response); }
/// <summary> /// เรียกดูข้อมูลจากตาราง STRUCTUREPLAN /// </summary> /// <param name="sql">SQL Command</param> /// <returns>ข้อมูลจากตาราง STRUCTUREPLAN</returns> public List <StructurePlan> getStructurePlanManual(string sql) { List <StructurePlan> StructurePlandata = new List <StructurePlan>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { StructurePlan StructurePlanRow = new StructurePlan(); StructurePlanRow.CurrCode = rowData["CURRCODE"].ToString(); StructurePlanRow.YearVersion = rowData["YEARVERSION"].ToString(); StructurePlanRow.CurrFormatCode = rowData["CURRFORMATCODE"].ToString(); StructurePlanRow.CurrTypeCode = rowData["CURRTYPECODE"].ToString(); StructurePlanRow.MajorCode = rowData["MAJORCODE"].ToString(); StructurePlanRow.StructureType = rowData["STRUCTURETYPE"].ToString(); StructurePlanRow.TotalCredits = rowData["TOTALCREDITS"].ToString(); StructurePlandata.Add(StructurePlanRow); } return(StructurePlandata); }
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 tableBody(Table tblName) { string sql = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'"; List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sql); if (dataStructurePlan.Count > 0) { foreach (StructurePlan data in dataStructurePlan) { TableRow row = new TableRow(); //Cell [0] TableCell cellCurrFormatName = new TableCell(); cellCurrFormatName.Text = new CurrFormat().getCurrFormat(data.CurrFormatCode).CurrFormatName; row.Cells.Add(cellCurrFormatName); //Cell [1] TableCell cellCurrTypeName = new TableCell(); cellCurrTypeName.Text = new CurrType().getCurrType(data.CurrTypeCode).CurrTypeName; row.Cells.Add(cellCurrTypeName); //Cell [2] TableCell cellCourseGroupThName = new TableCell(); cellCourseGroupThName.Text = new TQF.Major().getMajor(data.MajorCode).MajorThName; row.Cells.Add(cellCourseGroupThName); //Cell [3] TableCell cellCredit = new TableCell(); cellCredit.Text = data.TotalCredits; row.Cells.Add(cellCredit); //Cell [4] //TableCell cellCurrDisplayName = new TableCell(); //cellCurrDisplayName.Text = new CurrDisplay().getCurrDisplay(data.StructureType).CurrDisplayName; //row.Cells.Add(cellCurrDisplayName); //Cell [5] TableCell cellDel = new TableCell(); string urlDel = "delete_CURR3.aspx?CurrCode=" + CurrCode + "&YearVersion=" + YearVersion + "&MajorCode=" + data.MajorCode + "&CurrTypeCode=" + data.CurrTypeCode + "&CurrFormatCode=" + data.CurrFormatCode + ""; HyperLink hypDel = new HyperLink(); hypDel.Attributes.Add("data-target", "#delete_CURR3"); hypDel.Attributes.Add("data-toggle", "modal"); hypDel.Text = "<h4><i class='fa fa-trash-o'></i></h4>"; hypDel.NavigateUrl = urlDel; hypDel.ToolTip = "Delete"; cellDel.Controls.Add(hypDel); cellDel.CssClass = "text-center"; cellDel.Width = 50; row.Cells.Add(cellDel); tblName.Rows.Add(row); } } }
protected void btnOK_Click(object sender, EventArgs e) { if (dataStructurePlan.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 + "'"; 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 + "'"; 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 + "'"; 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 + "'"; string deleteTQF2Sec3StructureGroup = new TQF2Sec3StructureGroup().deleteTQF2Sec3StructureGroupManual(sql3); //[Step 4] ลบข้อมูลในตาราง TQF2SEC3STRUCTURECATEGORY string sql2 = "Delete From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'"; string deleteTQF2Sec3StructureCategory = new TQF2Sec3StructureCategory().deleteTQF2Sec3StructureCategoryManual(sql2); //[Step 3] ลบข้อมูลในตาราง STRUCTUREPLAN string sql = "Delete From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'"; string deleteStructurePlan = new StructurePlan().deleteStructurePlanManual(sql); //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR3.aspx Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; //Session["MajorCode"] = MajorCode; Response.Redirect("Faculty_add_CURR3.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { //ทดสอบ ชั่วคราว ลบออกเมื่อใช้งานจริง Session["CurrCode"] = "999999999"; Session["YearVersion"] = "2558"; Session["NumTQF1"] = "001"; if (Session["CurrCode"] == null || Session["YearVersion"] == null || Session["NumTQF1"] == null) { Response.Redirect("listCURR.aspx"); } else { CurrCode = Session["CurrCode"].ToString(); YearVersion = Session["YearVersion"].ToString(); NumTQF1 = Session["NumTQF1"].ToString(); } TQF.Curriculum currTitle = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion); lblHeader1.Text = currTitle.CurrCode + " หลักสูตร" + currTitle.CurrThName; lblHeader2.Text = currTitle.CurrEnName; string currStatus; if (currTitle.CurrStatus == "1") { currStatus = "หลักสูตรใหม่"; lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")"; } if (currTitle.CurrStatus == "2") { currStatus = "หลักปรับปรุง"; lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")"; } if (Request.QueryString["msg"] == "error") { lblMsg.Text = new CurrType().getCurrType(Request.QueryString["CurrTypeCode"]).CurrTypeName + " หน่วยกิตไม่ตรงจำนวน!"; divError.Visible = true; btnNext.Visible = false; } string sql = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'"; List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sql); foreach (StructurePlan data in dataStructurePlan) { htmlGenerate(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode); } }
/// <summary> /// เรียกดูข้อมูลจำนวนหน่วยกิต จากตาราง STRUCTUREPLAN /// </summary> /// <param name="CurrCode">รหัสหลักสูตร(Curriculum)</param> /// <param name="YearVersion">รหัสเวอร์ชั่นหลักสูตร(Curriculum)</param> /// <param name="CurrFormatCode">รหัสรูปแบบหลักสูตร(CurrFormat)</param> /// <param name="CurrTypeCode">รหัสประเภทหลักสูตร(CurrType)</param> /// <param name="MajorCode">รหัสแขนง(Major)</param> /// <returns>ข้อมูลจากตาราง STRUCTUREPLAN</returns> public StructurePlan getTotalCreditsStructurePlan(string CurrCode, string YearVersion, string CurrFormatCode, string CurrTypeCode, string MajorCode) { StructurePlan StructurePlanData = new StructurePlan(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = "Select TOTALCREDITS From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { StructurePlanData.TotalCredits = rowData["TOTALCREDITS"].ToString(); } return(StructurePlanData); }
protected void Page_Load(object sender, EventArgs e) { CurrCode = Request.QueryString["CurrCode"]; YearVersion = Request.QueryString["YearVersion"]; TQF.Curriculum curriculum = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion); StructurePlan structurePlan = new StructurePlan().getStructurePlan(CurrCode, YearVersion); //Header lblTitleFaculty.Text = new Faculty().getFaculty(curriculum.FacultyCode).Faculty_Thai; lblTitleDepartment.Text = "ภาควิชา" + new Department().getDepartment(curriculum.DepartmentCode).Department_Thai; string currStatus = ""; if (curriculum.CurrStatus == "1") { currStatus = "ใหม่"; } if (curriculum.CurrStatus == "2") { currStatus = "ปรับปรุง"; } lblTitleCurriculum.Text = curriculum.CurrThName + "<br>" + "(หลักสูตร" + currStatus + " พ.ศ. " + curriculum.YearVersion + ")"; //Tab 1: ข้อมูลทั่วไป lblCURR_CODE.Text = curriculum.CurrCode; lblCURR_THAINAME.Text = curriculum.CurrThName; lblCURR_ENGNAME.Text = curriculum.CurrEnName; lblDEGREE_THAINAME.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainThName; lblDEGREE_SHORT_THAINAME.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainThShortName; lblDEGREE_ENGNAME.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainEnName; lblDEGREE_SHORT_ENGNAME.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainEnShortName; lblCURR_YEAR.Text = curriculum.YearVersion; lblCURR_FACULTY.Text = new Faculty().getFaculty(curriculum.FacultyCode).Faculty_Thai; lblCURR_DEPARTMENT.Text = new Department().getDepartment(curriculum.DepartmentCode).Department_Thai; string sqlDivisionExtension = "Select * From DIVISIONEXTENSION Where DIVISIONNO='" + curriculum.DivisionCode + "' Order By DIVISIONCODE"; List <DivisionExtension> divisionExtension = new DivisionExtension().getDivisionExtensionManual(sqlDivisionExtension); foreach (DivisionExtension data in divisionExtension) { lblCURR_MAJOR.Text += new TQF.Division().getDivision(data.DivisionCode).DivisionEnShortName + " " + new TQF.Division().getDivision(data.DivisionCode).DivisionThName + "<BR>"; } string sqlMajor = "Select * From MAJOR Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'"; List <TQF.Major> major = new TQF.Major().getMajorManual(sqlMajor); foreach (TQF.Major data in major) { lblCURR_SPEC_FIELD.Text += data.MajorThName + "<BR>"; //แสดงผลอาจารย์ประจำแขนง (ถ้ามี) string html = ""; html += "<div class=\"row tb-curr-info\">"; html += "<div class=\"col-sm-4 txt-blue\">"; html += "<i class=\"icon-append fa fa-user\"></i> "; html += "<strong>อาจารย์ประจำแขนง : " + data.MajorThName + "</strong>"; html += "</div>"; html += "<div class=\"col-sm-8\">"; //เรียกข้อมูลอาจารย์ประจำแขนง string sqlLecturerMajor = "Select * From ABOUTLECTURER Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And LOADTYPECODE='4' And MAJORCODE='" + data.MajorCode + "'Order By LECTIDENTITY"; List <AboutLecturer> aboutLecturerMajor = new AboutLecturer().getAboutLecturerManual(sqlLecturerMajor); Label lblCURR_LECTURER2 = new Label(); foreach (AboutLecturer lecturer in aboutLecturerMajor) { SysUser sysUser = new SysUser().getSysUser(lecturer.LectIdentity); AcademicPosition position = new AcademicPosition().getAcademicPosition(sysUser.AcademicPositionCode); lblCURR_LECTURER2.Text += position.AcademicPositionThName + sysUser.ThName + " " + sysUser.ThSurName + "<BR>"; } html += lblCURR_LECTURER2.Text; html += "</div>"; html += "</div>"; Label la = new Label(); la.Text = html; placeHTML1.Controls.Add(la); } lblTOTAL_CREDIT.Text = structurePlan.TotalCredits + " หน่วยกิต"; lblSTUDY_YEAR.Text = curriculum.NumYear + " ปี"; lblTOTAL_STUDY_YEAR.Text = curriculum.MaxNumYear + " ปี"; //lblMODI_CURR_CODE.Text = ""; //lblMODI_CURR_YEAR.Text = ""; //ความหมาย LOADTYPECODE //1 อาจารย์ประจำหลักสูตร //2 อาจาร์ผู้ร่วมสอน //3 อาจารย์พิเศษ //4 อาจารย์ประจำแขนง string sqlLecturer = "Select * From ABOUTLECTURER Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And LOADTYPECODE='1' Order By LECTIDENTITY"; List <AboutLecturer> aboutLecturer = new AboutLecturer().getAboutLecturerManual(sqlLecturer); foreach (AboutLecturer data in aboutLecturer) { SysUser sysUser = new SysUser().getSysUser(data.LectIdentity); AcademicPosition position = new AcademicPosition().getAcademicPosition(sysUser.AcademicPositionCode); lblCURR_LECTURER1.Text += position.AcademicPositionThName + sysUser.ThName + " " + sysUser.ThSurName + "<BR>"; } string sql = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'"; List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sql); foreach (StructurePlan data in dataStructurePlan) { //Tab 2: โครงสร้างหลักสูตร htmlGenerateTab2(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode); //Tab 3: รายวิชาในหลักสูตร htmlGenerateTab3(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode); //Tab 4: แผนการศึกษา htmlGenerateTab4(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode); } }
//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 Page_Load(object sender, EventArgs e) { if (Session["login_data"] == null) { Response.Redirect("../index.aspx"); } else { //ตรวจสอบสิทธิ์ login_data = (UserLoginData)Session["login_data"]; if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { // ======== Process =========== //ทดสอบ ชั่วคราว ลบออกเมื่อใช้งานจริง //Session["CurrCode"] = "707012555"; //Session["YearVersion"] = "2555"; //Session["NumTQF1"] = "001"; if (Session["CurrCode"] == null || Session["YearVersion"] == null || Session["NumTQF1"] == null) { Response.Redirect("listCURR.aspx"); } else { CurrCode = Session["CurrCode"].ToString(); YearVersion = Session["YearVersion"].ToString(); NumTQF1 = Session["NumTQF1"].ToString(); } TQF.Curriculum curriculum = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion); StructurePlan structurePlan = new StructurePlan().getStructurePlan(CurrCode, YearVersion); Label1.Text = curriculum.CurrThName; //Label2.Text = curriculum.MajorName; if (curriculum.CurrStatus == "1") { //สถานะของหลักสูตร(1=ใหม่, 2=ปรับปรุง) curriculum.CurrStatus = "หลักสูตรใหม่"; } else { curriculum.CurrStatus = "หลักสูตรปรับปรุง"; } Label3.Text = "(" + curriculum.CurrStatus + " พ.ศ. " + curriculum.YearVersion + ")"; Label4.Text = "มหาวิทยาลัยเทคโนโลยีพระจอมเกล้าพระนครเหนือ"; Label5.Text = new Faculty().getFaculty(curriculum.FacultyCode).Faculty_Thai + " "; Label6.Text = new Department().getDepartment(curriculum.DepartmentCode).Department_Thai; //รหัสและชื่อหลักสูตร Label7.Text = curriculum.CurrCode; Label8.Text = curriculum.CurrThName; Label9.Text = curriculum.CurrShortThName; Label10.Text = curriculum.CurrEnName; Label11.Text = curriculum.CurrShortEnName; //ถ้าไม่ใช่หลักสูตรวิชาบริการ (999999999) if (CurrCode != "999999999") { //ชื่อปริญญาและสาขาวิชา Label12.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainThName; Label13.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainThShortName; Label14.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainEnName; Label15.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainEnShortName; //วันที่อนุมัติหลักสูตร และภาคการศึกษาที่เริ่มใช้หลักสูตร Label16.Text = new utility().getThaiBirthDay(curriculum.ApprovedDate); Label17.Text = curriculum.BeginSemester + "/" + curriculum.YearVersion; //จำนวนหน่วยกิตที่เรียนตลอดหลักสูตร Label18.Text = structurePlan.TotalCredits + " หน่วยกิต"; } //รูปแบบของหลักสูตร string sqlStructurePlan = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'"; List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sqlStructurePlan); foreach (StructurePlan data in dataStructurePlan) { Label19.Text = new CurrFormat().getCurrFormat(data.CurrFormatCode).CurrFormatName; if (dataStructurePlan.Count > 1) { Label19.Text += "<br>"; } //Tab 2: โครงสร้างหลักสูตร htmlGenerateTab2(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode); //Tab 3: รายวิชาในหลักสูตร htmlGenerateTab3(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode); //Tab 4: แผนการศึกษา htmlGenerateTab4(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode); //Tab 5: คำอธิบายรายวิชา htmlGenerateTab5(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode); } Label20.Text = curriculum.NumYear + " ปี / " + curriculum.MaxNumYear + " ปี"; //อาจารย์ผู้รับผิดชอบหลักสูตร //ความหมาย LOADTYPECODE //1 อาจารย์ประจำหลักสูตร //4 อาจารย์ประจำแขนง string sqlLecturer = "Select * From ABOUTLECTURER Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And LOADTYPECODE='1' Order By LECTIDENTITY"; List <AboutLecturer> aboutLecturer = new AboutLecturer().getAboutLecturerManual(sqlLecturer); int i = 1; foreach (AboutLecturer data in aboutLecturer) { SysUser sysUser = new SysUser().getSysUser(data.LectIdentity); AcademicPosition position = new AcademicPosition().getAcademicPosition(sysUser.AcademicPositionCode); Label21.Text += "<span class=\"report-indent-1em\">" + i + ". " + position.AcademicPositionThName + sysUser.ThName + " " + sysUser.ThSurName + "</span><BR>"; i++; } //============================= } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { //ทดสอบ ชั่วคราว ลบออกเมื่อใช้งานจริง //Session["CurrCode"] = "707012555"; //Session["YearVersion"] = "2555"; //Session["NumTQF1"] = "001"; CurrCode = Request.QueryString["CurrCode"]; YearVersion = Request.QueryString["YearVersion"]; TQF.Curriculum curriculum = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion); StructurePlan structurePlan = new StructurePlan().getStructurePlan(CurrCode, YearVersion); Label1.Text = curriculum.CurrThName; //Label2.Text = curriculum.MajorName; if (curriculum.CurrStatus == "1") { //สถานะของหลักสูตร(1=ใหม่, 2=ปรับปรุง) curriculum.CurrStatus = "หลักสูตรใหม่"; } else { curriculum.CurrStatus = "หลักสูตรปรับปรุง"; } Label3.Text = "(" + curriculum.CurrStatus + " พ.ศ. " + curriculum.YearVersion + ")"; Label4.Text = "มหาวิทยาลัยเทคโนโลยีพระจอมเกล้าพระนครเหนือ"; Label5.Text = new Faculty().getFaculty(curriculum.FacultyCode).Faculty_Thai + " "; Label6.Text = new Department().getDepartment(curriculum.DepartmentCode).Department_Thai; //รหัสและชื่อหลักสูตร Label7.Text = curriculum.CurrCode; Label8.Text = curriculum.CurrThName; Label9.Text = curriculum.CurrShortThName; Label10.Text = curriculum.CurrEnName; Label11.Text = curriculum.CurrShortEnName; if (CurrCode != "999999999") { //ชื่อปริญญาและสาขาวิชา Label12.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainThName; Label13.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainThShortName; Label14.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainEnName; Label15.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainEnShortName; //วันที่อนุมัติหลักสูตร และภาคการศึกษาที่เริ่มใช้หลักสูตร Label16.Text = new utility().getThaiBirthDay(curriculum.ApprovedDate); Label17.Text = curriculum.BeginSemester + "/" + curriculum.YearVersion; //จำนวนหน่วยกิตที่เรียนตลอดหลักสูตร Label18.Text = structurePlan.TotalCredits + " หน่วยกิต"; } //รูปแบบของหลักสูตร string sqlStructurePlan = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'"; List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sqlStructurePlan); foreach (StructurePlan data in dataStructurePlan) { Label19.Text = new CurrFormat().getCurrFormat(data.CurrFormatCode).CurrFormatName; if (dataStructurePlan.Count > 1) { Label19.Text += "<br>"; } //Tab 2: โครงสร้างหลักสูตร htmlGenerateTab2(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode); //Tab 3: รายวิชาในหลักสูตร htmlGenerateTab3(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode); //Tab 4: แผนการศึกษา htmlGenerateTab4(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode); //Tab 5: คำอธิบายรายวิชา htmlGenerateTab5(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode); } Label20.Text = curriculum.NumYear + " ปี / " + curriculum.MaxNumYear + " ปี"; //อาจารย์ผู้รับผิดชอบหลักสูตร //ความหมาย LOADTYPECODE //1 อาจารย์ประจำหลักสูตร //4 อาจารย์ประจำแขนง string sqlLecturer = "Select * From ABOUTLECTURER Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And LOADTYPECODE='1' Order By LECTIDENTITY"; List <AboutLecturer> aboutLecturer = new AboutLecturer().getAboutLecturerManual(sqlLecturer); int i = 1; foreach (AboutLecturer data in aboutLecturer) { SysUser sysUser = new SysUser().getSysUser(data.LectIdentity); AcademicPosition position = new AcademicPosition().getAcademicPosition(sysUser.AcademicPositionCode); Label21.Text += "<span class=\"report-indent-1em\">" + i + ". " + position.AcademicPositionThName + sysUser.ThName + " " + sysUser.ThSurName + "</span><BR>"; i++; } //Export to PDF utility utname = new utility(); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=" + CurrCode + ".pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); dvHtml.RenderControl(hw); StringReader sr = new StringReader(sw.ToString()); Document pdfDoc = new Document(PageSize.A4, 50f, 50f, 50f, 50f); //Document pdfDoc = new Document(PageSize.A4.Rotate(), 50f, 50f, 10f, 10f); HTMLWorker htmlparser = new HTMLWorker(pdfDoc); PdfWriter.GetInstance(pdfDoc, Response.OutputStream); pdfDoc.Open(); StyleSheet styles = new StyleSheet(); FontFactory.Register(Server.MapPath("~/Fonts/") + "THSarabunNew.ttf"); styles.LoadTagStyle("body", HtmlTags.FACE, "THSarabunNew"); styles.LoadTagStyle("body", "size", "16pt"); styles.LoadTagStyle("body", "encoding", BaseFont.IDENTITY_H); styles.LoadTagStyle(HtmlTags.TABLE, "width", "100%"); styles.LoadTagStyle(HtmlTags.TABLE, "align", "center"); styles.LoadTagStyle(HtmlTags.TABLE, HtmlTags.BORDER, "0"); styles.LoadTagStyle(HtmlTags.TH, HtmlTags.BORDER, "0"); styles.LoadTagStyle(HtmlTags.TD, HtmlTags.BORDER, "0"); htmlparser.SetStyleSheet(styles); htmlparser.Parse(sr); pdfDoc.Close(); Response.Write(pdfDoc); Response.End(); //End Export to PDF }