Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrCode    = Request.QueryString["CurrCode"];
        YearVersion = Request.QueryString["YearVersion"];
        MajorCode   = Request.QueryString["MajorCode"];

        if (!Page.IsPostBack)
        {
            TQF.Major major = new TQF.Major().getMajor(MajorCode);

            lblTextToRemove.Text = "แขนงวิชา" + major.MajorThName + " (" + major.MajorEnName + ")";
        }
    }
    protected void tableBody(Table tblName)
    {
        string           sql   = "Select * From MAJOR Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
        List <TQF.Major> major = new TQF.Major().getMajorManual(sql);

        foreach (TQF.Major rowMajor in major)
        {
            TableRow row = new TableRow();
            //Cell [0]
            TableCell cellSpecialField_Thai = new TableCell();
            cellSpecialField_Thai.Text = new SpecialField().getSpecialField(rowMajor.MajorCode).SpecialField_Thai;
            row.Cells.Add(cellSpecialField_Thai);

            //Cell [1]
            TableCell cellSpecialField_Eng = new TableCell();
            cellSpecialField_Eng.Text = new SpecialField().getSpecialField(rowMajor.MajorCode).SpecialField_Eng;
            row.Cells.Add(cellSpecialField_Eng);

            //Cell [2]
            TableCell            cellAboutLecturer = new TableCell();
            string               sqlAboutLecturer  = "Select * From ABOUTLECTURER Where MAJORCODE='" + rowMajor.MajorCode + "' And CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And MAJORCODE != 0000";
            List <AboutLecturer> aboutLecturer     = new AboutLecturer().getAboutLecturerManual(sqlAboutLecturer);
            foreach (AboutLecturer li in aboutLecturer)
            {
                SysUser sysUser = new SysUser().getSysUser(li.LectIdentity);
                cellAboutLecturer.Text += sysUser.ThName + " " + sysUser.ThSurName + " (" + sysUser.ShortName + ")" + "<br>";
            }
            row.Cells.Add(cellAboutLecturer);

            //Cell [3]
            TableCell cellDel = new TableCell();
            string    urlDel  = "deleteMAJOR.aspx?CurrCode=" + rowMajor.CurrCode + "&YearVersion=" + rowMajor.YearVersion + "&MajorCode=" + rowMajor.MajorCode;
            HyperLink hypDel  = new HyperLink();
            hypDel.Attributes.Add("data-target", "#deleteMAJOR");
            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);

            tblMajor.Rows.Add(row);
        }
    }
Exemple #3
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        string sqlMajor    = "Delete From MAJOR Where MAJORCODE ='" + MajorCode + "' And YEARVERSION ='" + YearVersion + "' And CURRCODE ='" + CurrCode + "'";
        string deleteMajor = new TQF.Major().deleteMajorManual(sqlMajor);

        //if (deleteMajor == "Success")
        //{
        string sqlAboutLecturer    = "Delete From ABOUTLECTURER Where CURRCODE ='" + CurrCode + "' And YEARVERSION ='" + YearVersion + "' And MAJORCODE ='" + MajorCode + "'";
        string deleteAboutLecturer = new AboutLecturer().deleteAboutLecturerManual(sqlAboutLecturer);

        //if (deleteAboutLecturer == "Success")
        //{
        Response.Redirect("Faculty_add_CURR1_1.aspx?CurrCode=" + CurrCode + "&YearVersion=" + YearVersion);    // + "&MajorCode=" + MajorCode);
        //}
        //}
        //else
        //{
        //    Session["response"] = "ข้อมูลผิดพลาด ไม่สามารถทำงานได้ในขณะนี้";
        //    Response.Redirect("../err_response.aspx");
        //}
    }
Exemple #4
0
    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);
        }
    }
Exemple #5
0
    //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 btnADD_Click(object sender, EventArgs e)
    {
        string           sqlchkMajor = "Select * From MAJOR Where MAJORCODE='" + ddlMajor.SelectedValue + "'";
        List <TQF.Major> chkMajor    = new TQF.Major().getMajorManual(sqlchkMajor);

        if (chkMajor.Count > 0)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('แขนงวิชาซ้ำ!');", true);

            //เรียกข้อมูลอาจารย์ขึ้นมาใหม่เมื่อเวลาเก็บข้อมูลลงไปแล้วไม่สามารถนำกลับมาใช้ได้อีก
            List <SysUser> sysUser = new SysUser().getSysUser();
            ddlLecturer.Items.Clear();
            foreach (SysUser rowUser in sysUser)
            {
                string sql = "Select * From ABOUTLECTURER Where LECTIDENTITY='" + rowUser.IdCode + "'";
                List <AboutLecturer> aboutLecturer = new AboutLecturer().getAboutLecturerManual(sql);
                //เช็คว่าอาจารย์ประจำหลักสูตรไปแล้วหรือยัง
                if (aboutLecturer.Count > 0)
                {
                    continue;
                }
                else
                {
                    ddlLecturer.Items.Insert(ddlLecturer.Items.Count, new ListItem(rowUser.ThName + " " + rowUser.ThSurName + " (" + rowUser.ShortName + ")", rowUser.IdCode));
                }
            }
        }
        else
        {
            TableRow row = new TableRow();
            //Cell [0]
            TableCell cellSpecialField_Thai = new TableCell();
            cellSpecialField_Thai.Text = new SpecialField().getSpecialField(ddlMajor.SelectedValue).SpecialField_Thai;
            row.Cells.Add(cellSpecialField_Thai);

            //Cell [1]
            TableCell cellSpecialField_Eng = new TableCell();
            cellSpecialField_Eng.Text = new SpecialField().getSpecialField(ddlMajor.SelectedValue).SpecialField_Eng;
            row.Cells.Add(cellSpecialField_Eng);

            //Cell [2]
            TableCell cellAboutLecturer = new TableCell();

            foreach (ListItem li in ddlLecturer.Items)
            {
                if (li.Selected)
                {
                    int sequence = int.Parse(new TQF.TQFUtility().getMaxID("SEQUENCE", "ABOUTLECTURER"));

                    cellAboutLecturer.Text += li.Text + "<br>";

                    AboutLecturer aboutlecturer = new AboutLecturer();
                    aboutlecturer.CurrCode     = CurrCode;
                    aboutlecturer.YearVersion  = YearVersion;
                    aboutlecturer.LectIdentity = li.Value;
                    aboutlecturer.LoadTypeCode = "4"; //4 = อาจารย์ประจำแขนง (ข้อมูลจากตาราง LoadType)
                    aboutlecturer.Sequence     = sequence.ToString();
                    aboutlecturer.MajorCode    = ddlMajor.SelectedValue;

                    //add อาจารย์ลงตาราง AboutLecturer
                    string insertAboutlecturer = new AboutLecturer().insertAboutLecturer(aboutlecturer);
                }
            }
            row.Cells.Add(cellAboutLecturer);

            //เก็บข้อมูลแขนงวิชาลงตาราง Major
            TQF.Major major = new TQF.Major();
            major.MajorCode   = ddlMajor.SelectedValue;
            major.MajorThName = new SpecialField().getSpecialField(ddlMajor.SelectedValue).SpecialField_Thai;
            major.MajorEnName = new SpecialField().getSpecialField(ddlMajor.SelectedValue).SpecialField_Eng;
            major.CurrCode    = CurrCode;
            major.YearVersion = YearVersion;

            string insertMajor = new TQF.Major().insertMajor(major);

            //Cell [3]
            TableCell cellDel = new TableCell();
            string    urlDel  = "deleteMAJOR.aspx?CurrCode=" + major.CurrCode + "&YearVersion=" + major.YearVersion + "&MajorCode=" + major.MajorCode;
            HyperLink hypDel  = new HyperLink();
            hypDel.Attributes.Add("data-target", "#deleteMAJOR");
            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);

            tblMajor.Rows.Add(row);

            //เคลียร์ค่า selection คอนโทรล ddlMajor
            ddlMajor.ClearSelection();

            //เรียกข้อมูลอาจารย์ขึ้นมาใหม่เมื่อเวลาเก็บข้อมูลลงไปแล้วไม่สามารถนำกลับมาใช้ได้อีก
            List <SysUser> sysUser = new SysUser().getSysUser();
            ddlLecturer.Items.Clear();
            foreach (SysUser rowUser in sysUser)
            {
                string sql = "Select * From ABOUTLECTURER Where LECTIDENTITY='" + rowUser.IdCode + "'";
                List <AboutLecturer> aboutLecturer = new AboutLecturer().getAboutLecturerManual(sql);
                //เช็คว่าอาจารย์ประจำหลักสูตรไปแล้วหรือยัง
                if (aboutLecturer.Count > 0)
                {
                    continue;
                }
                else
                {
                    ddlLecturer.Items.Insert(ddlLecturer.Items.Count, new ListItem(rowUser.ThName + " " + rowUser.ThSurName + " (" + rowUser.ShortName + ")", rowUser.IdCode));
                }
            }
        }//end else
    }
Exemple #7
0
    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");
        }
    }
Exemple #8
0
    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 + ")";
                }

                if (!Page.IsPostBack)
                {
                    List <CurrFormat> currFormat = new CurrFormat().getCurrFormat();
                    ddlCURRFORMAT.Items.Clear();
                    ddlCURRFORMAT.Items.Insert(ddlCURRFORMAT.Items.Count, new ListItem("--- เลือกรูปแบบหลักสูตร ---", "0000"));
                    foreach (CurrFormat row in currFormat)
                    {
                        ddlCURRFORMAT.Items.Insert(ddlCURRFORMAT.Items.Count, new ListItem(row.CurrFormatName, row.CurrFormatCode));
                    }

                    //List<CurrType> currType = new CurrType().getCurrType();
                    ddlCURRTYPE.Items.Clear();
                    ddlCURRTYPE.Items.Insert(ddlCURRTYPE.Items.Count, new ListItem("--- เลือกลักษณะโครงสร้างหลักสูตร ---", "0000"));
                    //foreach (CurrType row in currType)
                    //{
                    //    ddlCURRTYPE.Items.Insert(ddlCURRTYPE.Items.Count, new ListItem(row.CurrTypeName, row.CurrTypeCode));
                    //}

                    string           sql   = "Select * From MAJOR Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
                    List <TQF.Major> major = new TQF.Major().getMajorManual(sql);
                    if (major.Count == 0)
                    {
                        ddlMAJOR.Items.Clear();
                        ddlMAJOR.Items.Insert(ddlMAJOR.Items.Count, new ListItem("--- ไม่มีแขนงวิชา/กลุ่มวิชา ---", "0000"));
                    }
                    else
                    {
                        ddlMAJOR.Items.Clear();
                        ddlMAJOR.Items.Insert(ddlMAJOR.Items.Count, new ListItem("--- เลือกแขนงวิชา/กลุ่มวิชา ---", "0000"));
                        foreach (TQF.Major row in major)
                        {
                            ddlMAJOR.Items.Insert(ddlMAJOR.Items.Count, new ListItem(row.MajorThName, row.MajorCode));
                        }
                    }

                    //List<CurrDisplay> currDisplay = new CurrDisplay().getCurrDisplay();
                    //ddlCURRDISPLAY.Items.Clear();
                    //ddlCURRDISPLAY.Items.Insert(ddlCURRDISPLAY.Items.Count, new ListItem("--- เลือกรุปแบบการแสดงผล ---", "00"));
                    //foreach (CurrDisplay row in currDisplay)
                    //{
                    //    ddlCURRDISPLAY.Items.Insert(ddlCURRDISPLAY.Items.Count, new ListItem(row.CurrDisplayName, row.CurrDisplayCode));
                    //}
                }

                tableHeader(tblCurriculum3);
                tableBody(tblCurriculum3);
                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }