/// <summary> /// เรียกดูข้อมูลจากตาราง DIVISIONEXTENSION /// </summary> /// <returns>ข้อมูลจากตาราง DIVISIONEXTENSION</returns> public List <DivisionExtension> getDivisionExtension() { List <DivisionExtension> data = new List <DivisionExtension>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = "Select * From DIVISIONEXTENSION Order By DIVISIONCODE"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { DivisionExtension row = new DivisionExtension(); row.CurrCode = rowData["CURRCODE"].ToString(); row.YearVersion = rowData["YEARVERSION"].ToString(); row.DivisionNo = rowData["DIVISIONNO"].ToString(); row.DivisionCode = rowData["DIVISIONCODE"].ToString(); data.Add(row); } return(data); }
/// <summary> /// เพิ่มข้อมูลลงตาราง DIVISIONEXTENSION /// </summary> /// <param name="dataInsert">DivisionExtension Object</param> /// <returns>Success</returns> public string insertDivisionExtension(DivisionExtension dataInsert) { string response = ""; //int sleepTime = 5000; //string DivisionNo = dataInsert.DivisionNo; //for (int i = 0; i < 10; i++) //{ // if (getDivisionExtension(DivisionNo).DivisionNo != null) // { // Thread.Sleep(sleepTime); // DivisionNo = new utility().getMaxID("DIVISIONNO", "DIVISIONEXTENSION"); // sleepTime += 5000; // } // else // { // dataInsert.DivisionNo = DivisionNo; // break; // } //} ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); string sql = "Insert into DIVISIONEXTENSION (CURRCODE, YEARVERSION, DIVISIONNO, DIVISIONCODE) values ('" + dataInsert.CurrCode + "','" + dataInsert.YearVersion + "','" + dataInsert.DivisionNo + "','" + dataInsert.DivisionCode + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "Success"; } } catch (Exception e) { string exception = e.Message; HttpContext.Current.Session["response"] = "insertDivisionExtension: " + exception; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(response); }
/// <summary> /// เรียกดูข้อมูลจากตาราง DIVISIONEXTENSION /// </summary> /// <param name="DivisionNo">รหัสสาขาที่ใช้ขยาย extension</param> /// <returns>ข้อมูลจากตาราง DIVISIONEXTENSION</returns> public DivisionExtension getDivisionExtension(string DivisionNo) { DivisionExtension data = new DivisionExtension(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = "Select * From DIVISIONEXTENSION Where DIVISIONNO='" + DivisionNo + "'"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { data.CurrCode = rowData["CURRCODE"].ToString(); data.YearVersion = rowData["YEARVERSION"].ToString(); data.DivisionNo = rowData["DIVISIONNO"].ToString(); data.DivisionCode = rowData["DIVISIONCODE"].ToString(); } return(data); }
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 btnNext_Click(object sender, EventArgs e) { TQF.Curriculum curriculumData = new TQF.Curriculum(); if (rBtnNEW_CURR.Checked) { //สถานะของหลักสูตร(1=ใหม่, 2=ปรับปรุง) curriculumData.CurrStatus = "1"; } else if (rBtnMINOR_MODI_CURR.Checked) { //สถานะของหลักสูตร(1=ใหม่, 2=ปรับปรุง) curriculumData.CurrStatus = "2"; } else { //สถานะของหลักสูตร(1=ใหม่, 2=ปรับปรุง) curriculumData.CurrStatus = "1"; } curriculumData.ApproveStatus = "N"; // สถานะอนุญาตการนำไปใช้ (N=ไม่ให้นำไปใช้,Y=นำไปใช้ได้) curriculumData.CurrCode = txtCURR_CODE.Text; curriculumData.YearVersion = txtCURR_YEAR_VERSION.Text; curriculumData.BeginSemester = ddlCURR_SEMESTER.SelectedValue; curriculumData.BeginYear = txtCURR_YEAR.Text; curriculumData.LevelCode = ddlDegree.SelectedValue; curriculumData.CurrThName = txtCURR_THAINAME.Text; curriculumData.CurrEnName = txtCURR_ENGNAME.Text; //curriculumData.CurrShortThName = txtCURR_SHORT_THAINAME.Text; //curriculumData.CurrShortEnName = txtCURR_SHORT_ENGNAME.Text; curriculumData.CurrShortThName = ""; curriculumData.CurrShortEnName = ""; Diploma diploma = new Diploma(); diploma.YearVersion = txtCURR_YEAR_VERSION.Text; diploma.DiplomaCode = new TQF.TQFUtility().getMaxID("DIPLOMACODE", "DIPLOMA"); diploma.CurrCode = txtCURR_CODE.Text; diploma.DomainThName = txtDIP_THAINAME.Text; diploma.DomainEnName = txtDIP_ENGNAME.Text; diploma.DomainThShortName = txtDIP_SHORT_THAINAME.Text; diploma.DomainEnShortName = txtDIP_SHORT_ENGNAME.Text; string insertDiploma = new Diploma().insertDiploma(diploma); curriculumData.DiplomaCode = diploma.DiplomaCode; curriculumData.FacultyCode = ddlCURR_FACULTY.SelectedValue; curriculumData.DepartmentCode = ddlCURR_DEPARTMENT.SelectedValue; int DivisionNo = int.Parse(new TQF.TQFUtility().getMaxID("DIVISIONNO", "DIVISIONEXTENSION")); foreach (ListItem li in ddlCURR_MAJOR.Items) { if (li.Selected) { DivisionExtension row = new DivisionExtension(); row.CurrCode = txtCURR_CODE.Text; row.YearVersion = txtCURR_YEAR_VERSION.Text; row.DivisionNo = DivisionNo.ToString();; row.DivisionCode = li.Value; string insertDivisionExtension = new DivisionExtension().insertDivisionExtension(row); if (insertDivisionExtension == "Success") { continue; } else { string sql = "Delete From DIVISIONEXTENSION Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteDivisionExtension = new DivisionExtension().deleteDivisionExtensionMaual(sql); Response.Redirect("Faculty_add_CURR1.aspx"); } } } //เรียกดูค่า DivisionNo ก่อน Insert ลงตาราง CURRICULUM string sqlDivisionExtension = "Select * From DIVISIONEXTENSION Where CURRCODE='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; List <DivisionExtension> DivisionNoList = new DivisionExtension().getDivisionExtensionManual(sqlDivisionExtension); curriculumData.DivisionCode = DivisionNoList[0].DivisionNo; curriculumData.NumYear = txtSTUDY_YEAR.Text; curriculumData.MaxNumYear = txtTOTAL_STUDY_YEAR.Text; foreach (ListItem li in ddlLECTURER.Items) { if (li.Selected) { int sequence = int.Parse(new TQF.TQFUtility().getMaxID("SEQUENCE", "ABOUTLECTURER")); //sequence++; AboutLecturer aboutlecturer = new AboutLecturer(); aboutlecturer.CurrCode = txtCURR_CODE.Text; aboutlecturer.YearVersion = txtCURR_YEAR_VERSION.Text; aboutlecturer.LectIdentity = li.Value; aboutlecturer.LoadTypeCode = "1"; //1 = อาจารย์ประจำหลักสูตร (ข้อมูลจากตาราง LoadType) aboutlecturer.Sequence = sequence.ToString(); aboutlecturer.MajorCode = "0000"; string insertAboutlecturer = new AboutLecturer().insertAboutLecturer(aboutlecturer); if (insertAboutlecturer == "Success") { continue; } else { string sql = "Delete From ABOUTLECTURER Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteAboutLecturer = new AboutLecturer().deleteAboutLecturerManual(sql); Response.Redirect("Faculty_add_CURR1.aspx"); } } } curriculumData.MajorStatus = ddlMAJORSTATUS.SelectedValue; curriculumData.NumTQF1 = ddlTQF1.SelectedValue; curriculumData.ApprovedDate = txtDateApprove.Text; string insertCurriculum = new TQF.Curriculum().insertCurriculum(curriculumData); //สร้าง session NumTQF1 ไว้สำหรับ หน้า Faculty_add_CURR2.aspx //เพื่อ add learning outcome (addLOC.aspx) ให้ถูกหมวด Session["NumTQF1"] = ddlTQF1.SelectedValue; //สร้าง session CurrCode ไว้ใช้สำหรับทุกหน้าในการสร้างหลักสูตร Session["CurrCode"] = txtCURR_CODE.Text; Session["YearVersion"] = txtCURR_YEAR_VERSION.Text; //เช็คว่ามีแขนงวิชา/กลุ่มวิชา หรือไม่มี if (ddlMAJORSTATUS.SelectedValue == "0") { //Response.Redirect("Faculty_add_CURR2.aspx?CurrCode=" + txtCURR_CODE.Text + "&YearVersion=" + txtCURR_YEAR_VERSION.Text + ""); Response.Redirect("Faculty_add_CURR2.aspx"); } if (ddlMAJORSTATUS.SelectedValue == "1") { //Response.Redirect("Faculty_add_CURR1_1.aspx?CurrCode=" + txtCURR_CODE.Text + "&YearVersion=" + txtCURR_YEAR_VERSION.Text + ""); Response.Redirect("Faculty_add_CURR1_1.aspx"); } }
protected void btnNext_Click(object sender, EventArgs e) { TQF.Curriculum curriUpdateData = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion); TQF.Curriculum curriculumData = new TQF.Curriculum(); if (rBtnNEW_CURR.Checked) { //สถานะของหลักสูตร(1=ใหม่, 2=ปรับปรุง) curriculumData.CurrStatus = "1"; } else if (rBtnMINOR_MODI_CURR.Checked) { //สถานะของหลักสูตร(1=ใหม่, 2=ปรับปรุง) curriculumData.CurrStatus = "2"; } else { //สถานะของหลักสูตร(1=ใหม่, 2=ปรับปรุง) curriculumData.CurrStatus = "1"; } curriculumData.ApproveStatus = curriUpdateData.ApproveStatus; // สถานะอนุญาตการนำไปใช้ (N=ไม่ให้นำไปใช้,Y=นำไปใช้ได้) curriculumData.CurrCode = txtCURR_CODE.Text; curriculumData.YearVersion = txtCURR_YEAR_VERSION.Text; curriculumData.BeginSemester = ddlCURR_SEMESTER.SelectedValue; curriculumData.BeginYear = txtCURR_YEAR.Text; curriculumData.LevelCode = ddlDegree.SelectedValue; curriculumData.CurrThName = txtCURR_THAINAME.Text; curriculumData.CurrEnName = txtCURR_ENGNAME.Text; //curriculumData.CurrShortThName = txtCURR_SHORT_THAINAME.Text; //curriculumData.CurrShortEnName = txtCURR_SHORT_ENGNAME.Text; curriculumData.CurrShortThName = ""; curriculumData.CurrShortEnName = ""; //// Diploma diploma = new Diploma(); diploma.YearVersion = curriUpdateData.YearVersion; diploma.DiplomaCode = curriUpdateData.DiplomaCode; diploma.CurrCode = curriUpdateData.CurrCode; diploma.DomainThName = txtDIP_THAINAME.Text; diploma.DomainEnName = txtDIP_ENGNAME.Text; diploma.DomainThShortName = txtDIP_SHORT_THAINAME.Text; diploma.DomainEnShortName = txtDIP_SHORT_ENGNAME.Text; string sqlDipChk = "Select * From DIPLOMA Where CURRCODE ='" + curriUpdateData.CurrCode + "' And YEARVERSION='" + curriUpdateData.YearVersion + "' And DIPLOMACODE='" + curriUpdateData.DiplomaCode + "'"; List <Diploma> dipChk = new Diploma().getDiplomaManual(sqlDipChk); if (dipChk.Count == 0) { string insertDiploma = new Diploma().insertDiploma(diploma); } else { string updateDiploma = new Diploma().updateDiploma(diploma); } ///// curriculumData.DiplomaCode = diploma.DiplomaCode; curriculumData.FacultyCode = ddlCURR_FACULTY.SelectedValue; curriculumData.DepartmentCode = ddlCURR_DEPARTMENT.SelectedValue; ///// //Delete DivisionCode ก่อนแล้วค่อย Insert ภายหลัง string sqlDeleteDivisionExtension = "Delete From DIVISIONEXTENSION Where CURRCODE ='" + curriUpdateData.CurrCode + "' And YEARVERSION='" + curriUpdateData.YearVersion + "' And DIVISIONNO='" + curriUpdateData.DivisionCode + "'"; string deleteDivisionExtension = new DivisionExtension().deleteDivisionExtensionMaual(sqlDeleteDivisionExtension); if (deleteDivisionExtension == "Success") { foreach (ListItem li in ddlCURR_MAJOR.Items) { if (li.Selected) { DivisionExtension row = new DivisionExtension(); row.CurrCode = CurrCode; // txtCURR_CODE.Text; row.YearVersion = YearVersion; // txtCURR_YEAR_VERSION.Text; row.DivisionNo = curriUpdateData.DivisionCode; //Id มาจากตาราง CURRICULUM row.DivisionCode = li.Value; string insertDivisionExtension = new DivisionExtension().insertDivisionExtension(row); if (insertDivisionExtension == "Success") { continue; } else { string sql = "Delete From DIVISIONEXTENSION Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteDivisionExtension2 = new DivisionExtension().deleteDivisionExtensionMaual(sql); Response.Redirect("Faculty_edit_CURR.aspx?CurrCode=" + curriUpdateData.CurrCode + "&YearVersion=" + curriUpdateData.YearVersion + ""); } } } } else { string sqlChkDivisionExtension = "Select * From DIVISIONEXTENSION Where CURRCODE ='" + curriUpdateData.CurrCode + "' And YEARVERSION='" + curriUpdateData.YearVersion + "' And DIVISIONNO='" + curriUpdateData.DivisionCode + "'"; List <DivisionExtension> liDiv = new DivisionExtension().getDivisionExtensionManual(sqlChkDivisionExtension); if (liDiv.Count == 0) { foreach (ListItem li in ddlCURR_MAJOR.Items) { if (li.Selected) { DivisionExtension row = new DivisionExtension(); row.CurrCode = CurrCode; // txtCURR_CODE.Text; row.YearVersion = YearVersion; // txtCURR_YEAR_VERSION.Text; row.DivisionNo = curriUpdateData.DivisionCode; //Id มาจากตาราง CURRICULUM row.DivisionCode = li.Value; string insertDivisionExtension = new DivisionExtension().insertDivisionExtension(row); if (insertDivisionExtension == "Success") { continue; } else { string sql = "Delete From DIVISIONEXTENSION Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteDivisionExtension2 = new DivisionExtension().deleteDivisionExtensionMaual(sql); Response.Redirect("Faculty_edit_CURR.aspx?CurrCode=" + curriUpdateData.CurrCode + "&YearVersion=" + curriUpdateData.YearVersion + ""); } } } } } ///// curriculumData.DivisionCode = curriUpdateData.DivisionCode; //Id มาจากตาราง CURRICULUM curriculumData.NumYear = txtSTUDY_YEAR.Text; curriculumData.MaxNumYear = txtTOTAL_STUDY_YEAR.Text; ///// //Delete AboutLecturer ก่อนแล้วค่อย Insert ภายหลัง string sqlDeleteAboutLecturer = "Delete From ABOUTLECTURER Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "' And MAJORCODE='0000' And LOADTYPECODE='1'"; string deleteAboutLecturer = new AboutLecturer().deleteAboutLecturerManual(sqlDeleteAboutLecturer); //if (deleteAboutLecturer == "Success") //{ foreach (ListItem li in ddlLECTURER.Items) { if (li.Selected) { int sequence = int.Parse(new TQF.TQFUtility().getMaxID("SEQUENCE", "ABOUTLECTURER")); //sequence++; AboutLecturer aboutlecturer = new AboutLecturer(); aboutlecturer.CurrCode = txtCURR_CODE.Text; aboutlecturer.YearVersion = txtCURR_YEAR_VERSION.Text; //aboutlecturer.CurrCode = CurrCode;// txtCURR_CODE.Text; //aboutlecturer.YearVersion = YearVersion;// txtCURR_YEAR_VERSION.Text; aboutlecturer.LectIdentity = li.Value; aboutlecturer.LoadTypeCode = "1"; //1 = อาจารย์ประจำหลักสูตร (ข้อมูลจากตาราง LoadType) aboutlecturer.Sequence = sequence.ToString(); aboutlecturer.MajorCode = "0000"; string insertAboutlecturer = new AboutLecturer().insertAboutLecturer(aboutlecturer); if (insertAboutlecturer == "Success") { continue; } else { string sql = "Delete From ABOUTLECTURER Where CURRCODE ='" + txtCURR_CODE.Text + "' And YEARVERSION='" + txtCURR_YEAR_VERSION.Text + "'"; string deleteAboutLecturer2 = new AboutLecturer().deleteAboutLecturerManual(sql); Response.Redirect("Faculty_edit_CURR.aspx?CurrCode=" + curriUpdateData.CurrCode + "&YearVersion=" + curriUpdateData.YearVersion + ""); } } } //} //// curriculumData.MajorStatus = ddlMAJORSTATUS.SelectedValue; curriculumData.NumTQF1 = ddlTQF1.SelectedValue; curriculumData.ApprovedDate = txtDateApprove.Text; string sqlUpdateCurriculum = "Update CURRICULUM Set LEVELCODE = '" + curriculumData.LevelCode + "', FACULTYCODE = '" + curriculumData.FacultyCode + "', DEPARTMENTCODE = '" + curriculumData.DepartmentCode + "', DIVISIONNO = '" + curriculumData.DivisionCode + "', CURRSTATUS = '" + curriculumData.CurrStatus + "', APPROVESTATUS = '" + curriculumData.ApproveStatus + "', CURRTHNAME = '" + curriculumData.CurrThName + "', CURRENNAME = '" + curriculumData.CurrEnName + "', DIPLOMACODE = '" + curriculumData.DiplomaCode + "', NUMYEAR = '" + curriculumData.NumYear + "', MAXNUMYEAR = '" + curriculumData.MaxNumYear + "', BEGINYEAR = '" + curriculumData.BeginYear + "', BEGINSEMESTER = '" + curriculumData.BeginSemester + "', MAJORSTATUS = '" + curriculumData.MajorStatus + "', NUMTQF1 = '" + curriculumData.NumTQF1 + "', CURRSHORTTHNAME = '" + curriculumData.CurrShortThName + "', CURRSHORTENNAME = '" + curriculumData.CurrShortEnName + "', APPROVEDDATE = '" + curriculumData.ApprovedDate + "' Where CURRCODE = '" + curriculumData.CurrCode + "' And YEARVERSION='" + curriculumData.YearVersion + "'"; string updateCurriculum = new TQF.Curriculum().updateCurriculumManual(sqlUpdateCurriculum); //สร้าง session NumTQF1 ไว้สำหรับ หน้า Faculty_add_CURR2.aspx //เพื่อ add learning outcome (addLOC.aspx) ให้ถูกหมวด Session["NumTQF1"] = ddlTQF1.SelectedValue; //สร้าง session CurrCode ไว้ใช้สำหรับทุกหน้าในการสร้างหลักสูตร Session["CurrCode"] = txtCURR_CODE.Text; Session["YearVersion"] = txtCURR_YEAR_VERSION.Text; //เช็คว่ามีแขนงวิชา/กลุ่มวิชา หรือไม่มี if (ddlMAJORSTATUS.SelectedValue == "0") { //delete อาจารย์จากตาราง AboutLecturer กรณีเลือก ไม่มีแขนงวิชา สำหรับเวลาแก้ไข string sqlAboutLecturer = "Delete From ABOUTLECTURER Where CURRCODE ='" + CurrCode + "' And YEARVERSION ='" + YearVersion + "' And LOADTYPECODE ='4'"; string deleteAboutLecturerEdit = new AboutLecturer().deleteAboutLecturerManual(sqlAboutLecturer); //delete ข้อมูลตาราง Major กรณีเลือก ไม่มีแขนงวิชา สำหรับเวลาแก้ไข string sqlMajor = "Delete From MAJOR Where YEARVERSION ='" + YearVersion + "' And CURRCODE ='" + CurrCode + "'"; string deleteMajor = new TQF.Major().deleteMajorManual(sqlMajor); //Response.Redirect("Faculty_add_CURR2.aspx?CurrCode=" + txtCURR_CODE.Text + "&YearVersion=" + txtCURR_YEAR_VERSION.Text + ""); Response.Redirect("Faculty_add_CURR2.aspx"); } if (ddlMAJORSTATUS.SelectedValue == "1") { //Response.Redirect("Faculty_add_CURR1_1.aspx?CurrCode=" + txtCURR_CODE.Text + "&YearVersion=" + txtCURR_YEAR_VERSION.Text + ""); Response.Redirect("Faculty_add_CURR1_1.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 =========== bool editable = false; CurrCode = Request.QueryString["CurrCode"]; YearVersion = Request.QueryString["YearVersion"]; TQF.Curriculum curriculum = new TQF.Curriculum(); TQF.Curriculum curriculumData = curriculum.getCurriculum(CurrCode, YearVersion); //หลักสูตร if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty)) { editable = true; } // วิชาการคณะ //else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty)) //{ // List<string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty); // foreach (string fac in faculty_authorized) // { // if (fac == curriculumData.FacultyCode) // { // editable = true; // break; // } // } //} // วิชาการภาค else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department); foreach (string dep in department_authorized) { if (dep == curriculumData.DepartmentCode) { editable = true; break; } } } if (!Page.IsPostBack) { if (editable == true) { if (curriculumData.CurrStatus == "1") { //สถานะของหลักสูตร(1=ใหม่, 2=ปรับปรุง) rBtnNEW_CURR.Checked = true; } else if (curriculumData.CurrStatus == "2") { //สถานะของหลักสูตร(1=ใหม่, 2=ปรับปรุง) rBtnMINOR_MODI_CURR.Checked = true; } else { //สถานะของหลักสูตร(1=ใหม่, 2=ปรับปรุง) rBtnNEW_CURR.Checked = true; } txtCURR_CODE.Text = curriculumData.CurrCode; txtCURR_YEAR_VERSION.Text = curriculumData.YearVersion; try { ddlCURR_SEMESTER.Items.FindByValue(curriculumData.BeginSemester).Selected = true; } catch { } txtCURR_YEAR.Text = curriculumData.BeginYear; List <TQF.Levels> levels = new TQF.Levels().getLevels(); ddlDegree.Items.Clear(); ddlDegree1.Items.Clear(); foreach (TQF.Levels row in levels) { ddlDegree.Items.Insert(ddlDegree.Items.Count, new ListItem(row.LevelName, row.LevelCode)); ddlDegree1.Items.Insert(ddlDegree1.Items.Count, new ListItem(row.LevelName, row.LevelCode)); } try { ddlDegree.Items.FindByValue(curriculumData.LevelCode).Selected = true; ddlDegree1.Items.FindByValue(curriculumData.LevelCode).Selected = true; } catch { } txtCURR_THAINAME.Text = curriculumData.CurrThName; txtCURR_ENGNAME.Text = curriculumData.CurrEnName; //txtCURR_SHORT_THAINAME.Text = curriculumData.CurrShortThName; //txtCURR_SHORT_ENGNAME.Text = curriculumData.CurrShortEnName; txtDIP_THAINAME.Text = new Diploma().getDiploma(curriculumData.DiplomaCode).DomainThName; txtDIP_ENGNAME.Text = new Diploma().getDiploma(curriculumData.DiplomaCode).DomainEnName; txtDIP_SHORT_THAINAME.Text = new Diploma().getDiploma(curriculumData.DiplomaCode).DomainThShortName; txtDIP_SHORT_ENGNAME.Text = new Diploma().getDiploma(curriculumData.DiplomaCode).DomainEnShortName; List <FacultyData> faculty = new Faculty().getFaculty(); ddlCURR_FACULTY.Items.Clear(); foreach (FacultyData row in faculty) { ddlCURR_FACULTY.Items.Insert(ddlCURR_FACULTY.Items.Count, new ListItem(row.Faculty_Thai, row.Faculty_Code)); } try { ddlCURR_FACULTY.Items.FindByValue(curriculumData.FacultyCode).Selected = true; } catch { } List <DepartmentData> department = new Department().getDepartment(); ddlCURR_DEPARTMENT.Items.Clear(); foreach (DepartmentData row in department) { ddlCURR_DEPARTMENT.Items.Insert(ddlCURR_DEPARTMENT.Items.Count, new ListItem(row.Department_Thai, row.Department_Code)); } try { ddlCURR_DEPARTMENT.Items.FindByValue(curriculumData.DepartmentCode).Selected = true; } catch { } string sqlDivision = "Select * From DIVISION Where DEPARTMENTCODE = " + curriculumData.DepartmentCode; List <TQF.Division> division = new TQF.Division().getDivisionManual(sqlDivision); ddlCURR_MAJOR.Items.Clear(); foreach (TQF.Division row in division) { ddlCURR_MAJOR.Items.Insert(ddlCURR_MAJOR.Items.Count, new ListItem(row.DivisionThName + " ( " + row.DivisionEnShortName + " )", row.DivisionCode)); } string sqlDivisionExtension = "Select * From DIVISIONEXTENSION Where DIVISIONNO='" + curriculumData.DivisionCode + "'"; List <DivisionExtension> divisionExtension = new DivisionExtension().getDivisionExtensionManual(sqlDivisionExtension); foreach (DivisionExtension row in divisionExtension) { try { ddlCURR_MAJOR.Items.FindByValue(row.DivisionCode).Selected = true; } catch { } } txtSTUDY_YEAR.Text = curriculumData.NumYear; txtTOTAL_STUDY_YEAR.Text = curriculumData.MaxNumYear; List <SysUser> sysUser = new SysUser().getSysUser(); ddlLECTURER.Items.Clear(); foreach (SysUser row in sysUser) { string sql = "Select * From ABOUTLECTURER Where LECTIDENTITY='" + row.IdCode + "'"; List <AboutLecturer> aboutLecturer = new AboutLecturer().getAboutLecturerManual(sql); //เช็คว่าอาจารย์ประจำหลักสูตรไปแล้วหรือยัง if (aboutLecturer.Count > 0) { string sql2 = "Select * From ABOUTLECTURER Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And LECTIDENTITY='" + row.IdCode + "' And LOADTYPECODE='1'"; List <AboutLecturer> aboutLecturer2 = new AboutLecturer().getAboutLecturerManual(sql2); foreach (AboutLecturer li in aboutLecturer2) { if (li.LectIdentity == row.IdCode) { ddlLECTURER.Items.Insert(ddlLECTURER.Items.Count, new ListItem(row.ThName + " " + row.ThSurName + " (" + row.ShortName + ")", row.IdCode)); ddlLECTURER.Items.FindByValue(row.IdCode).Selected = true; } } continue; } else { ddlLECTURER.Items.Insert(ddlLECTURER.Items.Count, new ListItem(row.ThName + " " + row.ThSurName + " (" + row.ShortName + ")", row.IdCode)); } } try { ddlMAJORSTATUS.Items.FindByValue(curriculumData.MajorStatus).Selected = true; } catch { } List <TQF1> tqf1 = new TQF1().getTQF1(); ddlTQF1.Items.Clear(); foreach (TQF1 row in tqf1) { ddlTQF1.Items.Insert(ddlTQF1.Items.Count, new ListItem(row.TQF1Major, row.NumTQF1)); if (curriculumData.NumTQF1 == row.NumTQF1) { ddlTQF1.Items.FindByValue(curriculumData.NumTQF1).Selected = true; } } //ddlTQF1.Items.FindByValue(curriculumData.NumTQF1).Selected = true; txtDateApprove.Text = curriculumData.ApprovedDate; } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } //========================= } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }