Ejemplo n.º 1
0
    /// <summary>
    /// แก้ไขข้อมูลจากตาราง TQF2SEC3SEMESTERPLAN
    /// </summary>
    /// <param name="updateData">TQF2Sec3SemesterPlan Object</param>
    /// <returns>Success</returns>
    public string updateTQF2Sec3SemesterPlan(TQF2Sec3SemesterPlan updateData)
    {
        string        response  = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        string sql = "Update TQF2SEC3SEMESTERPLAN Set EDUCATIONYEAR = '" + updateData.EducationYear +
                     "', EDUCATIONSEMESTER = '" + updateData.EducationSemester +
                     "' Where CURRCODE = '" + updateData.CurrCode +
                     "' And YEARVERSION = '" + updateData.YearVersion +
                     "' And CURRFORMATCODE = '" + updateData.CurrFormatCode +
                     "' And CURRTYPECODE = '" + updateData.CurrTypeCode +
                     "' And MAJORCODE = '" + updateData.MajorCode +
                     "' And COURSECODE = '" + updateData.CourseCode + "'";

        oracleObj.UpdateCommand = sql;

        try
        {
            if (oracleObj.Update() == 1)
            {
                response = "Success";
            }
        }
        catch (Exception e)
        {
            string exception = e.Message;
            HttpContext.Current.Session["response"] = "updateTQF2Sec3SemesterPlan: " + exception;
            HttpContext.Current.Response.Redirect("../err_response.aspx");
        }

        return(response);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// เพิ่มข้อมูลลงตาราง TQF2SEC3SEMESTERPLAN
    /// </summary>
    /// <param name="dataInsert">TQF2Sec3SemesterPlan Object</param>
    /// <returns>Success</returns>
    public string insertTQF2Sec3SemesterPlan(TQF2Sec3SemesterPlan dataInsert)
    {
        string response = "";

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        string sql = "Insert into TQF2SEC3SEMESTERPLAN (CURRCODE, YEARVERSION, CURRFORMATCODE, CURRTYPECODE, MAJORCODE, COURSECODE, EDUCATIONYEAR, EDUCATIONSEMESTER) values ('" + dataInsert.CurrCode + "','" + dataInsert.YearVersion + "','" + dataInsert.CurrFormatCode + "','" + dataInsert.CurrTypeCode + "','" + dataInsert.MajorCode + "','" + dataInsert.CourseCode + "','" + dataInsert.EducationYear + "','" + dataInsert.EducationSemester + "')";

        oracleObj.InsertCommand = sql;

        try
        {
            if (oracleObj.Insert() == 1)
            {
                response = "Success";
            }
        }
        catch (Exception e)
        {
            string exception = e.Message;
            HttpContext.Current.Session["response"] = "insertTQF2Sec3SemesterPlan: " + exception;
            HttpContext.Current.Response.Redirect("../err_response.aspx");
        }

        return(response);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง TQF2SEC3SEMESTERPLAN
    /// </summary>
    /// <param name="sql">SQL Command</param>
    /// <returns>ข้อมูลจากตาราง TQF2SEC3SEMESTERPLAN</returns>
    public List <TQF2Sec3SemesterPlan> getTQF2Sec3SemesterPlanManual(string sql)
    {
        List <TQF2Sec3SemesterPlan> TQF2Sec3SemesterPlanData = new List <TQF2Sec3SemesterPlan>();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        oracleObj.SelectCommand = sql;

        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            TQF2Sec3SemesterPlan TQF2Sec3SemesterPlanRow = new TQF2Sec3SemesterPlan();

            TQF2Sec3SemesterPlanRow.CurrCode          = rowData["CURRCODE"].ToString();
            TQF2Sec3SemesterPlanRow.YearVersion       = rowData["YEARVERSION"].ToString();
            TQF2Sec3SemesterPlanRow.CurrFormatCode    = rowData["CURRFORMATCODE"].ToString();
            TQF2Sec3SemesterPlanRow.CurrTypeCode      = rowData["CURRTYPECODE"].ToString();
            TQF2Sec3SemesterPlanRow.MajorCode         = rowData["MAJORCODE"].ToString();
            TQF2Sec3SemesterPlanRow.CourseCode        = rowData["COURSECODE"].ToString();
            TQF2Sec3SemesterPlanRow.EducationYear     = rowData["EDUCATIONYEAR"].ToString();
            TQF2Sec3SemesterPlanRow.EducationSemester = rowData["EDUCATIONSEMESTER"].ToString();

            TQF2Sec3SemesterPlanData.Add(TQF2Sec3SemesterPlanRow);
        }

        return(TQF2Sec3SemesterPlanData);
    }
Ejemplo n.º 4
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        string sql = "Select * From TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "'";
        List <TQF2Sec3StructureGroup> tqf2Sec3StructureGroup;

        tqf2Sec3StructureGroup = new TQF2Sec3StructureGroup().getTQF2Sec3StructureGroupManual(sql);

        if (tqf2Sec3StructureGroup.Count > 0)
        {
            //[Step 8] ลบข้อมูลในตาราง TQF2SEC3SEMESTERPLAN
            string sql8 = "Delete From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'";
            string deleteTQF2SemesterPlan = new TQF2Sec3SemesterPlan().deleteTQF2Sec3SemesterPlanManual(sql8);

            //[Step 7] ลบข้อมูลในตาราง TQF2SEC4CURRICULUMMAPPING
            string sql7 = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'";
            List <TQF2Sec3PlanDetail> TQF2Sec3PlanDetailData = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql7);
            foreach (TQF2Sec3PlanDetail row in TQF2Sec3PlanDetailData)
            {
                string sql7_1 = "Delete From TQF2SEC4CURRICULUMMAPPING Where CURRCODE ='" + row.CurrCode + "'";
                string deleteTQF2Sec4CurriculumMapping = new TQF2Sec4CurriculumMapping().deleteTQF2Sec4CurriculumMappingManual(sql7_1);
            }

            //[Step 6-1] ลบข้อมูลในตาราง PREREQUISITE
            string sql6 = "Delete From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "'";
            string deletePreRequisite = new PreRequisite().deletePreRequisiteManual(sql6);

            //[Step 6] ลบข้อมูลในตาราง TQF2SEC3PLANDETAIL
            string sql5 = "Delete From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "'";
            string deleteTQF2Sec3PlanDetail = new TQF2Sec3PlanDetail().deleteTQF2Sec3PlanDetailManual(sql5);

            //[Step 5_1] ลบข้อมูลในตาราง TQF2SEC3STRUCTURETYPE
            string sql4 = "Delete From TQF2SEC3STRUCTURETYPE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "'";
            string deleteTqf2Sec3StructureType = new Tqf2Sec3StructureType().deleteTqf2Sec3StructureTypeManual(sql4);

            //[Step 5] ลบข้อมูลในตาราง TQF2SEC3STRUCTUREGROUP
            string sql3 = "Delete From TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "'";
            string deleteTQF2Sec3StructureGroup = new TQF2Sec3StructureGroup().deleteTQF2Sec3StructureGroupManual(sql3);

            //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR5.aspx
            Session["CurrCode"]    = CurrCode;
            Session["YearVersion"] = YearVersion;
            //Session["MajorCode"] = MajorCode;

            Response.Redirect("Faculty_add_CURR5.aspx");
        }
        else
        {
            //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR5.aspx
            Session["CurrCode"]    = CurrCode;
            Session["YearVersion"] = YearVersion;
            //Session["MajorCode"] = MajorCode;

            Response.Redirect("Faculty_add_CURR5.aspx");
        }
    }
