protected void btnSAVE_Click(object sender, EventArgs e) { string Detail = ""; TQF2Sec4Sub1 data = new TQF2Sec4Sub1(); data.T2S4Sub1No = new TQF.TQFUtility().getMaxID("T2S4SUB1NO", "TQF2SEC4SUB1"); data.CurrCode = CurrCode; data.DomainTypeCode = domain; data.DetailType = detailType; data.Detail = txtTeachingMethods.Text; Detail = txtTeachingMethods.Text; data.YearVersion = YearVersion; //ตรวจสอบข้อมูลซ้ำ string sql = "Select * From TQF2SEC4SUB1 Where CURRCODE='" + CurrCode + "' And DOMAINTYPECODE='" + domain + "' And DETAILTYPE='" + detailType + "' And DETAIL='" + Detail + "' And YEARVERSION='" + YearVersion + "'"; List <TQF2Sec4Sub1> tqf2Sec4Sub1 = new TQF2Sec4Sub1().getTQF2Sec4Sub1Manual(sql); if (tqf2Sec4Sub1.Count > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('ข้อมูลซ้ำ!');", true); } else { //บันทึกข้อมูลลงฐานข้อมูล string insertData = new TQF2Sec4Sub1().insertTQF2Sec4Sub1(data); } //สร้าง session CurrCode ไว้ใช้สำหรับทุกหน้าในการสร้างหลักสูตร Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; Session["NumTQF1"] = NumTQF1; Response.Redirect("Faculty_add_CURR2.aspx"); }
/// <summary> /// แก้ไขข้อมูลจากตาราง TQF2SEC4SUB1 /// เฉพาะข้อมูล colum DETAIL เท่านั้น /// </summary> /// <param name="updateData">TQF2Sec4Sub1 Object</param> /// <returns>Success</returns> public string updateTQF2Sec4Sub1(TQF2Sec4Sub1 updateData) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); //string sql = "Update TQF2SEC4SUB1 Set CURRCODE = '" + updateData.CurrCode + "', DOMAINTYPECODE = '" + updateData.DomainTypeCode + "', DETAILTYPE = '" + updateData.DetailType + "', DETAIL = '" + updateData.Detail + "', YEARVERSION = '" + updateData.YearVersion + "' Where T2S4SUB1NO = '" + updateData.T2S4Sub1No + "'"; string sql = "Update TQF2SEC4SUB1 Set DETAIL = '" + updateData.Detail + "' Where T2S4SUB1NO = '" + updateData.T2S4Sub1No + "'"; oracleObj.UpdateCommand = sql; try { if (oracleObj.Update() == 1) { response = "Success"; } } catch (Exception e) { string exception = e.Message; HttpContext.Current.Session["response"] = "updateTQF2Sec4Sub1: " + exception; HttpContext.Current.Response.Redirect("../err_response.aspx"); } return(response); }
/// <summary> /// เรียกดูข้อมูลจากตาราง TQF2SEC4SUB1 /// </summary> /// <param name="sql">SQL Command</param> /// <returns>ข้อมูลจากตาราง TQF2SEC4SUB1</returns> public List <TQF2Sec4Sub1> getTQF2Sec4Sub1Manual(string sql) { List <TQF2Sec4Sub1> data = new List <TQF2Sec4Sub1>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { TQF2Sec4Sub1 row = new TQF2Sec4Sub1(); row.T2S4Sub1No = rowData["T2S4SUB1NO"].ToString(); row.CurrCode = rowData["CURRCODE"].ToString(); row.DomainTypeCode = rowData["DOMAINTYPECODE"].ToString(); row.DetailType = rowData["DETAILTYPE"].ToString(); row.Detail = rowData["DETAIL"].ToString(); row.YearVersion = rowData["YEARVERSION"].ToString(); data.Add(row); } return(data); }
protected void Page_Load(object sender, EventArgs e) { domain = Request.QueryString["domain"]; T2S4Sub1No = Request.QueryString["token"]; CurrCode = Session["CurrCode"].ToString(); YearVersion = Session["YearVersion"].ToString(); if (!Page.IsPostBack) { TQF2Sec4Sub1 data = new TQF2Sec4Sub1().getTQF2Sec4Sub1(T2S4Sub1No); txtTeachingMethods.Text = data.Detail; } }
protected void btnSAVE_Click(object sender, EventArgs e) { TQF2Sec4Sub1 data = new TQF2Sec4Sub1(); data.T2S4Sub1No = T2S4Sub1No; data.Detail = txtTeachingMethods.Text; string updateTQF2Sec4Sub1 = new TQF2Sec4Sub1().updateTQF2Sec4Sub1(data); //สร้าง session CurrCode ไว้ใช้สำหรับทุกหน้าในการสร้างหลักสูตร Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; Response.Redirect("Faculty_add_CURR2.aspx"); }
protected void btnOK_Click(object sender, EventArgs e) { string sql = "Select * From TQF2SEC4SUB1 Where T2S4SUB1NO='" + T2S4Sub1No + "'"; List <TQF2Sec4Sub1> data = new TQF2Sec4Sub1().getTQF2Sec4Sub1Manual(sql); if (data.Count > 0) { string deleteTQF2Sec4Sub1 = new TQF2Sec4Sub1().deleteTQF2Sec4Sub1(T2S4Sub1No); } //สร้าง session CurrCode ไว้ใช้สำหรับทุกหน้าในการสร้างหลักสูตร Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; Response.Redirect("Faculty_add_CURR2.aspx"); }
/// <summary> /// เพิ่มข้อมูลลงตาราง TQF2SEC4SUB1 /// </summary> /// <param name="dataInsert">TQF2Sec4Sub1 Object</param> /// <returns>Success</returns> public string insertTQF2Sec4Sub1(TQF2Sec4Sub1 dataInsert) { string response = ""; int sleepTime = 5000; string T2S4Sub1No = dataInsert.T2S4Sub1No; for (int i = 0; i < 10; i++) { if (getTQF2Sec4Sub1(T2S4Sub1No).T2S4Sub1No != null) { Thread.Sleep(sleepTime); T2S4Sub1No = new TQF.TQFUtility().getMaxID("T2S4SUB1NO", "TQF2SEC4SUB1"); sleepTime += 5000; } else { dataInsert.T2S4Sub1No = T2S4Sub1No; break; } } ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); string sql = "Insert into TQF2SEC4SUB1 (T2S4SUB1NO, CURRCODE, DOMAINTYPECODE, DETAILTYPE, DETAIL, YEARVERSION) values ('" + dataInsert.T2S4Sub1No + "','" + dataInsert.CurrCode + "','" + dataInsert.DomainTypeCode + "','" + dataInsert.DetailType + "','" + dataInsert.Detail + "','" + dataInsert.YearVersion + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "Success"; } } catch (Exception e) { string exception = e.Message; HttpContext.Current.Session["response"] = "insertTQF2Sec4Sub1: " + exception; HttpContext.Current.Response.Redirect("../err_response.aspx"); } return(response); }
/// <summary> /// เรียกดูข้อมูลจากตาราง TQF2SEC4SUB1 /// </summary> /// <param name="T2S4Sub1No">รหัสการพัฒนาคุณลักษณะพิเศษของนักศึกษา</param> /// <returns>ข้อมูลจากตาราง TQF2SEC4SUB1</returns> public TQF2Sec4Sub1 getTQF2Sec4Sub1(string T2S4Sub1No) { TQF2Sec4Sub1 data = new TQF2Sec4Sub1(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = "Select * From TQF2SEC4SUB1 Where T2S4SUB1NO='" + T2S4Sub1No + "'"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { data.T2S4Sub1No = rowData["T2S4SUB1NO"].ToString(); data.CurrCode = rowData["CURRCODE"].ToString(); data.DomainTypeCode = rowData["DOMAINTYPECODE"].ToString(); data.DetailType = rowData["DETAILTYPE"].ToString(); data.Detail = rowData["DETAIL"].ToString(); data.YearVersion = rowData["YEARVERSION"].ToString(); } return(data); }
protected void tableBody(Table tblName, string CurrCode, string DomainTypeCode) { tblName.Attributes.Add("class", "table table-striped"); //DETAILTYPE (1 = ผลการเรียน, 2 = กลยุทธ์การสอน, 3 = กลยุทธ์การประเมิน) string sql = "Select * From TQF2SEC4SUB1 Where CURRCODE='" + CurrCode + "' And DOMAINTYPECODE='" + DomainTypeCode + "' And DETAILTYPE='1' And YEARVERSION='" + YearVersion + "'"; List <TQF2Sec4Sub1> tqf2Sec4Sub1 = new TQF2Sec4Sub1().getTQF2Sec4Sub1Manual(sql); int No = 1; foreach (TQF2Sec4Sub1 row in tqf2Sec4Sub1) { TableRow tRowDetail = new TableRow(); tRowDetail.TableSection = TableRowSection.TableBody; TableCell cellDetail = new TableCell(); cellDetail.Text = No.ToString() + ". " + row.Detail; cellDetail.ColumnSpan = 4; tRowDetail.Cells.Add(cellDetail); tblName.Rows.Add(tRowDetail); TableRow tRowRadio = new TableRow(); tRowRadio.TableSection = TableRowSection.TableBody; TQF2Sec4CurriculumMapping chk = new TQF2Sec4CurriculumMapping().getTQF2Sec4CurriculumMapping(CurrCode, CourseCode, DomainTypeCode, row.T2S4Sub1No, YearVersion); //Cell [0-2] for (int j = 0; j < 3; j++) { TableCell cellChoice = new TableCell(); RadioButton radio = new RadioButton(); radio.ID = row.T2S4Sub1No + j.ToString(); radio.GroupName = DomainTypeCode + No; if (j == 1) { radio.Text = "<span><i class=\"fa fa-fw fa-circle\"></i>ความรับผิดชอบหลัก</span>"; } if (j == 2) { radio.Text = "<span><i class=\"fa fa-fw fa-circle-o\"></i>ความรับผิดชอบรอง</span>"; } if (j == 0) { radio.Text = "<span class=\"txt-red\"><i class=\"fa fa-fw fa-times\"></i></span>ไม่มี"; } if (chk.ResponseStatus == j.ToString()) { radio.Checked = true; } cellChoice.Controls.Add(radio); tRowRadio.Cells.Add(cellChoice); } //Cell [3] //เก็บ Id ไปใช้ในตาราง TQF2SEC4CURRICULUMMAPPING TableCell cellT2S4Sub1No = new TableCell(); cellT2S4Sub1No.Text = row.T2S4Sub1No; cellT2S4Sub1No.Visible = false; tRowRadio.Cells.Add(cellT2S4Sub1No); tblName.Rows.Add(tRowRadio); No++; } }
//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 btnSAVE_Click(object sender, EventArgs e) { TQF2Sec4Sub1 data = new TQF2Sec4Sub1(); string Detail = ""; foreach (TableRow row in tblLearningOutcomes.Rows) { var cell = row.Cells[0]; foreach (Control control in cell.Controls) { var checkBox = control as CheckBox; if (checkBox != null) { if (checkBox.Checked == true) { data.T2S4Sub1No = new TQF.TQFUtility().getMaxID("T2S4SUB1NO", "TQF2SEC4SUB1"); data.CurrCode = CurrCode; data.DomainTypeCode = domain; data.DetailType = detailType; data.Detail = row.Cells[1].Text; Detail = row.Cells[1].Text; data.YearVersion = YearVersion; //ตรวจสอบการใช้งาน textbox control var cell2 = row.Cells[1]; foreach (Control control2 in cell2.Controls) { var textBox = control2 as TextBox; if (textBox.Text != "") { data.Detail = textBox.Text; } else { data.Detail = ""; } } //ตรวจสอบข้อมูลซ้ำ string sql = "Select * From TQF2SEC4SUB1 Where CURRCODE='" + CurrCode + "' And DOMAINTYPECODE='" + domain + "' And DETAILTYPE='" + detailType + "' And DETAIL='" + Detail + "' And YEARVERSION='" + YearVersion + "'"; List <TQF2Sec4Sub1> tqf2Sec4Sub1 = new TQF2Sec4Sub1().getTQF2Sec4Sub1Manual(sql); if (tqf2Sec4Sub1.Count > 0) { continue; } else { //ตรวจสอบถ้า textbox control เป็นค่าว่างไม่ทำการบันทึกข้อมูล if (data.Detail == "") { continue; } else { //บันทึกข้อมูลลงฐานข้อมูล string insertData = new TQF2Sec4Sub1().insertTQF2Sec4Sub1(data); } } } } } } //สร้าง session CurrCode ไว้ใช้สำหรับทุกหน้าในการสร้างหลักสูตร Session["CurrCode"] = CurrCode; Session["YearVersion"] = YearVersion; Session["NumTQF1"] = NumTQF1; Response.Redirect("Faculty_add_CURR2.aspx"); }