Example #1
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.curriculum) || autro_obj.CheckGroupUser(login_data, group_var.officer_department) || autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
            {
                // ======== Process ===========
                CurrCode    = Request.QueryString["CurrCode"];
                YearVersion = Request.QueryString["YearVersion"];

                TQF.Curriculum curriculum = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion);
                lblCurricuumName.Text = "<span class=\"txt-blue\"><h4>" + curriculum.CurrThName + "<br>" + curriculum.CurrEnName + "</h4></span>";

                if (!Page.IsPostBack)
                {
                    ddlAPPROVESTATUS.Items.FindByValue(curriculum.ApproveStatus).Selected = true;
                }
                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                // ======== Process ===========
                //ทดสอบ ชั่วคราว ลบออกเมื่อใช้งานจริง
                //Session["CurrCode"] = "707012555";
                //Session["YearVersion"] = "2555";
                //Session["NumTQF1"] = "001";
                if (Session["CurrCode"] == null || Session["YearVersion"] == null || Session["NumTQF1"] == null)
                {
                    Response.Redirect("listCURR.aspx");
                }
                else
                {
                    CurrCode    = Session["CurrCode"].ToString();
                    YearVersion = Session["YearVersion"].ToString();
                    NumTQF1     = Session["NumTQF1"].ToString();
                }

                TQF.Curriculum currTitle = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion);
                lblHeader1.Text = currTitle.CurrCode + " หลักสูตร" + currTitle.CurrThName;
                lblHeader2.Text = currTitle.CurrEnName;

                string currStatus;
                if (currTitle.CurrStatus == "1")
                {
                    currStatus      = "หลักสูตรใหม่";
                    lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")";
                }
                if (currTitle.CurrStatus == "2")
                {
                    currStatus      = "หลักปรับปรุง";
                    lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")";
                }

                string sql = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
                List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sql);

                foreach (StructurePlan data in dataStructurePlan)
                {
                    htmlGenerate(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode);
                }
                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Example #3
0
    protected void ddlCOP_YEAR_VERSION_SelectedIndexChanged(object sender, EventArgs e)
    {
        txtCURR_CODE.Text         = "";
        txtCURR_YEAR_VERSION.Text = "";

        ddlCOPY_CURR_CODE.Items.Clear();
        ddlCOPY_CURR_CODE.Items.Insert(ddlCOPY_CURR_CODE.Items.Count, new ListItem("-- เลือกรหัสสูตรที่ต้องการปรับปรุง --", "000000000"));

        //หลักสูตร
        if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
        {
            string sql = "Select * From CURRICULUM Where YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "'";
            List <TQF.Curriculum> curriculum = new TQF.Curriculum().getCurriculumManual(sql);


            foreach (TQF.Curriculum row in curriculum)
            {
                //ถ้าเป็นหลักสูตรบริการ (999999999) จะปรับปรุงใหญ่ไม่ได้
                if (rBtnMAJOR_MODI_CURR.Checked && row.CurrCode == "999999999")
                {
                    continue;
                }
                else
                {
                    ddlCOPY_CURR_CODE.Items.Insert(ddlCOPY_CURR_CODE.Items.Count, new ListItem(row.CurrThName, row.CurrCode));
                }
            }
        }
        // วิชาการคณะ
        //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)
        //    {
        //        string sql = "Select * From CURRICULUM Where YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "' AND FACULTYCODE='" + fac + "' AND CURRCODE != '999999999'";
        //        List<TQF.Curriculum> curriculum = new TQF.Curriculum().getCurriculumManual(sql);
        //        foreach (TQF.Curriculum row in curriculum)
        //        {
        //           ddlCOPY_CURR_CODE.Items.Insert(ddlCOPY_CURR_CODE.Items.Count, new ListItem(row.CurrThName, row.CurrCode));
        //        }
        //    }

        //}
        // วิชาการภาค
        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)
            {
                string sql = "Select * From CURRICULUM Where YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "' AND DEPARTMENTCODE='" + dep + "' AND CURRCODE != '999999999'";
                List <TQF.Curriculum> curriculum = new TQF.Curriculum().getCurriculumManual(sql);
                foreach (TQF.Curriculum row in curriculum)
                {
                    ddlCOPY_CURR_CODE.Items.Insert(ddlCOPY_CURR_CODE.Items.Count, new ListItem(row.CurrThName, row.CurrCode));
                }
            }
        }
    }
Example #4
0
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        string sqlUpdateApproveStatus = "Update CURRICULUM Set APPROVESTATUS = '" + ddlAPPROVESTATUS.SelectedValue + "' Where CURRCODE = '" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";

        string updateApproveStatus = new TQF.Curriculum().updateCurriculumManual(sqlUpdateApproveStatus);

        if (updateApproveStatus == "Success")
        {
            Response.Redirect("listCURR.aspx");
        }
    }
Example #5
0
    protected void ddlCOPY_CURR_CODE_SelectedIndexChanged(object sender, EventArgs e)
    {
        string code = ddlCOPY_CURR_CODE.SelectedValue;
        string year = ddlCOPY_YEAR_VERSION.SelectedValue;

        TQF.Curriculum curriculum = new TQF.Curriculum().getCurriculum(code, year);

        if (rBtnMINOR_MODI_CURR.Checked)
        {
            txtCURR_CODE.Text = curriculum.CurrCode;
            //txtCURR_YEAR_VERSION.Text = curriculum.YearVersion;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //ทดสอบ ชั่วคราว ลบออกเมื่อใช้งานจริง
        Session["CurrCode"]    = "999999999";
        Session["YearVersion"] = "2558";
        Session["NumTQF1"]     = "001";
        if (Session["CurrCode"] == null || Session["YearVersion"] == null || Session["NumTQF1"] == null)
        {
            Response.Redirect("listCURR.aspx");
        }
        else
        {
            CurrCode    = Session["CurrCode"].ToString();
            YearVersion = Session["YearVersion"].ToString();
            NumTQF1     = Session["NumTQF1"].ToString();
        }

        TQF.Curriculum currTitle = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion);
        lblHeader1.Text = currTitle.CurrCode + " หลักสูตร" + currTitle.CurrThName;
        lblHeader2.Text = currTitle.CurrEnName;

        string currStatus;

        if (currTitle.CurrStatus == "1")
        {
            currStatus      = "หลักสูตรใหม่";
            lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")";
        }
        if (currTitle.CurrStatus == "2")
        {
            currStatus      = "หลักปรับปรุง";
            lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")";
        }

        if (Request.QueryString["msg"] == "error")
        {
            lblMsg.Text      = new CurrType().getCurrType(Request.QueryString["CurrTypeCode"]).CurrTypeName + " หน่วยกิตไม่ตรงจำนวน!";
            divError.Visible = true;
            btnNext.Visible  = false;
        }

        string sql = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
        List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sql);

        foreach (StructurePlan data in dataStructurePlan)
        {
            htmlGenerate(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode);
        }
    }
Example #7
0
    protected void ddlCOP_YEAR_VERSION_SelectedIndexChanged(object sender, EventArgs e)
    {
        txtCURR_CODE.Text         = "";
        txtCURR_YEAR_VERSION.Text = "";

        string sql = "Select * From CURRICULUM Where YEARVERSION='" + ddlCOPY_YEAR_VERSION.SelectedValue + "'";
        List <TQF.Curriculum> curriculum = new TQF.Curriculum().getCurriculumManual(sql);

        ddlCOPY_CURR_CODE.Items.Clear();
        ddlCOPY_CURR_CODE.Items.Insert(ddlCOPY_CURR_CODE.Items.Count, new ListItem("-- เลือกรหัสสูตรที่ต้องการปรับปรุง --", "000000000"));
        foreach (TQF.Curriculum row in curriculum)
        {
            ddlCOPY_CURR_CODE.Items.Insert(ddlCOPY_CURR_CODE.Items.Count, new ListItem(row.CurrThName, row.CurrCode));
        }
    }
Example #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 ===========
                if (!Page.IsPostBack)
                {
                    Session.Remove("CurrCode");
                    Session.Remove("YearVersion");
                    Session.Remove("NumTQF1");

                    List <TQF.Curriculum> curriculum = new TQF.Curriculum().getYearVersion();
                    ddlCOPY_YEAR_VERSION.Items.Clear();
                    ddlCOPY_YEAR_VERSION.Items.Insert(ddlCOPY_YEAR_VERSION.Items.Count, new ListItem("-- เลือกปี --", "0000"));
                    foreach (TQF.Curriculum row in curriculum)
                    {
                        ddlCOPY_YEAR_VERSION.Items.Insert(ddlCOPY_YEAR_VERSION.Items.Count, new ListItem(row.YearVersion, row.YearVersion));
                    }

                    ddlCOPY_CURR_CODE.Items.Clear();
                    ddlCOPY_CURR_CODE.Items.Insert(ddlCOPY_CURR_CODE.Items.Count, new ListItem("-- เลือกรหัสสูตรที่ต้องการปรับปรุง --", "000000000"));

                    if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                    {
                        rBtnNEW_SCURR.Enabled = true;
                    }
                    else
                    {
                        rBtnNEW_SCURR.Enabled = false;
                    }
                }
                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Example #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            List <TQF.Curriculum> curriculum = new TQF.Curriculum().getYearVersion();
            ddlCOPY_YEAR_VERSION.Items.Clear();
            ddlCOPY_YEAR_VERSION.Items.Insert(ddlCOPY_YEAR_VERSION.Items.Count, new ListItem("-- เลือกปี --", "0000"));
            foreach (TQF.Curriculum row in curriculum)
            {
                ddlCOPY_YEAR_VERSION.Items.Insert(ddlCOPY_YEAR_VERSION.Items.Count, new ListItem(row.YearVersion, row.YearVersion));
            }

            ddlCOPY_CURR_CODE.Items.Clear();
            ddlCOPY_CURR_CODE.Items.Insert(ddlCOPY_CURR_CODE.Items.Count, new ListItem("-- เลือกรหัสสูตรที่ต้องการปรับปรุง --", "000000000"));
        }
    }
    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.FacultyCode   = ddlCURR_FACULTY.SelectedValue;
        curriculumData.NumTQF1       = ddlTQF1.SelectedValue;

        string sqlUpdateCurriculum = "Update CURRICULUM Set LEVELCODE = '" + curriculumData.LevelCode + "', FACULTYCODE = '" + curriculumData.FacultyCode + "', CURRSTATUS = '" + curriculumData.CurrStatus + "', APPROVESTATUS = '" + curriculumData.ApproveStatus + "', CURRTHNAME = '" + curriculumData.CurrThName + "', CURRENNAME = '" + curriculumData.CurrEnName + "', BEGINYEAR = '" + curriculumData.BeginYear + "', BEGINSEMESTER = '" + curriculumData.BeginSemester + "', NUMTQF1 = '" + curriculumData.NumTQF1 + "' 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;

        Response.Redirect("Faculty_add_CURR2.aspx");
        //Response.Redirect("addCURR_GEN_EDU2.aspx");
    }
Example #11
0
    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.FacultyCode   = ddlCURR_FACULTY.SelectedValue;
        curriculumData.NumTQF1       = ddlTQF1.SelectedValue;

        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;

        Response.Redirect("Faculty_add_CURR2.aspx");
        //Response.Redirect("addCURR_GEN_EDU2.aspx");
    }
Example #12
0
    protected void rBtnMAJOR_MODI_CURR_CheckedChanged(object sender, EventArgs e)
    {
        divBody.Visible           = true;
        txtCURR_CODE.ReadOnly     = false;
        txtCURR_CODE.Text         = "";
        txtCURR_YEAR_VERSION.Text = "";

        List <TQF.Curriculum> curriculum = new TQF.Curriculum().getYearVersion();

        ddlCOPY_YEAR_VERSION.Items.Clear();
        ddlCOPY_YEAR_VERSION.Items.Insert(ddlCOPY_YEAR_VERSION.Items.Count, new ListItem("-- เลือกปี --", "0000"));
        foreach (TQF.Curriculum row in curriculum)
        {
            ddlCOPY_YEAR_VERSION.Items.Insert(ddlCOPY_YEAR_VERSION.Items.Count, new ListItem(row.YearVersion, row.YearVersion));
        }

        ddlCOPY_CURR_CODE.Items.Clear();
        ddlCOPY_CURR_CODE.Items.Insert(ddlCOPY_CURR_CODE.Items.Count, new ListItem("-- เลือกรหัสสูตรที่ต้องการปรับปรุง --", "000000000"));
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        string sqlCURRICULUM                = "Delete From CURRICULUM Where CURRCODE ='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
        string sqlDIPLOMA                   = "Delete From DIPLOMA Where CURRCODE ='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
        string sqlDIVISIONEXTENSION         = "Delete From DIVISIONEXTENSION Where CURRCODE ='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
        string sqlABOUTLECTURER             = "Delete From ABOUTLECTURER Where CURRCODE ='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
        string sqlMAJOR                     = "Delete From MAJOR Where CURRCODE ='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
        string sqlTQF2SEC4SUB1              = "Delete From TQF2SEC4SUB1 Where CURRCODE ='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
        string sqlSTRUCTUREPLAN             = "Delete From STRUCTUREPLAN Where CURRCODE ='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
        string sqlTQF2SEC3STRUCTURECATEGORY = "Delete From TQF2SEC3STRUCTURECATEGORY Where CURRCODE ='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
        string sqlTQF2SEC3STRUCTUREGROUP    = "Delete From TQF2SEC3STRUCTUREGROUP Where CURRCODE ='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
        string sqlTQF2SEC3STRUCTURETYPE     = "Delete From TQF2SEC3STRUCTURETYPE Where CURRCODE ='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
        string sqlTQF2SEC3PLANDETAIL        = "Delete From TQF2SEC3PLANDETAIL Where CURRCODE ='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
        string sqlPREREQUISITE              = "Delete From PREREQUISITE Where CURRCODE ='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
        string sqlTQF2SEC4CURRICULUMMAPPING = "Delete From TQF2SEC4CURRICULUMMAPPING Where CURRCODE ='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
        string sqlTQF2SEC3SEMESTERPLAN      = "Delete From TQF2SEC3SEMESTERPLAN Where CURRCODE ='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";

        string deleteTQF2SEC3SEMESTERPLAN      = new TQF.Curriculum().deleteCurriculumManual(sqlTQF2SEC3SEMESTERPLAN);
        string deleteTQF2SEC4CURRICULUMMAPPING = new TQF.Curriculum().deleteCurriculumManual(sqlTQF2SEC4CURRICULUMMAPPING);
        string deletePREREQUISITE              = new TQF.Curriculum().deleteCurriculumManual(sqlPREREQUISITE);
        string deleteTQF2SEC3PLANDETAIL        = new TQF.Curriculum().deleteCurriculumManual(sqlTQF2SEC3PLANDETAIL);
        string deleteTQF2SEC3STRUCTURETYPE     = new TQF.Curriculum().deleteCurriculumManual(sqlTQF2SEC3STRUCTURETYPE);
        string deleteTQF2SEC3STRUCTUREGROUP    = new TQF.Curriculum().deleteCurriculumManual(sqlTQF2SEC3STRUCTUREGROUP);
        string deleteTQF2SEC3STRUCTURECATEGORY = new TQF.Curriculum().deleteCurriculumManual(sqlTQF2SEC3STRUCTURECATEGORY);
        string deleteSTRUCTUREPLAN             = new TQF.Curriculum().deleteCurriculumManual(sqlSTRUCTUREPLAN);
        string deleteTQF2SEC4SUB1              = new TQF.Curriculum().deleteCurriculumManual(sqlTQF2SEC4SUB1);
        string deleteMAJOR             = new TQF.Curriculum().deleteCurriculumManual(sqlMAJOR);
        string deleteABOUTLECTURER     = new TQF.Curriculum().deleteCurriculumManual(sqlABOUTLECTURER);
        string deleteDIVISIONEXTENSION = new TQF.Curriculum().deleteCurriculumManual(sqlDIVISIONEXTENSION);
        string deleteDIPLOMA           = new TQF.Curriculum().deleteCurriculumManual(sqlDIPLOMA);
        string deleteCURRICULUM        = new TQF.Curriculum().deleteCurriculumManual(sqlCURRICULUM);

        if (deleteCURRICULUM == "Success")
        {
            Response.Redirect("listCURR.aspx");
        }
        else
        {
            Session["response"] = "ข้อมูลผิดพลาด ไม่สามารถทำงานได้ในขณะนี้";
            Response.Redirect("../err_response.aspx");
        }
    }
Example #14
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");
            }
        }
    }
Example #15
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 + ")";
                }

                // Head Table
                string[] ar = { "รายวิชา", "1. ด้านคุณธรรม จริยธรรม", "2. ด้านความรู้", "3. ด้านทักษะทางปัญญา", "4. ด้านทักษะความสัมพันธ์ระหว่างบุคคล และความรับผิดชอบ", "5. ด้านทักษะการวิเคราะห์เชิงตัวเลข การสื่อสาร และการใช้เทคโนโลยีสารสนเทศ", "6. ด้านทักษะพิสัย" };
                tblCourse.Attributes.Add("class", "table table-striped table-bordered table-hover");
                tblCourse.Attributes.Add("id", "dt_basic");
                TableHeaderRow tRowHead = new TableHeaderRow();
                tRowHead.TableSection = TableRowSection.TableHeader;
                for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
                {
                    TableHeaderCell cellHead = new TableHeaderCell();
                    if (cellCtr == 1)
                    {
                        cellHead.Width = 200;
                    }
                    else
                    {
                        cellHead.Width = 100;
                    }

                    cellHead.Text = ar[cellCtr - 1];
                    tRowHead.Cells.Add(cellHead);
                }
                tblCourse.Rows.Add(tRowHead);

                //Body Table
                tableBody(tblCourse);
                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Example #16
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);
            }
        }
    }
Example #17
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 curriculum    = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion);
                StructurePlan  structurePlan = new StructurePlan().getStructurePlan(CurrCode, YearVersion);

                Label1.Text = curriculum.CurrThName;
                //Label2.Text = curriculum.MajorName;
                if (curriculum.CurrStatus == "1")
                {
                    //สถานะของหลักสูตร(1=ใหม่, 2=ปรับปรุง)
                    curriculum.CurrStatus = "หลักสูตรใหม่";
                }
                else
                {
                    curriculum.CurrStatus = "หลักสูตรปรับปรุง";
                }
                Label3.Text = "(" + curriculum.CurrStatus + " พ.ศ. " + curriculum.YearVersion + ")";

                Label4.Text = "มหาวิทยาลัยเทคโนโลยีพระจอมเกล้าพระนครเหนือ";

                Label5.Text = new Faculty().getFaculty(curriculum.FacultyCode).Faculty_Thai + " ";
                Label6.Text = new Department().getDepartment(curriculum.DepartmentCode).Department_Thai;

                //รหัสและชื่อหลักสูตร
                Label7.Text  = curriculum.CurrCode;
                Label8.Text  = curriculum.CurrThName;
                Label9.Text  = curriculum.CurrShortThName;
                Label10.Text = curriculum.CurrEnName;
                Label11.Text = curriculum.CurrShortEnName;

                //ถ้าไม่ใช่หลักสูตรวิชาบริการ (999999999)
                if (CurrCode != "999999999")
                {
                    //ชื่อปริญญาและสาขาวิชา
                    Label12.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainThName;
                    Label13.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainThShortName;
                    Label14.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainEnName;
                    Label15.Text = new Diploma().getDiploma(curriculum.DiplomaCode).DomainEnShortName;

                    //วันที่อนุมัติหลักสูตร และภาคการศึกษาที่เริ่มใช้หลักสูตร
                    Label16.Text = new utility().getThaiBirthDay(curriculum.ApprovedDate);
                    Label17.Text = curriculum.BeginSemester + "/" + curriculum.YearVersion;

                    //จำนวนหน่วยกิตที่เรียนตลอดหลักสูตร
                    Label18.Text = structurePlan.TotalCredits + " หน่วยกิต";
                }

                //รูปแบบของหลักสูตร
                string sqlStructurePlan = "Select * From STRUCTUREPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'";
                List <StructurePlan> dataStructurePlan = new StructurePlan().getStructurePlanManual(sqlStructurePlan);

                foreach (StructurePlan data in dataStructurePlan)
                {
                    Label19.Text = new CurrFormat().getCurrFormat(data.CurrFormatCode).CurrFormatName;
                    if (dataStructurePlan.Count > 1)
                    {
                        Label19.Text += "<br>";
                    }

                    //Tab 2: โครงสร้างหลักสูตร
                    htmlGenerateTab2(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode);

                    //Tab 3: รายวิชาในหลักสูตร
                    htmlGenerateTab3(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode);

                    //Tab 4: แผนการศึกษา
                    htmlGenerateTab4(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode);

                    //Tab 5: คำอธิบายรายวิชา
                    htmlGenerateTab5(data.MajorCode, data.CurrFormatCode, data.TotalCredits, data.YearVersion, data.CurrTypeCode);
                }

                Label20.Text = curriculum.NumYear + " ปี / " + curriculum.MaxNumYear + " ปี";

                //อาจารย์ผู้รับผิดชอบหลักสูตร
                //ความหมาย LOADTYPECODE
                //1	อาจารย์ประจำหลักสูตร
                //4	อาจารย์ประจำแขนง
                string sqlLecturer = "Select * From ABOUTLECTURER Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And LOADTYPECODE='1' Order By LECTIDENTITY";
                List <AboutLecturer> aboutLecturer = new AboutLecturer().getAboutLecturerManual(sqlLecturer);
                int i = 1;
                foreach (AboutLecturer data in aboutLecturer)
                {
                    SysUser          sysUser  = new SysUser().getSysUser(data.LectIdentity);
                    AcademicPosition position = new AcademicPosition().getAcademicPosition(sysUser.AcademicPositionCode);

                    Label21.Text += "<span class=\"report-indent-1em\">" + i + ". " + position.AcademicPositionThName + sysUser.ThName + " " + sysUser.ThSurName + "</span><BR>";
                    i++;
                }
                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Example #18
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 ===========
                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");
            }
        }
    }
    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.curriculum) || 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.curriculum))
                {
                    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;
                        }
                    }
                }

                CurrCode    = Request.QueryString["CurrCode"];
                YearVersion = Request.QueryString["YearVersion"];

                if (!Page.IsPostBack)
                {
                    if (editable == true)
                    {
                        TQF.Curriculum currData = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion);
                        lblTextToRemove.Text = currData.CurrCode + "<br>" + currData.CurrShortThName;
                    }
                    else
                    {
                        HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                        HttpContext.Current.Response.Redirect("err_response.aspx");
                    }
                }


                //=========================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Example #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        T2S3No          = Request.QueryString["T2S3No"];
        CurrCode        = Request.QueryString["CurrCode"];
        YearVersion     = Request.QueryString["YearVersion"];
        CurrFormatCode  = Request.QueryString["CurrFormatCode"];
        CurrTypeCode    = Request.QueryString["CurrTypeCode"];
        MajorCode       = Request.QueryString["MajorCode"];
        CourseGroupCode = Request.QueryString["CourseGroupCode"];
        CategoryCode    = Request.QueryString["CategoryCode"];
        CourseTypeCode  = Request.QueryString["CourseTypeCode"];

        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 + ")";
        }

        lblBody1.Text = new CurrFormat().getCurrFormat(CurrFormatCode).CurrFormatName + " (" + new TQF.Major().getMajor(MajorCode).MajorThName + ")";
        lblBody2.Text = new Category().getCategory(CategoryCode).CategoryThName;
        lblBody3.Text = new CourseGroup().getCourseGroup(CourseGroupCode).CourseGroupThName;
        lblBody4.Text = new CourseSubjectType().getCourseSubjectType(CourseTypeCode).CourseTypeThaiName;


        if (!Page.IsPostBack)
        {
            List <FacultyData> faculty = new Faculty().getAllFaculty();
            ddlCURR_FACULTY.Items.Clear();
            ddlCURR_FACULTY.Items.Insert(0, new ListItem("-- เลือกรายวิชาคณะ --", "00"));
            foreach (FacultyData row in faculty)
            {
                ddlCURR_FACULTY.Items.Insert(ddlCURR_FACULTY.Items.Count, new ListItem(row.Faculty_Thai, row.Faculty_Code));
            }
        }

        // Head Table
        string[] ar = { "เลือก", "รหัสวิชา", "ชื่อวิชา", "หน่วย" };
        tblCourse.Attributes.Add("class", "table table-striped table-bordered table-hover");
        tblCourse.Attributes.Add("id", "dt_basic");
        TableHeaderRow tRowHead = new TableHeaderRow();

        tRowHead.TableSection = TableRowSection.TableHeader;
        for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
        {
            TableHeaderCell cellHead = new TableHeaderCell();

            if (cellCtr == 1)
            {
                cellHead.Width = 80;
            }
            if (cellCtr == 2 || cellCtr == 4)
            {
                cellHead.Width = 150;
            }

            cellHead.Text = ar[cellCtr - 1];
            tRowHead.Cells.Add(cellHead);
        }
        tblCourse.Rows.Add(tRowHead);

        string sql = "";

        if (currTitle.FacultyCode == ddlCURR_FACULTY.SelectedValue)
        {
            sql = "Select * From COURSE Where FACULTYCODE='" + ddlCURR_FACULTY.SelectedValue + "' And COURSESTATUS='Y'";
        }
        else
        {
            sql = "Select * From COURSE Where FACULTYCODE='" + ddlCURR_FACULTY.SelectedValue + "' And SERVICESTATUS='A' And COURSESTATUS='Y'";
        }

        List <TQF.Course> course = new TQF.Course().getCourseManual(sql);
        int i = 0;

        foreach (TQF.Course data in course)
        {
            i++;
            TableRow tRowBody = new TableRow();
            tRowBody.TableSection = TableRowSection.TableBody;

            //Cell [0]
            TableCell cellCheck = new TableCell();
            CheckBox  chk       = new CheckBox();
            chk.ID = i + data.CourseCode;
            cellCheck.Controls.Add(chk);
            cellCheck.CssClass = "text-center";
            cellCheck.Width    = 50;
            tRowBody.Cells.Add(cellCheck);

            //Cell [1]
            TableCell cellCourseCode = new TableCell();
            string    urlShow        = "showCOURSE.aspx?token=" + data.CourseCode;
            HyperLink hypShow        = new HyperLink();
            hypShow.Attributes.Add("data-target", "#showModal");
            hypShow.Attributes.Add("data-toggle", "modal");
            hypShow.Text        = data.CourseCode;
            hypShow.NavigateUrl = urlShow;
            hypShow.ToolTip     = "Course details";
            cellCourseCode.Controls.Add(hypShow);
            cellCourseCode.CssClass = "text-center";
            cellCourseCode.Width    = 80;
            tRowBody.Cells.Add(cellCourseCode);

            //Cell [2]
            TableCell cellCourseThName = new TableCell();
            cellCourseThName.Text = data.CourseThName + "<BR>" + data.CourseEnName;
            tRowBody.Cells.Add(cellCourseThName);

            //Cell [3]
            TableCell cellNumCredit = new TableCell();
            cellNumCredit.Text  = data.Credit + "(" + data.TheoryHour + "-" + data.PracticeHour + "-" + data.SelfStudyHour + ")";
            cellNumCredit.Width = 100;
            tRowBody.Cells.Add(cellNumCredit);

            //Cell [4]
            //ไม่แสดงผลออกทางหน้าจอ แต่ นำค่าไปใช้เก็บลงฐานข้อมูล
            TableCell cellCourseCodeHide = new TableCell();
            cellCourseCodeHide.Text    = data.CourseCode;
            cellCourseCodeHide.Visible = false;
            tRowBody.Cells.Add(cellCourseCodeHide);

            tblCourse.Rows.Add(tRowBody);
        }

        //แสดงวิชาเลือก -> วิชา xxx
        List <CourseElective> electiveCourse = new List <CourseElective>();
        string sql2 = "Select * From COURSEELECTIVE Where FACULTYCODE='" + ddlCURR_FACULTY.SelectedValue + "'";

        electiveCourse = new CourseElective().getCourseElectiveManual(sql2);
        int j = 0;

        foreach (CourseElective data in electiveCourse)
        {
            j++;

            TableRow tRowBody = new TableRow();
            tRowBody.TableSection = TableRowSection.TableBody;

            //Cell [0]
            TableCell cellCheck = new TableCell();
            CheckBox  chk       = new CheckBox();
            chk.ID = j + data.CourseElectiveCode;
            cellCheck.Controls.Add(chk);
            cellCheck.CssClass = "text-center";
            cellCheck.Width    = 50;
            tRowBody.Cells.Add(cellCheck);

            //Cell [1]
            TableCell cellCourseCode = new TableCell();
            string    urlShow        = "showCOURSE.aspx?token=" + data.CourseElectiveCode;
            HyperLink hypShow        = new HyperLink();
            hypShow.Attributes.Add("data-target", "#showModal");
            hypShow.Attributes.Add("data-toggle", "modal");
            hypShow.Text        = data.CourseElectiveCode;
            hypShow.NavigateUrl = urlShow;
            hypShow.ToolTip     = "Course details";
            cellCourseCode.Controls.Add(hypShow);
            cellCourseCode.CssClass = "text-center";
            cellCourseCode.Width    = 80;
            tRowBody.Cells.Add(cellCourseCode);

            //Cell [2]
            TableCell cellCourseThName = new TableCell();
            cellCourseThName.Text = data.CourseElectiveThName + "<BR>" + data.CourseElectiveEnName;
            tRowBody.Cells.Add(cellCourseThName);

            //Cell [3]
            TableCell cellNumCredit = new TableCell();
            cellNumCredit.Text  = data.Credit + " (x-x-x)";
            cellNumCredit.Width = 100;
            tRowBody.Cells.Add(cellNumCredit);

            //Cell [4]
            //ไม่แสดงผลออกทางหน้าจอ แต่ นำค่าไปใช้เก็บลงฐานข้อมูล
            TableCell cellCourseCodeHide = new TableCell();
            cellCourseCodeHide.Text    = data.Id;
            cellCourseCodeHide.Visible = false;
            tRowBody.Cells.Add(cellCourseCodeHide);

            tblCourse.Rows.Add(tRowBody);
        }
    }
Example #21
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);
        }
    }
Example #22
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");
        }
    }
    //private string FacultyId;

    protected void Page_Load(object sender, EventArgs e)
    {
        CurrCode        = Request.QueryString["CurrCode"];
        YearVersion     = Request.QueryString["YearVersion"];
        CurrFormatCode  = Request.QueryString["CurrFormatCode"];
        CurrTypeCode    = Request.QueryString["CurrTypeCode"];
        MajorCode       = Request.QueryString["MajorCode"];
        CourseGroupCode = Request.QueryString["CourseGroupCode"];
        CategoryCode    = Request.QueryString["CategoryCode"];
        CourseTypeCode  = Request.QueryString["CourseTypeCode"];
        CourseCode      = Request.QueryString["CourseCode"];

        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 + ")";
        }

        lblCurrFormatTitle.Text = new CurrFormat().getCurrFormat(CurrFormatCode).CurrFormatName + " (" + new TQF.Major().getMajor(MajorCode).MajorThName + ")";

        TQF.Course course = new TQF.Course().getCourse(CourseCode);
        lblCourseTitle.Text = course.CourseCode + " " + course.CourseThName + "<br> (" + course.CourseEnName + ")";

        // Head Table
        string[] ar = { "ลำดับเงื่อนไข", "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "เรียนก่อน/ร่วม", "ลบ" };
        tblCourse.Attributes.Add("class", "table table-striped table-bordered table-hover");
        tblCourse.Attributes.Add("id", "dt_basic");
        TableHeaderRow tRowHead = new TableHeaderRow();

        tRowHead.TableSection = TableRowSection.TableHeader;
        for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
        {
            TableHeaderCell cellHead = new TableHeaderCell();
            if (cellCtr == 1)
            {
                cellHead.Width = 50;
            }
            if (cellCtr == 2 || cellCtr == 4)
            {
                cellHead.Width = 80;
            }
            if (cellCtr == 5)
            {
                cellHead.Width = 120;
            }
            if (cellCtr == 6)
            {
                cellHead.Width = 60;
            }

            cellHead.Text = ar[cellCtr - 1];
            tRowHead.Cells.Add(cellHead);
        }
        tblCourse.Rows.Add(tRowHead);

        string sqlPreRequisite           = "Select * From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSETYPECODE='" + CourseTypeCode + "' And COURSECODE='" + CourseCode + "' Order by PREREQUISITERULE";
        List <PreRequisite> preRequisite = new PreRequisite().getPreRequisiteManual(sqlPreRequisite);

        foreach (PreRequisite data in preRequisite)
        {
            TQF.Course courseData = new TQF.Course().getCourse(data.PreRequisiteCourseCode);

            TableRow tRowBody = new TableRow();
            tRowBody.TableSection = TableRowSection.TableBody;

            //Cell [0]
            TableCell cellPreRequisiteRule = new TableCell();
            cellPreRequisiteRule.Text     = data.PreRequisiteRule;
            cellPreRequisiteRule.CssClass = "text-center";
            cellPreRequisiteRule.Width    = 50;
            tRowBody.Cells.Add(cellPreRequisiteRule);

            //Cell [1]
            TableCell cellCourseCode = new TableCell();
            //string urlShow = "showCOURSE.aspx?token=" + data.PreRequisiteCourseCode;
            string    urlShow = "showCOURSE.aspx?token=" + data.PreRequisiteCourseCode + "&CurrCode=" + data.CurrCode + "&YearVersion=" + data.YearVersion;
            HyperLink hypShow = new HyperLink();
            hypShow.Attributes.Add("data-target", "#showModal");
            hypShow.Attributes.Add("data-toggle", "modal");
            hypShow.Text        = data.PreRequisiteCourseCode;
            hypShow.NavigateUrl = urlShow;
            hypShow.ToolTip     = "Course details";
            cellCourseCode.Controls.Add(hypShow);
            cellCourseCode.CssClass = "text-center";
            cellCourseCode.Width    = 80;
            tRowBody.Cells.Add(cellCourseCode);

            //Cell [2]
            TableCell cellCourseThName = new TableCell();
            cellCourseThName.Text = courseData.CourseThName + "<BR>" + courseData.CourseEnName;
            tRowBody.Cells.Add(cellCourseThName);

            //Cell [3]
            TableCell cellNumCredit = new TableCell();
            cellNumCredit.Text  = courseData.Credit + "(" + courseData.TheoryHour + "-" + courseData.PracticeHour + "-" + courseData.SelfStudyHour + ")";
            cellNumCredit.Width = 80;
            tRowBody.Cells.Add(cellNumCredit);

            //Cell [4]
            TableCell cellPreRequisiteFormat = new TableCell();
            if (data.PreRequisiteFormat == "B")
            {
                cellPreRequisiteFormat.Text = "บังคับเรียนก่อน";
            }
            if (data.PreRequisiteFormat == "C")
            {
                cellPreRequisiteFormat.Text = "บังคับเรียนร่วมกัน";
            }
            if (data.PreRequisiteFormat == "D")
            {
                cellPreRequisiteFormat.Text = "บังคับเรียนก่อน/บังคับเรียนร่วมกัน";
            }
            //cellPreRequisiteFormat.Text = data.PreRequisiteFormat;
            cellPreRequisiteFormat.Width = 120;
            tRowBody.Cells.Add(cellPreRequisiteFormat);

            //Cell [5]
            TableCell cellDel = new TableCell();
            string    urlDel  = "deletePREREQ.aspx?CurrCode=" + data.CurrCode + "&YearVersion=" + data.YearVersion + "&CurrFormatCode=" + data.CurrFormatCode + "&CurrTypeCode=" + data.CurrTypeCode + "&MajorCode=" + data.MajorCode + "&CategoryCode=" + data.CategoryCode + "&CourseGroupCode=" + data.CourseGroupCode + "&CourseTypeCode=" + data.CourseTypeCode + "&CourseCode=" + data.CourseCode + "&PreRequisiteCourseCode=" + data.PreRequisiteCourseCode + "&PreRequisiteRule=" + data.PreRequisiteRule;
            HyperLink hypDel  = new HyperLink();
            hypDel.Attributes.Add("data-target", "#deletePREREQ");
            hypDel.Attributes.Add("data-toggle", "modal");
            hypDel.Text        = "<h4><i class='fa fa-trash-o'></i></h4>";
            hypDel.NavigateUrl = urlDel;
            hypDel.ToolTip     = "Delete";
            cellDel.Controls.Add(hypDel);
            cellDel.CssClass = "text-center";
            cellDel.Width    = 60;
            tRowBody.Cells.Add(cellDel);
            tblCourse.Rows.Add(tRowBody);
        }
    }
    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 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.curriculum))
            {
                // ======== Process ===========
                CurrCode    = Request.QueryString["CurrCode"];
                YearVersion = Request.QueryString["YearVersion"];

                TQF.Curriculum curriculum     = new TQF.Curriculum();
                TQF.Curriculum curriculumData = curriculum.getCurriculum(CurrCode, YearVersion);

                if (!Page.IsPostBack)
                {
                    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;
                    ddlCURR_SEMESTER.Items.FindByValue(curriculumData.BeginSemester).Selected = true;
                    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));
                    }
                    ddlDegree.Items.FindByValue(curriculumData.LevelCode).Selected  = true;
                    ddlDegree1.Items.FindByValue(curriculumData.LevelCode).Selected = true;

                    txtCURR_THAINAME.Text = curriculumData.CurrThName;
                    txtCURR_ENGNAME.Text  = curriculumData.CurrEnName;

                    List <FacultyData> faculty = new Faculty().getFaculty();
                    ddlCURR_FACULTY.Items.Clear();
                    //ddlCURR_FACULTY.Items.Insert(ddlCURR_FACULTY.Items.Count, new ListItem("--- เลือกคณะ ---", "00"));
                    foreach (FacultyData row in faculty)
                    {
                        //FacultyCode == "99" -> ใช้ร่วมทุกคณะ
                        if (row.Faculty_Code == "99")
                        {
                            ddlCURR_FACULTY.Items.Insert(ddlCURR_FACULTY.Items.Count, new ListItem(row.Faculty_Thai, row.Faculty_Code));
                        }
                    }

                    ddlTQF1.Items.Clear();
                    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));
                    }
                    ddlTQF1.Items.FindByValue(curriculumData.NumTQF1).Selected = true;
                }
                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Example #26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrCode       = Request.QueryString["CurrCode"];
        YearVersion    = Request.QueryString["YearVersion"];
        CurrFormatCode = Request.QueryString["CurrFormatCode"];
        CurrTypeCode   = Request.QueryString["CurrTypeCode"];
        MajorCode      = Request.QueryString["MajorCode"];
        Year           = Request.QueryString["Year"];
        Semester       = Request.QueryString["Semester"];


        if (!Page.IsPostBack)
        {
            lblHead.Text = new CurrType().getCurrType(CurrTypeCode).CurrTypeName + ": " + new CurrFormat().getCurrFormat(CurrFormatCode).CurrFormatName + " (แขนงวิชา " + new TQF.Major().getMajor(MajorCode).MajorThName + ")";

            ddlEDUCATIONYEAR.Items.FindByValue(Year).Selected         = true;
            ddlEDUCATIONSEMESTER.Items.FindByValue(Semester).Selected = true;
        }

        // Head Table
        string[] ar = { "เลือก", "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต" };
        tblCourse.Attributes.Add("class", "table table-bordered table-striped table-hover");
        tblCourse.Attributes.Add("id", "dt_basic");
        TableHeaderRow tRowHead = new TableHeaderRow();

        tRowHead.TableSection = TableRowSection.TableHeader;
        for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
        {
            // Create a new cell and add it to the row.
            TableHeaderCell cellHead = new TableHeaderCell();
            cellHead.Text = ar[cellCtr - 1];
            tRowHead.Cells.Add(cellHead);

            switch (cellCtr)
            {
            case 1:
                cellHead.Width = 50;
                break;

            case 2:
                cellHead.Width = 80;
                break;

            case 3:
                break;

            case 4:
                cellHead.Width = 80;
                break;

            case 5:
                cellHead.Width = 80;
                break;
            }
        }
        tblCourse.Rows.Add(tRowHead);

        //string sql = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' Order By COURSECODE";
        //List<TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql);

        //List<TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getDistinctCourseCodeTQF2Sec3PlanDetail(CurrCode, YearVersion);

        string sql1 = "Select Distinct COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And MAJORCODE='" + MajorCode + "' Order By COURSECODE";
        List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getDistinctCourseCodeTQF2Sec3PlanDetailManual(sql1);
        int i = 0;

        foreach (TQF2Sec3PlanDetail data in tqf2Sec3PlanDetail)
        {
            i++;

            TableRow tRowBody = new TableRow();
            tRowBody.TableSection = TableRowSection.TableBody;

            //Cell [0]
            TableCell cellCheck = new TableCell();
            CheckBox  chk       = new CheckBox();
            chk.ID = data.CourseCode + i.ToString();
            cellCheck.Controls.Add(chk);
            cellCheck.CssClass = "text-center";
            cellCheck.Width    = 50;
            tRowBody.Cells.Add(cellCheck);

            //Cell [1]
            TableCell cellCourseCode = new TableCell();
            cellCourseCode.Text     = data.CourseCode;
            cellCourseCode.CssClass = "text-center";
            cellCourseCode.Width    = 80;
            tRowBody.Cells.Add(cellCourseCode);

            //Cell [2]
            TQF.Course     course           = new TQF.Course().getCourse(data.CourseCode);
            CourseElective courseElective   = new CourseElective().getCourseElective(data.CourseCode);
            TableCell      cellCourseEnName = new TableCell();
            //cellCourseEnName.Text = course.CourseThName + "<br>" + course.CourseEnName;
            cellCourseEnName.Text  = course.CourseThName + courseElective.CourseElectiveThName + "<BR>";
            cellCourseEnName.Text += course.CourseEnName + courseElective.CourseElectiveEnName;
            tRowBody.Cells.Add(cellCourseEnName);

            //Cell [3]
            TableCell cellCredit = new TableCell();
            cellCredit.Text = course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
            tRowBody.Cells.Add(cellCredit);

            //Cell [4]
            //เลือกค่า Id ของตาราง Elective course ไปเก็บ ไม่แสดงผลออกทางหน้าจอ
            TableCell cellId = new TableCell();
            cellId.Visible = false;
            cellId.Text    = "null";
            tRowBody.Cells.Add(cellId);

            tblCourse.Rows.Add(tRowBody);
        }

        TQF.Curriculum curriculum = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion);

        //แสดงวิชาเลือก -> วิชา xxx
        List <CourseElective> electiveCourse = new List <CourseElective>();
        string sql2 = "Select * From COURSEELECTIVE Order By COURSEELECTIVECODE";

        electiveCourse = new CourseElective().getCourseElectiveManual(sql2);

        int k = 0;

        foreach (CourseElective data in electiveCourse)
        {
            k++;
            string sql3 = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And COURSECODE='" + data.CourseElectiveCode + "'";
            List <TQF2Sec3PlanDetail> chkDupTqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql3);

            TableRow tRowBody = new TableRow();
            tRowBody.TableSection = TableRowSection.TableBody;

            if (chkDupTqf2Sec3PlanDetail.Count > 0)
            {
                continue;
            }
            else
            {
                //Cell [0]
                TableCell cellCheck = new TableCell();
                CheckBox  chk       = new CheckBox();
                chk.ID = data.CourseElectiveCode + k.ToString();
                cellCheck.Controls.Add(chk);
                cellCheck.CssClass = "text-center";
                cellCheck.Width    = 50;
                tRowBody.Cells.Add(cellCheck);

                //Cell [1]
                TableCell cellCourseCode = new TableCell();
                cellCourseCode.Text     = data.CourseElectiveCode;
                cellCourseCode.CssClass = "text-center";
                cellCourseCode.Width    = 80;
                tRowBody.Cells.Add(cellCourseCode);

                //Cell [2]
                TableCell cellCourseEnName = new TableCell();
                cellCourseEnName.Text  = data.CourseElectiveThName + "<BR>";
                cellCourseEnName.Text += data.CourseElectiveEnName;
                tRowBody.Cells.Add(cellCourseEnName);

                //Cell [3]
                TableCell cellCredit = new TableCell();
                cellCredit.Text = data.Credit + " (" + "-" + "-" + ")";
                tRowBody.Cells.Add(cellCredit);

                //Cell [4]
                //เลือกค่า Id ของตาราง Elective course ไปเก็บ ไม่แสดงผลออกทางหน้าจอ
                TableCell cellId = new TableCell();
                cellId.Visible = false;
                cellId.Text    = data.Id;
                tRowBody.Cells.Add(cellId);

                tblCourse.Rows.Add(tRowBody);
            }
        }
    }