Ejemplo n.º 5
0
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        foreach (TableRow row in tblCourse.Rows)
        {
            var cell = row.Cells[0];
            foreach (Control control in cell.Controls)
            {
                var checkBox = control as CheckBox;
                if (checkBox != null)
                {
                    if (checkBox.Checked == true)
                    {
                        string sql = "Select * From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSECODE='" + row.Cells[1].Text + "' And EDUCATIONYEAR='" + ddlEDUCATIONYEAR.SelectedValue + "' And EDUCATIONSEMESTER='" + ddlEDUCATIONSEMESTER.SelectedValue + "'";

                        List <TQF2Sec3SemesterPlan> chkTQF2Sec3SemesterPlan = new TQF2Sec3SemesterPlan().getTQF2Sec3SemesterPlanManual(sql);

                        if (chkTQF2Sec3SemesterPlan.Count > 0)
                        {
                            continue;
                        }
                        else
                        {
                            TQF2Sec3SemesterPlan dataInsert = new TQF2Sec3SemesterPlan();
                            dataInsert.CurrCode       = CurrCode;
                            dataInsert.YearVersion    = YearVersion;
                            dataInsert.CurrFormatCode = CurrFormatCode;
                            dataInsert.CurrTypeCode   = CurrTypeCode;
                            dataInsert.MajorCode      = MajorCode;

                            if (row.Cells[4].Text == "null")
                            {
                                dataInsert.CourseCode = row.Cells[1].Text;
                            }
                            else
                            {
                                dataInsert.CourseCode = row.Cells[4].Text;
                            }

                            dataInsert.EducationYear     = ddlEDUCATIONYEAR.SelectedValue;
                            dataInsert.EducationSemester = ddlEDUCATIONSEMESTER.SelectedValue;

                            string insertTQF2Sec3SemesterPlan = new TQF2Sec3SemesterPlan().insertTQF2Sec3SemesterPlan(dataInsert);
                        }
                    }
                }
            }
        }

        //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR8.aspx
        Session["CurrCode"]    = CurrCode;
        Session["YearVersion"] = YearVersion;
        //Session["MajorCode"] = MajorCode;

        Response.Redirect("Faculty_add_CURR8.aspx");
    }
Ejemplo n.º 6
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        //เช็คว่ามีข้อมูลอยู่จริงหรือไม่
        string sql = "Select * From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSECODE='" + CourseCode + "' And EDUCATIONYEAR='" + Year + "' And EDUCATIONSEMESTER='" + Semester + "'";

        List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan = new TQF2Sec3SemesterPlan().getTQF2Sec3SemesterPlanManual(sql);

        if (tqf2Sec3SemesterPlan.Count > 0)
        {
            //ลบข้อมูลในตาราง TQF2SEC3PLANDETAIL
            string sql2 = "Delete From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSECODE='" + CourseCode + "' And EDUCATIONYEAR='" + Year + "' And EDUCATIONSEMESTER='" + Semester + "'";

            string deleteTQF2Sec3PlanDetail = new TQF2Sec3SemesterPlan().deleteTQF2Sec3SemesterPlanManual(sql2);

            if (deleteTQF2Sec3PlanDetail == "Success")
            {
                //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR8.aspx
                Session["CurrCode"]    = CurrCode;
                Session["YearVersion"] = YearVersion;
                //Session["MajorCode"] = MajorCode;

                Response.Redirect("Faculty_add_CURR8.aspx");
            }
            //else
            //{
            //    //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR6.aspx
            //    Session["CurrCode"] = CurrCode;
            //    Session["YearVersion"] = YearVersion;
            //    //Session["MajorCode"] = MajorCode;

            //    Response.Redirect("Faculty_add_CURR8.aspx");
            //}
        }
        else
        {
            //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR8.aspx
            Session["CurrCode"]    = CurrCode;
            Session["YearVersion"] = YearVersion;
            //Session["MajorCode"] = MajorCode;

            Response.Redirect("Faculty_add_CURR8.aspx");
        }
    }
Ejemplo n.º 7
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง TQF2SEC3SEMESTERPLAN
    /// </summary>
    /// <param name="sql">คำสั่ง Sql มีตัวอย่างให้ดูใน Class</param>
    /// <returns>ข้อมูลจากตาราง TQF2SEC3SEMESTERPLAN</returns>
    public TQF2Sec3SemesterPlan getCountCreditTQF2Sec3SemesterPlanManual(string sql)
    {
        TQF2Sec3SemesterPlan TQF2Sec3SemesterPlanData = new TQF2Sec3SemesterPlan();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        //ตัวอย่าง Command
        //Select COUNT(COURSECODE) As CREDITCOUNT From TQF2SEC3SEMESTERPLAN Where CURRCODE='707012555' And YEARVERSION='2555' And CURRFORMATCODE='008' And CURRTYPECODE='004' And MAJORCODE='0701' And COURSECODE='070115800';

        oracleObj.SelectCommand = sql;
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            TQF2Sec3SemesterPlanData.CreditCount = rowData["CREDITCOUNT"].ToString();
        }

        return(TQF2Sec3SemesterPlanData);
    }
Ejemplo n.º 8
0
    /// <summary>
    /// เพิ่มข้อมูลลงตาราง TQF2SEC3SEMESTERPLAN
    /// </summary>
    /// <param name="sql">SQL Command</param>
    /// <returns>EDUCATIONSEMESTER</returns>
    public List <TQF2Sec3SemesterPlan> getSemester(string sql)
    {
        List <TQF2Sec3SemesterPlan> TQF2Sec3SemesterPlanData = new List <TQF2Sec3SemesterPlan>();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        oracleObj.SelectCommand = sql;

        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            TQF2Sec3SemesterPlan TQF2Sec3SemesterPlanRow = new TQF2Sec3SemesterPlan();

            TQF2Sec3SemesterPlanRow.EducationSemester = rowData["EDUCATIONSEMESTER"].ToString();

            TQF2Sec3SemesterPlanData.Add(TQF2Sec3SemesterPlanRow);
        }

        return(TQF2Sec3SemesterPlanData);
    }
Ejemplo n.º 9
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง TQF2SEC3SEMESTERPLAN
    /// </summary>
    /// <param name="CourseCode">รหัสวิชา(Course)</param>
    /// <returns>ข้อมูลจากตาราง TQF2SEC3SEMESTERPLAN</returns>
    public TQF2Sec3SemesterPlan getTQF2Sec3SemesterPlan(string CourseCode)
    {
        TQF2Sec3SemesterPlan TQF2Sec3SemesterPlanData = new TQF2Sec3SemesterPlan();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        oracleObj.SelectCommand = "Select * From TQF2SEC3SEMESTERPLAN Where COURSECODE='" + CourseCode + "'";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            TQF2Sec3SemesterPlanData.CurrCode          = rowData["CURRCODE"].ToString();
            TQF2Sec3SemesterPlanData.YearVersion       = rowData["YEARVERSION"].ToString();
            TQF2Sec3SemesterPlanData.CurrFormatCode    = rowData["CURRFORMATCODE"].ToString();
            TQF2Sec3SemesterPlanData.CurrTypeCode      = rowData["CURRTYPECODE"].ToString();
            TQF2Sec3SemesterPlanData.MajorCode         = rowData["MAJORCODE"].ToString();
            TQF2Sec3SemesterPlanData.CourseCode        = rowData["COURSECODE"].ToString();
            TQF2Sec3SemesterPlanData.EducationYear     = rowData["EDUCATIONYEAR"].ToString();
            TQF2Sec3SemesterPlanData.EducationSemester = rowData["EDUCATIONSEMESTER"].ToString();
        }

        return(TQF2Sec3SemesterPlanData);
    }
Ejemplo n.º 10
0
    protected void htmlGenerate(string MajorCode, string CurrFormatCode, string TotalCredits, string YearVersion, string CurrTypeCode)
    {
        string html = "";

        html += "<section>";
        html += "    <div class=\"title-data-newStd\"><i class=\"fa fa-file-text-o\"></i> " + new CurrType().getCurrType(CurrTypeCode).CurrTypeName + ": " + new CurrFormat().getCurrFormat(CurrFormatCode).CurrFormatName + " (แขนงวิชา " + new TQF.Major().getMajor(MajorCode).MajorThName + ")" + "</div>";
        html += "</section>";

        html += "<section>";
        html += "<div id=\"accordion1\" class=\"panel-group smart-accordion-default\">";
        html += "<div class=\"panel panel-redLight\">";
        html += "<div class=\"panel-heading\">";

        Label label0 = new Label();

        label0.Text = CurrCode + CurrFormatCode + CurrTypeCode + MajorCode;
        html       += "<h4 class=\"panel-title\"><a class=\"\" href=\"#" + label0.Text + "\" data-parent=\"#accordion1\" data-toggle=\"collapse\"><i class=\"fa fa-lg fa-angle-down pull-right\"></i><i class=\"fa fa-lg fa-angle-up pull-right\"></i>แผนการศึกษา</a></h4>";
        html       += "</div>";
        html       += "<div class=\"panel-collapse collapse in\" id=\"" + label0.Text + "\" style=\"height: auto;\">";
        html       += "<div class=\"panel-body padding-10 well\">";

        //แสดงปุ่ม Add 1
        html += "<div class=\"row\">";
        html += "<section class=\"col col-3 pull-right\">";
        html += " <a href=\"addEDU_PLAN.aspx?CurrCode=" + CurrCode + "&YearVersion=" + YearVersion + "&CurrFormatCode=" + CurrFormatCode + "&CurrTypeCode=" + CurrTypeCode + "&MajorCode=" + MajorCode + "&Year=1&Semester=1\" data-target=\"#addEDU_PLAN\" data-toggle=\"modal\" class=\"pull-right\" title=\"เพิ่มข้อมูล\" id=\"HyperLink2\">";
        html += "<img src=\"../img/button_add.png\" id=\"ContentPlaceHolder1_Image1\"></a>";
        html += "</section>";
        html += "</div>";
        /////

        string sqlYear = "Select Distinct EDUCATIONYEAR From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' Order By EDUCATIONYEAR";
        List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan_Year = new TQF2Sec3SemesterPlan().getYear(sqlYear);

        foreach (TQF2Sec3SemesterPlan rowYear in tqf2Sec3SemesterPlan_Year)
        {
            string sqlSemester = "Select Distinct EDUCATIONSEMESTER From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And EDUCATIONYEAR='" + rowYear.EducationYear + "' Order By EDUCATIONYEAR";
            List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan_Semester = new TQF2Sec3SemesterPlan().getSemester(sqlSemester);
            foreach (TQF2Sec3SemesterPlan rowSemester in tqf2Sec3SemesterPlan_Semester)
            {
                html += "<div>";
                html += "<div class=\"row\">";
                html += "<section class=\"col col-9\">";
                html += "<h3 class=\"text-success\">ปีที่ " + rowYear.EducationYear + " ภาคการศึกษาที่ " + rowSemester.EducationSemester + "</h3>";
                html += "</section>";
                html += "<section class=\"col col-3 text-align-right\">";
                html += "<a href=\"delete_CURR8_1.aspx?CurrCode=" + CurrCode + "&YearVersion=" + YearVersion + "&CurrFormatCode=" + CurrFormatCode + "&CurrTypeCode=" + CurrTypeCode + "&MajorCode=" + MajorCode + "&Year=" + rowYear.EducationYear + "&Semester=" + rowSemester.EducationSemester + "\" data-target=\"#deleteSemester\" data-toggle=\"modal\" title=\"ลบภาคการศึกษา\" id=\"HyperLink8\">";
                html += "<h3><i class=\"fa fa-trash-o\"></i> ลบภาคการศึกษา</h3>";
                html += "</a>";
                html += "</section>";
                html += "</div>";

                //แสดงปุ่ม Add 2
                html += "<div class=\"row\">";
                html += "<section class=\"col col-3 pull-right\">";
                html += " <a href=\"addEDU_PLAN.aspx?CurrCode=" + CurrCode + "&YearVersion=" + YearVersion + "&CurrFormatCode=" + CurrFormatCode + "&CurrTypeCode=" + CurrTypeCode + "&MajorCode=" + MajorCode + "&Year=" + rowYear.EducationYear + "&Semester=" + rowSemester.EducationSemester + "\" data-target=\"#addEDU_PLAN\" data-toggle=\"modal\" class=\"pull-right\" title=\"เพิ่มข้อมูล\" id=\"HyperLink2\">";
                html += "<img src=\"../img/button_add.png\" id=\"" + rowYear + rowSemester + "\"></a>";
                html += "</section>";
                html += "</div>";
                /////
                html += "<section>";

                Table tblGroupCategory = new Table();
                htmlWriter(tblGroupCategory, "header", CurrFormatCode, CurrTypeCode, MajorCode, "0", "0");
                html += htmlTableHeader;

                string sqlCourse = "Select * From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And EDUCATIONYEAR='" + rowYear.EducationYear + "' And EDUCATIONSEMESTER='" + rowSemester.EducationSemester + "' Order By EDUCATIONYEAR";
                List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan_Course = new TQF2Sec3SemesterPlan().getTQF2Sec3SemesterPlanManual(sqlCourse);
                foreach (TQF2Sec3SemesterPlan rowCourse in tqf2Sec3SemesterPlan_Course)
                {
                    htmlWriter(tblGroupCategory, "body", CurrFormatCode, CurrTypeCode, MajorCode, rowCourse.EducationYear, rowCourse.EducationSemester);
                }
                html += htmlTableBody;

                html += "</section>";
            }

            html += "</div>";
        }

        html += "</div>";
        html += "</div>";
        html += "</div>";
        html += "</div>";
        html += "</section>";

        Label la = new Label();

        la.Text = html;
        placeHTML.Controls.Add(la);
    }
Ejemplo n.º 11
0
    protected void tableBody(Table tblName, string CurrFormatCode, string CurrTypeCode, string MajorCode, string EducationYear, string EducationSemester)
    {
        string sql = "Select * From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And EDUCATIONYEAR='" + EducationYear + "' And EDUCATIONSEMESTER='" + EducationSemester + "' Order By COURSECODE";
        List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan = new TQF2Sec3SemesterPlan().getTQF2Sec3SemesterPlanManual(sql);

        foreach (TQF2Sec3SemesterPlan row in tqf2Sec3SemesterPlan)
        {
            TQF.Course     course         = new TQF.Course().getCourse(row.CourseCode);
            CourseElective courseElective = new CourseElective().getCourseElectiveId(row.CourseCode);

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

            TableCell cellCourseCode = new TableCell();
            //string urlShow = "showCOURSE.aspx?token=" + row.CourseCode;
            string    urlShow = "showCOURSE.aspx?token=" + row.CourseCode + "&CurrCode=" + CurrCode + "&YearVersion=" + YearVersion;
            HyperLink hypShow = new HyperLink();
            hypShow.Attributes.Add("data-target", "#showModal");
            hypShow.Attributes.Add("data-toggle", "modal");
            //แสดงรหัสวิชาระหว่างตาราง COURSE กับ COURSEELECTIVE
            hypShow.Text        = course.CourseCode + courseElective.CourseElectiveCode;
            hypShow.NavigateUrl = urlShow;
            hypShow.ToolTip     = "Course details";
            cellCourseCode.Controls.Add(hypShow);
            cellCourseCode.CssClass = "text-center";
            cellCourseCode.Width    = 80;
            tRowBody.Cells.Add(cellCourseCode);

            TableCell cellNCourseThName = new TableCell();
            cellNCourseThName.Text  = course.CourseThName + courseElective.CourseElectiveThName + "<BR>";
            cellNCourseThName.Text += course.CourseEnName + courseElective.CourseElectiveEnName;
            tRowBody.Cells.Add(cellNCourseThName);

            //TableCell cellNumCredit = new TableCell();
            //cellNumCredit.Text = course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
            //cellNumCredit.Width = 100;
            //tRowBody.Cells.Add(cellNumCredit);

            TableCell cellNumCredit = new TableCell();
            //หาจำนวนวิชาวิทยานิพนธ์ทั้งหมด
            string creditCount = "";
            int    creDit      = 0;
            //ค่าที่เช็คเงื่อนไขว่าเป็นวิชาวิทยานิพนธ์ มาจากตาราง COURSETYPE
            //7	วิทยานิพนธ์ (ป.เอก)	Dissertation
            //4	วิทยานิพนธ์	Thesis
            //5	สารนิพนธ์	Master Project
            if (course.CourseTypeCode == "4" || course.CourseTypeCode == "5" || course.CourseTypeCode == "7")
            {
                string sqlCreditCount = "Select COUNT(COURSECODE) As CREDITCOUNT From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSECODE='" + row.CourseCode + "'";
                //คำนวนหน่วยกิตโดยการหารด้วยจำนวนเทอมที่เรียน
                creditCount = new TQF2Sec3SemesterPlan().getCountCreditTQF2Sec3SemesterPlanManual(sqlCreditCount).CreditCount;
                try
                {
                    creDit = int.Parse(course.Credit) / int.Parse(creditCount);
                }
                catch
                {
                    creDit = 0;
                }
                //แสดงผลลงในตาราง
                cellNumCredit.Text  = creDit.ToString() + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
                cellNumCredit.Width = 100;
                tRowBody.Cells.Add(cellNumCredit);
            }
            else
            {
                //แสดงผลลงในตาราง
                cellNumCredit.Text  = course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
                cellNumCredit.Width = 100;
                tRowBody.Cells.Add(cellNumCredit);
            }

            //&CourseCode=" + course.CourseCode + courseElective.CourseElectiveCode --> รหัสวิชา หรือ รหัสวิชาเลือก(xxx)
            TableCell cellDel = new TableCell();
            string    urlDel  = "delete_CURR8_2.aspx?CurrCode=" + CurrCode + "&YearVersion=" + YearVersion + "&CurrFormatCode=" + CurrFormatCode + "&CurrTypeCode=" + CurrTypeCode + "&MajorCode=" + MajorCode + "&Year=" + row.EducationYear + "&Semester=" + row.EducationSemester + "&CourseCode=" + course.CourseCode + courseElective.Id + "";
            HyperLink hypDel  = new HyperLink();
            hypDel.Attributes.Add("data-target", "#deleteCourse");
            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);

            tblName.Rows.Add(tRowBody);
        }
    }
Ejemplo n.º 12
0
    protected void htmlGenerateTab4(string MajorCode, string CurrFormatCode, string TotalCredits, string YearVersion, string CurrTypeCode)
    {
        //string sqlCreditCount = "Select COUNT(COURSECODE) As CREDITCOUNT From TQF2SEC3SEMESTERPLAN Where CURRCODE='707012555' And YEARVERSION='2555' And CURRFORMATCODE='008' And CURRTYPECODE='004' And MAJORCODE='0701' And COURSECODE='070115800'";



        string html = "";

        html += "<div class=\"row\" style=\"margin: 0 10px\">";
        html += "    <div class=\"col col-10\">";
        html += "        <h3 class=\"txt-title-blue\">";
        html += "            <i class=\"fa fa-file-text-o\"></i> ";
        Label lblPlanTitle = new Label();

        lblPlanTitle.Font.Bold = true;
        lblPlanTitle.Text      = new CurrType().getCurrType(CurrTypeCode).CurrTypeName + " (แขนงวิชา " + new TQF.Major().getMajor(MajorCode).MajorThName + ")";
        html += lblPlanTitle.Text;
        html += "        </h3>";
        html += "    </div>";
        html += "</div>";

        string sqlYear = "Select Distinct EDUCATIONYEAR From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' Order By EDUCATIONYEAR";
        List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan_Year = new TQF2Sec3SemesterPlan().getYear(sqlYear);

        foreach (TQF2Sec3SemesterPlan rowYear in tqf2Sec3SemesterPlan_Year)
        {
            string sqlSemester = "Select Distinct EDUCATIONSEMESTER From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And EDUCATIONYEAR='" + rowYear.EducationYear + "' Order By EDUCATIONYEAR";
            List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan_Semester = new TQF2Sec3SemesterPlan().getSemester(sqlSemester);
            foreach (TQF2Sec3SemesterPlan rowSemester in tqf2Sec3SemesterPlan_Semester)
            {
                html += "<div class=\"row\" style=\"margin: 0 10px\">";
                html += "    <div class=\"col col-10\">";
                html += "        <p class=\"text-center\">";
                Label label0 = new Label();
                label0.Text = "ปีที่ " + rowYear.EducationYear + " ภาคการศึกษาที่ " + rowSemester.EducationSemester;
                html       += "<span id=\"Label11\" class=\"label bg-color-teal\" style=\"font-weight: bold; font-size: 16px\">" + label0.Text + "</span>";
                html       += "        </p>";
                html       += "    </div>";
                html       += "</div>";

                html += "<div class=\"row\" style=\"margin: 0 10px; padding-bottom: 20px\">";
                html += "    <div class=\"col col-10\">";

                Table tblGroupCategory = new Table();
                // Head Table
                string[] ar = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต" };
                tblGroupCategory.Attributes.Add("class", "table table-striped tb-curr-plan");
                TableHeaderRow tRowHead = new TableHeaderRow();
                tRowHead.CssClass     = "danger";
                tRowHead.TableSection = TableRowSection.TableHeader;
                for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
                {
                    TableHeaderCell cellHead = new TableHeaderCell();
                    cellHead.Text = ar[cellCtr - 1];

                    if (cellCtr == 1 || cellCtr == 3)
                    {
                        cellHead.Width = 100;
                    }

                    tRowHead.Cells.Add(cellHead);
                }
                tblGroupCategory.Rows.Add(tRowHead);
                //Body Table
                string sqlCourse = "Select * From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And EDUCATIONYEAR='" + rowYear.EducationYear + "' And EDUCATIONSEMESTER='" + rowSemester.EducationSemester + "' Order By COURSECODE";
                List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan_Course = new TQF2Sec3SemesterPlan().getTQF2Sec3SemesterPlanManual(sqlCourse);
                foreach (TQF2Sec3SemesterPlan row in tqf2Sec3SemesterPlan_Course)
                {
                    TQF.Course     course         = new TQF.Course().getCourse(row.CourseCode);
                    CourseElective courseElective = new CourseElective().getCourseElectiveId(row.CourseCode);

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

                    TableCell cellCourseCode = new TableCell();
                    string    urlShow        = "showCOURSE.aspx?token=" + row.CourseCode;
                    HyperLink hypShow        = new HyperLink();
                    hypShow.Attributes.Add("data-target", "#course_desModal");
                    hypShow.Attributes.Add("data-toggle", "modal");
                    hypShow.Text        = course.CourseCode + courseElective.CourseElectiveCode;
                    hypShow.NavigateUrl = urlShow;
                    hypShow.ToolTip     = "Course details";
                    cellCourseCode.Controls.Add(hypShow);
                    cellCourseCode.CssClass = "text-center";
                    cellCourseCode.Width    = 80;
                    tRowBody.Cells.Add(cellCourseCode);

                    TableCell cellNCourseThName = new TableCell();
                    cellNCourseThName.Text  = course.CourseThName + courseElective.CourseElectiveThName + "<BR>";
                    cellNCourseThName.Text += course.CourseEnName + courseElective.CourseElectiveEnName;
                    tRowBody.Cells.Add(cellNCourseThName);

                    TableCell cellNumCredit = new TableCell();
                    //หาจำนวนวิชาวิทยานิพนธ์ทั้งหมด
                    string creditCount = "";
                    int    creDit      = 0;
                    //ค่าที่เช็คเงื่อนไขว่าเป็นวิชาวิทยานิพนธ์ มาจากตาราง COURSETYPE
                    //7	วิทยานิพนธ์ (ป.เอก)	Dissertation
                    //4	วิทยานิพนธ์	Thesis
                    //5	สารนิพนธ์	Master Project
                    if (course.CourseTypeCode == "4" || course.CourseTypeCode == "5" || course.CourseTypeCode == "7")
                    {
                        string sqlCreditCount = "Select COUNT(COURSECODE) As CREDITCOUNT From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSECODE='" + row.CourseCode + "'";
                        //คำนวนหน่วยกิตโดยการหารด้วยจำนวนเทอมที่เรียน
                        creditCount = new TQF2Sec3SemesterPlan().getCountCreditTQF2Sec3SemesterPlanManual(sqlCreditCount).CreditCount;
                        try
                        {
                            creDit = int.Parse(course.Credit) / int.Parse(creditCount);
                        }
                        catch
                        {
                            creDit = 0;
                        }

                        //แสดงผลลงในตาราง
                        cellNumCredit.Text  = creDit.ToString() + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
                        cellNumCredit.Width = 100;
                        tRowBody.Cells.Add(cellNumCredit);
                    }
                    else
                    {
                        //แสดงผลลงในตาราง
                        cellNumCredit.Text  = course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
                        cellNumCredit.Width = 100;
                        tRowBody.Cells.Add(cellNumCredit);
                    }



                    tblGroupCategory.Rows.Add(tRowBody);
                }

                StringWriter htmlString = new StringWriter();
                tblGroupCategory.RenderControl(new HtmlTextWriter(htmlString));
                string htmlTableBody = htmlString.ToString();
                html += htmlTableBody;
                html += "    </div>";
                html += "</div>";
            }
        }

        Label lblHTML4 = new Label();

        lblHTML4.Text = html;
        placeHTML4.Controls.Add(lblHTML4);
    }
Ejemplo n.º 13
0
    protected void btnSEARCH_Click(object sender, EventArgs e)
    {
        // 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 = 80;
                break;

            case 2:
                break;

            case 3:
                cellHead.Width = 80;
                break;

            case 4:
                break;

            case 5:
                cellHead.Width = 80;
                break;

            case 6:
                cellHead.Width = 50;
                break;

            case 7:
                cellHead.Width = 50;
                break;
            }
        }
        tblCourse.Rows.Add(tRowHead);


        List <TQF.Course> course = new List <TQF.Course>();


        if (ddlCURR_FACULTY.SelectedValue == "00")
        {
            course = new TQF.Course().getCourse();
        }
        else
        {
            string sql = "Select * From COURSE Where FACULTYCODE='" + ddlCURR_FACULTY.SelectedValue + "'";
            course = new TQF.Course().getCourseManual(sql);
        }

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

            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);

            TableCell cellCourseEnName = new TableCell();
            cellCourseEnName.Text = data.CourseThName + "<br>" + data.CourseEnName;
            tRowBody.Cells.Add(cellCourseEnName);

            TableCell cellCredit = new TableCell();
            cellCredit.Text = data.Credit + "(" + data.TheoryHour + "-" + data.PracticeHour + "-" + data.SelfStudyHour + ")";
            tRowBody.Cells.Add(cellCredit);

            TableCell cellFacultyCode = new TableCell();
            cellFacultyCode.Text  = new Faculty().getFaculty(data.FacultyCode).Faculty_Thai;
            cellFacultyCode.Width = 200;
            tRowBody.Cells.Add(cellFacultyCode);

            TableCell cellCourseStatus = new TableCell();
            if (data.CourseStatus == "Y")
            {
                cellCourseStatus.Text = "<h4 class='txt-color-green'><i class='fa fa-check'></i></h4>";                          // +data.CourseStatus;
            }
            if (data.CourseStatus == "N")
            {
                cellCourseStatus.Text = "<h4 class='txt-color-red'><i class='fa fa-times'></i></h4>";                          // +data.CourseStatus;
            }
            cellCourseStatus.Width    = 50;
            cellCourseStatus.CssClass = "text-center";
            tRowBody.Cells.Add(cellCourseStatus);

            TableCell cellEdit = new TableCell();

            // งานหลักสูตร
            if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
            {
                string    urlEdit = "editCOURSE.aspx?token=" + data.CourseCode;
                HyperLink hypEdit = new HyperLink();
                //hypEdit.Attributes.Add("data-target", "#editModal");
                //hypEdit.Attributes.Add("data-toggle", "modal");
                hypEdit.Text        = "<h4><i class='fa fa-edit'></i></h4>";
                hypEdit.NavigateUrl = urlEdit;
                hypEdit.ToolTip     = "Edit";
                cellEdit.Controls.Add(hypEdit);
            }
            // วิชาการคณะ
            //else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
            //{
            //    bool editable = false;
            //    List<string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

            //    foreach (string fac in faculty_authorized)
            //    {
            //        if (fac == data.FacultyCode)
            //        {
            //            editable = true;
            //            break;
            //        }
            //    }

            //    if (editable == true)
            //    {
            //        string urlEdit = "editCOURSE.aspx?token=" + data.CourseCode;
            //        HyperLink hypEdit = new HyperLink();
            //        //hypEdit.Attributes.Add("data-target", "#editModal");
            //        //hypEdit.Attributes.Add("data-toggle", "modal");
            //        hypEdit.Text = "<h4><i class='fa fa-edit'></i></h4>";
            //        hypEdit.NavigateUrl = urlEdit;
            //        hypEdit.ToolTip = "Edit";
            //        cellEdit.Controls.Add(hypEdit);
            //    }
            //    else
            //    {
            //        string urlEdit = "#";
            //        HyperLink hypEdit = new HyperLink();
            //        hypEdit.Text = "<h4><i class='fa fa-lock'></i></h4>";
            //        hypEdit.NavigateUrl = urlEdit;
            //        hypEdit.ToolTip = "ไม่สามารถแก้ไขได้";
            //        cellEdit.Controls.Add(hypEdit);
            //    }

            //}
            // วิชาการภาค
            else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                bool          editable = false;
                List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                foreach (string dep in department_authorized)
                {
                    if (dep.Substring(0, 2) == data.FacultyCode)
                    {
                        editable = true;
                        break;
                    }
                }
                if (editable == true)
                {
                    string    urlEdit = "editCOURSE.aspx?token=" + data.CourseCode;
                    HyperLink hypEdit = new HyperLink();
                    //hypEdit.Attributes.Add("data-target", "#editModal");
                    //hypEdit.Attributes.Add("data-toggle", "modal");
                    hypEdit.Text        = "<h4><i class='fa fa-edit'></i></h4>";
                    hypEdit.NavigateUrl = urlEdit;
                    hypEdit.ToolTip     = "Edit";
                    cellEdit.Controls.Add(hypEdit);
                }
                else
                {
                    string    urlEdit = "#";
                    HyperLink hypEdit = new HyperLink();
                    hypEdit.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                    hypEdit.NavigateUrl = urlEdit;
                    hypEdit.ToolTip     = "ไม่สามารถแก้ไขได้";
                    cellEdit.Controls.Add(hypEdit);
                }
            }
            // ทุกกลุ่มผู้ใช้
            else
            {
                string    urlEdit = "#";
                HyperLink hypEdit = new HyperLink();
                hypEdit.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                hypEdit.NavigateUrl = urlEdit;
                hypEdit.ToolTip     = "ไม่สามารถแก้ไขได้";
                cellEdit.Controls.Add(hypEdit);
            }

            cellEdit.CssClass = "text-center";
            cellEdit.Width    = 50;
            tRowBody.Cells.Add(cellEdit);

            TableCell cellDel = new TableCell();

            //เช็คว่ารายวิชามีการนำไปใช้แล้วหรือยัง ถ้ามีแล้วจะไม่สามารถลบข้อมูลได้
            bool chkExistCourse = new TQF2Sec3SemesterPlan().existCourse(data.CourseCode);

            // งานหลักสูตร
            if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) && chkExistCourse == false)
            {
                string    urlDel = "deleteCOURSE.aspx?token=" + data.CourseCode;
                HyperLink hypDel = new HyperLink();
                hypDel.Attributes.Add("data-target", "#deleteModal");
                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);
            }
            // วิชาการคณะ
            //else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
            //{
            //    bool editable = false;
            //    List<string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

            //    foreach (string fac in faculty_authorized)
            //    {
            //        if (fac == data.FacultyCode)
            //        {
            //            editable = true;
            //            break;
            //        }
            //    }

            //    if (editable == true && chkExistCourse == false)
            //    {
            //        string urlDel = "deleteCOURSE.aspx?token=" + data.CourseCode;
            //        HyperLink hypDel = new HyperLink();
            //        hypDel.Attributes.Add("data-target", "#deleteModal");
            //        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);
            //    }
            //    else
            //    {
            //        string urlDel = "#";
            //        HyperLink hypDel = new HyperLink();
            //        hypDel.Text = "<h4><i class='fa fa-lock'></i></h4>";
            //        hypDel.NavigateUrl = urlDel;
            //        hypDel.ToolTip = "ไม่สามารถลบได้";
            //        cellDel.Controls.Add(hypDel);
            //    }

            //}
            // วิชาการภาค
            else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                bool          editable = false;
                List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                foreach (string dep in department_authorized)
                {
                    if (dep.Substring(0, 2) == data.FacultyCode)
                    {
                        editable = true;
                        break;
                    }
                }
                if (editable == true && chkExistCourse == false)
                {
                    string    urlDel = "deleteCOURSE.aspx?token=" + data.CourseCode;
                    HyperLink hypDel = new HyperLink();
                    hypDel.Attributes.Add("data-target", "#deleteModal");
                    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);
                }
                else
                {
                    string    urlDel = "#";
                    HyperLink hypDel = new HyperLink();
                    hypDel.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                    hypDel.NavigateUrl = urlDel;
                    hypDel.ToolTip     = "ไม่สามารถลบได้";
                    cellDel.Controls.Add(hypDel);
                }
            }
            // ทุกกลุ่มผู้ใช้
            else
            {
                string    urlDel = "#";
                HyperLink hypDel = new HyperLink();
                hypDel.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                hypDel.NavigateUrl = urlDel;
                hypDel.ToolTip     = "ไม่สามารถลบได้";
                cellDel.Controls.Add(hypDel);
            }

            cellDel.CssClass = "text-center";
            cellDel.Width    = 50;
            tRowBody.Cells.Add(cellDel);

            tblCourse.Rows.Add(tRowBody);
        }
    }
Ejemplo n.º 14
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);
            }
        }
    }
Ejemplo n.º 15
0
    protected void htmlGenerateTab4(string MajorCode, string CurrFormatCode, string TotalCredits, string YearVersion, string CurrTypeCode)
    {
        string html = "";

        html += "<div class=\"box-group-data\">";
        html += "<p class=\"text-center\">";
        html += "<span class=\"report-bold\">";
        Label lblPlanTitle = new Label();

        lblPlanTitle.Text = new CurrType().getCurrType(CurrTypeCode).CurrTypeName;
        html += lblPlanTitle.Text;
        html += "</span>";
        html += "<br />";
        html += "<span class=\"report-bold\">";
        Label lblPlanTitle2 = new Label();

        lblPlanTitle2.Text = " แขนงวิชา" + new TQF.Major().getMajor(MajorCode).MajorThName;
        html += lblPlanTitle2.Text;
        html += "</span>";
        html += "</p>";

        string sqlYear = "Select Distinct EDUCATIONYEAR From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' Order By EDUCATIONYEAR";
        List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan_Year = new TQF2Sec3SemesterPlan().getYear(sqlYear);

        foreach (TQF2Sec3SemesterPlan rowYear in tqf2Sec3SemesterPlan_Year)
        {
            string sqlSemester = "Select Distinct EDUCATIONSEMESTER From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And EDUCATIONYEAR='" + rowYear.EducationYear + "' Order By EDUCATIONYEAR";
            List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan_Semester = new TQF2Sec3SemesterPlan().getSemester(sqlSemester);
            foreach (TQF2Sec3SemesterPlan rowSemester in tqf2Sec3SemesterPlan_Semester)
            {
                html += "<p class=\"text-center\">";
                Label label0 = new Label();
                label0.Text = "ปีที่ " + rowYear.EducationYear + " ภาคการศึกษาที่ " + rowSemester.EducationSemester;
                html       += "<span class=\"report-bold\">" + label0.Text + "</span>";
                html       += "</p>";

                html += "<table class=\"table-course\">";

                //Body Table
                string sqlCourse = "Select * From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And EDUCATIONYEAR='" + rowYear.EducationYear + "' And EDUCATIONSEMESTER='" + rowSemester.EducationSemester + "' Order By COURSECODE";
                List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan_Course = new TQF2Sec3SemesterPlan().getTQF2Sec3SemesterPlanManual(sqlCourse);
                foreach (TQF2Sec3SemesterPlan row in tqf2Sec3SemesterPlan_Course)
                {
                    TQF.Course     course         = new TQF.Course().getCourse(row.CourseCode);
                    CourseElective courseElective = new CourseElective().getCourseElectiveId(row.CourseCode);

                    html += "<tr>";

                    html += "<td>" + course.CourseCode + courseElective.CourseElectiveCode + "</td>";
                    html += "<td>";
                    html += course.CourseThName + courseElective.CourseElectiveThName + "<BR>";
                    html += course.CourseEnName + courseElective.CourseElectiveEnName;
                    html += "</td>";

                    //หาจำนวนวิชาวิทยานิพนธ์ทั้งหมด
                    string creditCount = "";
                    int    creDit      = 0;
                    //ค่าที่เช็คเงื่อนไขว่าเป็นวิชาวิทยานิพนธ์ มาจากตาราง COURSETYPE
                    //7	วิทยานิพนธ์ (ป.เอก)	Dissertation
                    //4	วิทยานิพนธ์	Thesis
                    //5	สารนิพนธ์	Master Project
                    if (course.CourseTypeCode == "4" || course.CourseTypeCode == "5" || course.CourseTypeCode == "7")
                    {
                        string sqlCreditCount = "Select COUNT(COURSECODE) As CREDITCOUNT From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSECODE='" + row.CourseCode + "'";
                        //คำนวนหน่วยกิตโดยการหารด้วยจำนวนเทอมที่เรียน
                        creditCount = new TQF2Sec3SemesterPlan().getCountCreditTQF2Sec3SemesterPlanManual(sqlCreditCount).CreditCount;
                        try
                        {
                            creDit = int.Parse(course.Credit) / int.Parse(creditCount);
                        }
                        catch
                        {
                            creDit = 0;
                        }

                        //แสดงผลลงในตาราง
                        html += "<td>";
                        html += creDit.ToString() + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
                        html += "</td>";
                    }
                    else
                    {
                        //แสดงผลลงในตาราง
                        html += "<td>";
                        html += course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
                        html += "</td>";
                    }

                    html += "</tr>";
                }

                html += "</table>";
            }
        }

        html += "</div>";

        Label lblHTML4 = new Label();

        lblHTML4.Text = html;
        placeHTML4.Controls.Add(lblHTML4);
    }
Ejemplo n.º 16
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"];

            // ======== Process ===========
            if (!Page.IsPostBack)
            {
                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));

                    //if(row.Faculty_Code == "11")
                    //    {
                    //    ddlCURR_FACULTY.Items.FindByValue(row.Faculty_Code).Selected = true;
                    //    }
                }
                ddlCURR_FACULTY.Items.Insert(0, new ListItem("-- ทุกคณะ --", "00"));


                // Head Table
                string[] ar = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "คณะ", "แก้ไข", "ลบ" };
                tblElective.Attributes.Add("class", "table table-bordered table-striped table-hover");
                tblElective.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);
                }
                tblElective.Rows.Add(tRowHead);

                List <CourseElective> electiveCourse = new List <CourseElective>();
                electiveCourse = new CourseElective().getCourseElective();

                foreach (CourseElective data in electiveCourse)
                {
                    TableRow tRowBody = new TableRow();
                    tRowBody.TableSection = TableRowSection.TableBody;

                    TableCell cellCourseCode = new TableCell();
                    cellCourseCode.Text  = data.CourseElectiveCode;
                    cellCourseCode.Width = 100;
                    tRowBody.Cells.Add(cellCourseCode);
                    //string urlShow = "showElective_COURSE.aspx?token=" + data.CourseElectiveCode + "&facId=" + data.FacultyCode;
                    //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 = 100;
                    //tRowBody.Cells.Add(cellCourseCode);

                    TableCell cellCourseEnName = new TableCell();
                    cellCourseEnName.Text = data.CourseElectiveThName + "<br>" + data.CourseElectiveEnName;
                    tRowBody.Cells.Add(cellCourseEnName);

                    TableCell cellCredit = new TableCell();
                    cellCredit.Text  = data.Credit;
                    cellCredit.Width = 80;
                    tRowBody.Cells.Add(cellCredit);

                    TableCell cellFacultyCode = new TableCell();
                    cellFacultyCode.Text  = new Faculty().getFaculty(data.FacultyCode).Faculty_Thai;
                    cellFacultyCode.Width = 200;
                    tRowBody.Cells.Add(cellFacultyCode);

                    TableCell cellEdit = new TableCell();
                    // งานหลักสูตร
                    if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                    {
                        //string urlEdit = "editElective_COURSE.aspx?token=" + data.CourseElectiveCode + "&facultyId=" + data.FacultyCode + "&FacultyCreated=" + data.FacultyCode;
                        string    urlEdit = "editElective_COURSE.aspx?token=" + data.Id;
                        HyperLink hypEdit = new HyperLink();
                        hypEdit.Attributes.Add("data-target", "#editModal");
                        hypEdit.Attributes.Add("data-toggle", "modal");
                        hypEdit.Text        = "<h4><i class='fa fa-edit'></i></h4>";
                        hypEdit.NavigateUrl = urlEdit;
                        hypEdit.ToolTip     = "Edit";
                        cellEdit.Controls.Add(hypEdit);
                    }
                    // วิชาการคณะ
                    //else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                    //{
                    //    bool editable = false;
                    //    List<string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                    //    foreach (string fac in faculty_authorized)
                    //    {
                    //        if (fac == data.FacultyCode)
                    //        {
                    //            editable = true;
                    //            break;
                    //        }
                    //    }

                    //    if (editable == true)
                    //    {
                    //        string urlEdit = "editElective_COURSE.aspx?token=" + data.Id;
                    //        HyperLink hypEdit = new HyperLink();
                    //        hypEdit.Attributes.Add("data-target", "#editModal");
                    //        hypEdit.Attributes.Add("data-toggle", "modal");
                    //        hypEdit.Text = "<h4><i class='fa fa-edit'></i></h4>";
                    //        hypEdit.NavigateUrl = urlEdit;
                    //        hypEdit.ToolTip = "Edit";
                    //        cellEdit.Controls.Add(hypEdit);
                    //    }
                    //    else
                    //    {
                    //        string urlEdit = "#";
                    //        HyperLink hypEdit = new HyperLink();
                    //        hypEdit.Text = "<h4><i class='fa fa-lock'></i></h4>";
                    //        hypEdit.NavigateUrl = urlEdit;
                    //        hypEdit.ToolTip = "ไม่สามารถแก้ไขได้";
                    //        cellEdit.Controls.Add(hypEdit);
                    //    }

                    //}
                    // วิชาการภาค
                    else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                    {
                        bool          editable = false;
                        List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                        foreach (string dep in department_authorized)
                        {
                            if (dep.Substring(0, 2) == data.FacultyCode)
                            {
                                editable = true;
                                break;
                            }
                        }
                        if (editable == true)
                        {
                            string    urlEdit = "editElective_COURSE.aspx?token=" + data.Id;
                            HyperLink hypEdit = new HyperLink();
                            hypEdit.Attributes.Add("data-target", "#editModal");
                            hypEdit.Attributes.Add("data-toggle", "modal");
                            hypEdit.Text        = "<h4><i class='fa fa-edit'></i></h4>";
                            hypEdit.NavigateUrl = urlEdit;
                            hypEdit.ToolTip     = "Edit";
                            cellEdit.Controls.Add(hypEdit);
                        }
                        else
                        {
                            string    urlEdit = "#";
                            HyperLink hypEdit = new HyperLink();
                            hypEdit.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                            hypEdit.NavigateUrl = urlEdit;
                            hypEdit.ToolTip     = "ไม่สามารถแก้ไขได้";
                            cellEdit.Controls.Add(hypEdit);
                        }
                    }
                    // ทุกกลุ่มผู้ใช้
                    else
                    {
                        string    urlEdit = "#";
                        HyperLink hypEdit = new HyperLink();
                        hypEdit.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                        hypEdit.NavigateUrl = urlEdit;
                        hypEdit.ToolTip     = "ไม่สามารถแก้ไขได้";
                        cellEdit.Controls.Add(hypEdit);
                    }

                    cellEdit.CssClass = "text-center";
                    cellEdit.Width    = 50;
                    tRowBody.Cells.Add(cellEdit);

                    TableCell cellDel = new TableCell();

                    //เช็คว่ารายวิชามีการนำไปใช้แล้วหรือยัง ถ้ามีแล้วจะไม่สามารถลบข้อมูลได้
                    bool chkExistCourse = new TQF2Sec3SemesterPlan().existCourse(data.Id);

                    // งานหลักสูตร
                    if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) && chkExistCourse == false)
                    {
                        //string urlDel = "deleteElective_COURSE.aspx?token=" + data.CourseElectiveCode + "&facultyId=" + data.FacultyCode;
                        string    urlDel = "deleteElective_COURSE.aspx?token=" + data.Id;
                        HyperLink hypDel = new HyperLink();
                        hypDel.Attributes.Add("data-target", "#deleteModal");
                        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);
                    }
                    // วิชาการคณะ
                    //else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                    //{
                    //    bool editable = false;
                    //    List<string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                    //    foreach (string fac in faculty_authorized)
                    //    {
                    //        if (fac == data.FacultyCode)
                    //        {
                    //            editable = true;
                    //            break;
                    //        }
                    //    }

                    //    if (editable == true && chkExistCourse == false)
                    //    {
                    //        string urlDel = "deleteElective_COURSE.aspx?token=" + data.Id;
                    //        HyperLink hypDel = new HyperLink();
                    //        hypDel.Attributes.Add("data-target", "#deleteModal");
                    //        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);
                    //    }
                    //    else
                    //    {
                    //        string urlDel = "#";
                    //        HyperLink hypDel = new HyperLink();
                    //        hypDel.Text = "<h4><i class='fa fa-lock'></i></h4>";
                    //        hypDel.NavigateUrl = urlDel;
                    //        hypDel.ToolTip = "ไม่สามารถลบได้";
                    //        cellDel.Controls.Add(hypDel);
                    //    }

                    //}
                    // วิชาการภาค
                    else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                    {
                        bool          editable = false;
                        List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                        foreach (string dep in department_authorized)
                        {
                            if (dep.Substring(0, 2) == data.FacultyCode)
                            {
                                editable = true;
                                break;
                            }
                        }
                        if (editable == true && chkExistCourse == false)
                        {
                            string    urlDel = "deleteElective_COURSE.aspx?token=" + data.Id;
                            HyperLink hypDel = new HyperLink();
                            hypDel.Attributes.Add("data-target", "#deleteModal");
                            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);
                        }
                        else
                        {
                            string    urlDel = "#";
                            HyperLink hypDel = new HyperLink();
                            hypDel.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                            hypDel.NavigateUrl = urlDel;
                            hypDel.ToolTip     = "ไม่สามารถลบได้";
                            cellDel.Controls.Add(hypDel);
                        }
                    }
                    // ทุกกลุ่มผู้ใช้
                    else
                    {
                        string    urlDel = "#";
                        HyperLink hypDel = new HyperLink();
                        hypDel.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                        hypDel.NavigateUrl = urlDel;
                        hypDel.ToolTip     = "ไม่สามารถลบได้";
                        cellDel.Controls.Add(hypDel);
                    }

                    cellDel.CssClass = "text-center";
                    cellDel.Width    = 50;
                    tRowBody.Cells.Add(cellDel);

                    tblElective.Rows.Add(tRowBody);
                }
            }
            //=============================
        }
    }