Ejemplo n.º 1
0
    public LecturerTableData checkHourRefWeekEndDay(List <LecturerTableData> alllecturer_data, TeachingTableData teaching_data)
    {
        LecturerTableData response = new LecturerTableData();

        if (teaching_data.Teaching_Day == "6" || teaching_data.Teaching_Day == "7")
        {
            foreach (LecturerTableData lec in alllecturer_data)
            {
                SysUser user = new SysUser();
                user = new SysUser().getSysUser(lec.Lecturer);

                Sysuser2 user2 = new Sysuser2();
                user2 = new Sysuser2().getSysuser2(lec.Lecturer);

                if (user2.Lecturer_Type != "03")     // อาจารย์พิเศษ
                {
                    float totalHourRef   = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, user.Position).HourReference;
                    float currentHourRef = getInTimeHourRef(teaching_data.AcademicYear, teaching_data.Semester, lec.Lecturer);

                    if (currentHourRef < totalHourRef)
                    {
                        response = lec;
                        break;
                    }
                }
            }
        }


        return(response);
    }
Ejemplo n.º 2
0
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        uint check_uint;

        if (!uint.TryParse(txtWorkloadValue.Text, out check_uint))
        {
            MsgValidate("โปรดตรวจสอบค่า ชั่วโมงอ้างอิง");
        }
        else if (!uint.TryParse(txtMaxWorkloadValue.Text, out check_uint))
        {
            MsgValidate("โปรดตรวจสอบค่า หน่วยกิตรวม");
        }
        else
        {
            WorkLoadConfigData work_load = new WorkLoadConfigData();
            work_load.LecturerType     = ddlLecturerType.SelectedValue;
            work_load.LecturerPosition = ddlPosition.SelectedValue;
            work_load.HourReference    = Convert.ToUInt16(txtWorkloadValue.Text);
            work_load.TotalCredit      = Convert.ToUInt16(txtMaxWorkloadValue.Text);

            string result = new WorkLoadConfig().insertWorkLoadConfig(work_load);

            if (result == "OK")
            {
                divSuccess.Visible = true;
                showDiv.Visible    = false;
            }
            else
            {
                MsgValidate("ไม่สามารถเพิ่มภาระงานสอนตามตำแหน่ง กรุณาทำใหม่อีกครั้ง");
            }
        }
    }
Ejemplo n.º 3
0
    public float checkEditLecturerCredit2(string academic_year, string semester, string lecturer_code, float new_credit, SubCreditData old_subcredit)
    {
        float response = -1;


        SysUser user = new SysUser();

        user = new SysUser().getSysUser(lecturer_code);

        Sysuser2 user2 = new Sysuser2();

        user2 = new Sysuser2().getSysuser2(lecturer_code);

        float totalCredit   = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, user.Position).TotalCredit;
        float currentCredit = getTotalCreditforEdit(academic_year, semester, lecturer_code, old_subcredit);

        float new_currentCredit = currentCredit + new_credit;

        if (new_currentCredit <= totalCredit)
        {
            response = -1;
        }
        else
        {
            response = totalCredit - currentCredit;
        }

        return(response);
    }
Ejemplo n.º 4
0
    public LecturerTableData checkLecturerCredit(List <LecturerTableData> alllecturer_data)
    {
        LecturerTableData response = new LecturerTableData();

        foreach (LecturerTableData lec in alllecturer_data)
        {
            SysUser user = new SysUser();
            user = new SysUser().getSysUser(lec.Lecturer);

            Sysuser2 user2 = new Sysuser2();
            user2 = new Sysuser2().getSysuser2(lec.Lecturer);

            float totalCredit   = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, user.Position).TotalCredit;
            float currentCredit = getTotalCredit(lec.AcademicYear, lec.Semester, lec.Lecturer);

            if (currentCredit >= totalCredit)
            {
                response = lec;
                break;
            }
        }



        return(response);
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        string lecturer_type     = Request.QueryString["type"];
        string lecturer_position = Request.QueryString["position"];

        string result = new WorkLoadConfig().deleteWorkLoadConfig(lecturer_type, lecturer_position);

        if (result == "OK")
        {
            divSuccess.Visible = true;
            divDelete.Visible  = false;
        }
        else
        {
            MsgValidate("ไม่สามารถลบภาระงานสอนตามตำแหน่ง กรุณาทำใหม่อีกครั้ง");
        }
    }
Ejemplo n.º 6
0
    public LecturerTableData checkHourRefNormalDay(List <LecturerTableData> alllecturer_data, TeachingTableData teaching_data)
    {
        LecturerTableData response = new LecturerTableData();

        if (teaching_data.Teaching_Day == "1" || teaching_data.Teaching_Day == "2" || teaching_data.Teaching_Day == "3" || teaching_data.Teaching_Day == "4" || teaching_data.Teaching_Day == "5")
        {
            int start_time = (int)Convert.ToDouble(teaching_data.Teaching_Start_Time.Replace(':', '.'));

            if (start_time >= 16)
            {
                foreach (LecturerTableData lec in alllecturer_data)
                {
                    SysUser user = new SysUser();
                    user = new SysUser().getSysUser(lec.Lecturer);

                    Sysuser2 user2 = new Sysuser2();
                    user2 = new Sysuser2().getSysuser2(lec.Lecturer);

                    if (user2.Lecturer_Type != "03")    // อาจารย์พิเศษ
                    {
                        float totalHourRef   = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, user.Position).HourReference;
                        float currentHourRef = getInTimeHourRef(teaching_data.AcademicYear, teaching_data.Semester, lec.Lecturer);

                        if (currentHourRef < totalHourRef)
                        {
                            response = lec;
                            break;
                        }
                    }
                }
            }
        }


        return(response);
    }
    private void createCreditTable2()
    {
        CourseData course_data = new Course().getCourse(available_data.Course_Code);

        tblSubCredit.Rows.Clear();

        // แบ่งโหลด
        string[] ar5 = { "ชื่ออาจารย์", "ภาระงานสอน ชั่วโมง/หน่วยกิต", "ชั่วโมงสอนอ้างอิง", "หน่วยกิตรวม", "แบ่งหน่วยกิต" };

        Table tb5 = new Table();

        tb5.Attributes.Add("class", "table table-bordered table-striped");
        tb5.Attributes.Add("id", "dt_basic5");
        TableHeaderRow tRowHead5 = new TableHeaderRow();

        tRowHead5.TableSection = TableRowSection.TableHeader;
        for (int cellCtr = 1; cellCtr <= ar5.Length; cellCtr++)
        {
            // Create a new cell and add it to the row.
            TableHeaderCell cellHead5 = new TableHeaderCell();
            cellHead5.Text = ar5[cellCtr - 1];
            cellHead5.Attributes.Add("class", "text-align-center");
            tRowHead5.Cells.Add(cellHead5);
        }

        tb5.Rows.Add(tRowHead5);

        int i = 0;

        List <LecturerTableData> new_lecturertable = new List <LecturerTableData>();

        //List<LecturerTableData> tmp = new List<LecturerTableData>();
        new_lecturertable = lecturertable.OrderBy(o => o.Lecturer).ToList();

        //string lec_code = "";
        //foreach (LecturerTableData lect_data in tmp)
        //    {
        //    if (lect_data.Lecturer != lec_code)
        //        {
        //        new_lecturertable.Add(lect_data);
        //        }

        //    lec_code = lect_data.Lecturer;
        //    }



        foreach (LecturerTableData lect_data in new_lecturertable)
        {
            subcreditData = (List <SubCreditData>)Session["subCredit"];

            SysUser user1 = new SysUser();
            user1 = new SysUser().getSysUser(lect_data.Lecturer);
            Sysuser2 user2 = new Sysuser2();
            user2 = new Sysuser2().getSysuser2(lect_data.Lecturer);

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

            TableCell cellLecName = new TableCell();
            cellLecName.Text = lecturerObj.getLecturer(lect_data.Lecturer).First_ThaiName + " " + lecturerObj.getLecturer(lect_data.Lecturer).Family_ThaiName;
            tRowBody5.Cells.Add(cellLecName);

            WorkLoadConfigData workload = new WorkLoadConfigData();
            workload = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, user1.Position);

            TableCell cellLoad = new TableCell();
            cellLoad.Text = workload.HourReference.ToString() + " / " + workload.TotalCredit.ToString();
            cellLoad.Attributes.Add("class", "text-align-center");
            tRowBody5.Cells.Add(cellLoad);

            TableCell cellHourRef = new TableCell();
            cellHourRef.Text = new WorkLoadCalculate().getHourRef(lect_data.AcademicYear, lect_data.Semester, lect_data.Lecturer).ToString();
            cellHourRef.Attributes.Add("class", "text-align-center");
            tRowBody5.Cells.Add(cellHourRef);

            TableCell cellTotalCredit = new TableCell();
            cellTotalCredit.Text = new WorkLoadCalculate().getTotalCredit(lect_data.AcademicYear, lect_data.Semester, lect_data.Lecturer).ToString();
            cellTotalCredit.Attributes.Add("class", "text-align-center");
            tRowBody5.Cells.Add(cellTotalCredit);


            int credit = course_data.Credit;

            if (lect_data.Course_Type == "1")
            {
                if (course_data.Practice != 0)
                {
                    credit = course_data.Theory;
                }
                else
                {
                    credit = course_data.Credit;
                }
            }
            else if (lect_data.Course_Type == "2")
            {
                if (course_data.Theory != 0)
                {
                    credit = course_data.Practice / 2;
                }
                else
                {
                    credit = course_data.Credit;
                }
            }


            TableCell cellSubCredit = new TableCell();
            txtSubCredit                 = new TextBox[new_lecturertable.Count];
            txtSubCredit[i]              = new TextBox();
            txtSubCredit[i].ID           = lect_data.Lecturer + lect_data.Teaching_Day + lect_data.Teaching_Start_Time.Replace(":", "").Replace(".", "") + lect_data.Teaching_End_Time.Replace(":", "").Replace(".", "");
            txtSubCredit[i].MaxLength    = 5;
            txtSubCredit[i].Width        = 50;
            txtSubCredit[i].AutoPostBack = true;

            txtSubCredit[i].Text = subcreditData[i].ToString();
            txtSubCredit[i].Attributes.Add("class", "text-align-center");
            txtSubCredit[i].TextChanged += new EventHandler(txtChanged);


            cellSubCredit.Attributes.Add("class", "text-align-center");
            cellSubCredit.Controls.Add(txtSubCredit[i]);
            tRowBody5.Cells.Add(cellSubCredit);

            tb5.Rows.Add(tRowBody5);

            i++;
        }

        TableRow  row5  = new TableRow();
        TableCell cell5 = new TableCell();

        cell5.Controls.Add(tb5);
        row5.Cells.Add(cell5);
        tblSubCredit.Rows.Add(row5);
    }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.admin_faculty))
            {
                /*=============================*/
                if (!Page.IsPostBack)
                {
                    fail.Visible       = false;
                    divSuccess.Visible = false;

                    // ประเภทอาจารย์
                    ddlLecturerType.Items.Clear();
                    List <LecturerType> lec_type = new List <LecturerType>();
                    lec_type = new LecturerType().getLecturerType2();
                    foreach (LecturerType row in lec_type)
                    {
                        ddlLecturerType.Items.Insert(ddlLecturerType.Items.Count, new ListItem(row.LecturerTypeName, row.LecturerTypeCode));
                    }
                    //===========

                    // ตำแหน่ง
                    ddlPosition.Items.Clear();
                    List <BoardPosData> position_data = new List <BoardPosData>();
                    position_data = new BoardPos().getBoardPos();
                    foreach (BoardPosData pos in position_data)
                    {
                        ddlPosition.Items.Insert(ddlPosition.Items.Count, new ListItem(pos.Position_Thai, pos.Position_Code));
                    }

                    try
                    {
                        string lecturer_type     = Request.QueryString["type"];
                        string lecturer_position = Request.QueryString["position"];

                        WorkLoadConfigData workload_data = new WorkLoadConfigData();
                        workload_data = new WorkLoadConfig().getWorkLoadConfig(lecturer_type, lecturer_position);

                        ddlLecturerType.Items.FindByValue(lecturer_type).Selected = true;
                        ddlPosition.Items.FindByValue(lecturer_position).Selected = true;
                        txtWorkloadValue.Text    = workload_data.HourReference.ToString();
                        txtMaxWorkloadValue.Text = workload_data.TotalCredit.ToString();

                        ddlLecturerType.Enabled = false;
                        ddlPosition.Enabled     = false;
                    }
                    catch (Exception err)
                    {
                        Session["response"] = err.ToString();
                        Response.Redirect("err_response.aspx");
                    }
                }
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Ejemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.officer_department) || autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.lecturer))
            {
                /*=============================*/
                if (!Page.IsPostBack)
                {
                    config_data           = new SystemConfig().getConfig();
                    txtACADEMIC_YEAR.Text = config_data.AcademicYear;
                    academic_year         = config_data.AcademicYear;
                    ddlSEMESTER.Items.FindByValue(config_data.Semester).Selected = true;
                }
                academic_year = txtACADEMIC_YEAR.Text;

                // Head Table
                string[] ar  = { "ลำดับ", "ชื่ออาจารย์", "ตำแหน่ง", "ชั่วโมงสอนอ้างอิง", "หน่วยกิตรวม", "ภาระงานสอน ชั่วโมง/หน่วยกิต", "รายละเอียด" };
                Table    tb1 = new Table();
                tb1.Attributes.Add("class", "table table-bordered table-striped table-hover");
                tb1.Attributes.Add("id", "dt_basic");
                TableHeaderRow tRowHead = new TableHeaderRow();
                tRowHead.TableSection = TableRowSection.TableHeader;

                for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
                {
                    TableHeaderCell cellHead = new TableHeaderCell();
                    cellHead.Text = ar[cellCtr - 1];
                    cellHead.Attributes.Add("class", "text-center");
                    tRowHead.Cells.Add(cellHead);
                }
                tb1.Rows.Add(tRowHead);


                List <SysUser> lecturerALL = new List <SysUser>();

                if (autro_obj.CheckGroupUser(login_data, group_var.lecturer))
                {
                    SysUser lecturer = new SysUser().getSysUser(login_data.Nation_ID);
                    lecturerALL.Add(lecturer);
                }
                else
                {
                    lecturerALL = new SysUser().getSysUser();
                }



                int num = 1;
                foreach (SysUser lec in lecturerALL)
                {
                    TableRow tRowBody = new TableRow();
                    tRowBody.TableSection = TableRowSection.TableBody;

                    TableCell cellNum = new TableCell();
                    cellNum.Attributes.Add("class", "text-center");
                    cellNum.Text = num.ToString();
                    tRowBody.Cells.Add(cellNum);

                    TableCell cellName = new TableCell();
                    cellName.Text = new AcademicPosition().getAcademicPosition(lec.AcademicPositionCode).AcademicPositionThName + " " + lec.ThName + " " + lec.ThSurName;
                    tRowBody.Cells.Add(cellName);

                    TableCell cellPosition = new TableCell();
                    cellPosition.Attributes.Add("class", "text-center");
                    cellPosition.Text = new BoardPos().getBoardPos(lec.Position).Position_Thai;
                    tRowBody.Cells.Add(cellPosition);

                    TableCell cellHourRef = new TableCell();
                    cellHourRef.Attributes.Add("class", "text-center");
                    cellHourRef.Text = new WorkLoadCalculate().getHourRef(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lec.IdCode).ToString();
                    tRowBody.Cells.Add(cellHourRef);

                    TableCell cellTotalCredit = new TableCell();
                    cellTotalCredit.Attributes.Add("class", "text-center");
                    cellTotalCredit.Text = new WorkLoadCalculate().getTotalCredit(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lec.IdCode).ToString();
                    tRowBody.Cells.Add(cellTotalCredit);

                    Sysuser2 user2 = new Sysuser2();
                    user2 = new Sysuser2().getSysuser2(lec.IdCode);
                    WorkLoadConfigData workload = new WorkLoadConfigData();
                    workload = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, lec.Position);

                    TableCell cellLoad = new TableCell();
                    cellLoad.Attributes.Add("class", "text-center");
                    cellLoad.Text = workload.HourReference.ToString() + " / " + workload.TotalCredit.ToString();
                    tRowBody.Cells.Add(cellLoad);

                    TableCell cellDetail = new TableCell();
                    cellDetail.Attributes.Add("class", "text-center");

                    if (autro_obj.CheckGroupUser(login_data, group_var.lecturer))
                    {
                        if (login_data.Nation_ID == lec.IdCode)
                        {
                            string    urlDetail = "detail_WorkLoad.aspx?lecturer=" + lec.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue;
                            HyperLink hypDetail = new HyperLink();
                            hypDetail.Text        = "<h4><i class='fa fa-search'></i></h4>";
                            hypDetail.NavigateUrl = urlDetail;
                            hypDetail.ToolTip     = "Detail";
                            hypDetail.Target      = "_Blank";
                            cellDetail.Controls.Add(hypDetail);
                        }
                        else
                        {
                            string    urlDetail = "#";
                            HyperLink hypDetail = new HyperLink();
                            hypDetail.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                            hypDetail.NavigateUrl = urlDetail;
                            hypDetail.ToolTip     = "Detail";
                            hypDetail.Target      = "_Blank";
                            cellDetail.Controls.Add(hypDetail);
                        }
                    }
                    else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                    {
                        string    urlDetail = "detail_WorkLoad.aspx?lecturer=" + lec.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue;
                        HyperLink hypDetail = new HyperLink();
                        hypDetail.Text        = "<h4><i class='fa fa-search'></i></h4>";
                        hypDetail.NavigateUrl = urlDetail;
                        hypDetail.ToolTip     = "Detail";
                        hypDetail.Target      = "_Blank";
                        cellDetail.Controls.Add(hypDetail);
                    }
                    else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                    {
                        bool          authorized            = false;
                        List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                        foreach (string dep in department_authorized)
                        {
                            if (dep == lec.DepartmentCode)
                            {
                                authorized = true;
                                break;
                            }
                        }

                        if (authorized == true)
                        {
                            string    urlDetail = "detail_WorkLoad.aspx?lecturer=" + lec.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue;
                            HyperLink hypDetail = new HyperLink();
                            hypDetail.Text        = "<h4><i class='fa fa-search'></i></h4>";
                            hypDetail.NavigateUrl = urlDetail;
                            hypDetail.ToolTip     = "Detail";
                            hypDetail.Target      = "_Blank";
                            cellDetail.Controls.Add(hypDetail);
                        }
                        else
                        {
                            string    urlDetail = "#";
                            HyperLink hypDetail = new HyperLink();
                            hypDetail.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                            hypDetail.NavigateUrl = urlDetail;
                            hypDetail.ToolTip     = "Detail";
                            hypDetail.Target      = "_Blank";
                            cellDetail.Controls.Add(hypDetail);
                        }
                    }


                    tRowBody.Cells.Add(cellDetail);

                    tb1.Rows.Add(tRowBody);

                    num++;
                }

                TableRow  row  = new TableRow();
                TableCell cell = new TableCell();
                cell.Controls.Add(tb1);
                row.Cells.Add(cell);
                tblWorkLoad.Rows.Add(row);
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Ejemplo n.º 10
0
    public LecturerTableData checkHourRefNormalDay2(List <LecturerTableData> alllecturer_data, TeachingTableData teaching_data, SubCreditData subcredit)
    {
        LecturerTableData response = new LecturerTableData();

        if (teaching_data.Teaching_Day == "1" || teaching_data.Teaching_Day == "2" || teaching_data.Teaching_Day == "3" || teaching_data.Teaching_Day == "4" || teaching_data.Teaching_Day == "5")
        {
            CourseData    course_data = new CourseData();
            HourReferData hour_data   = new HourReferData();

            int start_time = (int)Convert.ToDouble(teaching_data.Teaching_Start_Time.Replace(':', '.'));

            if (start_time >= 16)
            {
                foreach (LecturerTableData lec in alllecturer_data)
                {
                    float hour_ref = 0;

                    SysUser user = new SysUser();
                    user = new SysUser().getSysUser(lec.Lecturer);

                    Sysuser2 user2 = new Sysuser2();
                    user2 = new Sysuser2().getSysuser2(lec.Lecturer);

                    if (user2.Lecturer_Type != "03") // อาจารย์พิเศษ
                    {
                        course_data = new Course().getCourse(teaching_data.Course_Code);

                        if (course_data.Course_DegreeLevel == "01")// ปวช.
                        {
                            hour_data = new HourRefer().getHourRefer("U", teaching_data.Course_Type);
                            hour_ref  = hour_data.HourRefer * subcredit.SubCredit;
                        }
                        else if (course_data.Course_DegreeLevel == "02") //ป.ตรี
                        {
                            hour_data = new HourRefer().getHourRefer("B", teaching_data.Course_Type);
                            hour_ref  = hour_data.HourRefer * subcredit.SubCredit;
                        }
                        else
                        {     // บัณฑิต
                            hour_data = new HourRefer().getHourRefer("M", teaching_data.Course_Type);
                            hour_ref  = hour_data.HourRefer * subcredit.SubCredit;
                        }

                        float totalHourRef   = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, user.Position).HourReference;
                        float currentHourRef = getHourRef(teaching_data.AcademicYear, teaching_data.Semester, lec.Lecturer);

                        currentHourRef -= hour_ref;

                        if (currentHourRef < totalHourRef)
                        {
                            response = lec;
                            break;
                        }
                    }
                }
            }
        }


        return(response);
    }
Ejemplo n.º 11
0
    protected void btnSEARCH_Click(object sender, EventArgs e)
    {
        SysUser lecturerALL = new SysUser();

        lecturerALL = new SysUser().getSysUser(txtLecturerID.Text);

        int num = 1;

        if (lecturerALL.IdCode != null)
        {
            divShow.Visible = true;
        }
        else
        {
            divShow.Visible = false;
        }


        // Head Table
        string[] ar  = { "ลำดับ", "ชื่ออาจารย์", "ตำแหน่ง", "ชั่วโมงสอนอ้างอิง", "หน่วยกิตรวม", "ภาระงานสอน ชั่วโมง/หน่วยกิต", "เพิ่ม", "แก้ไข", "ลบ" };
        Table    tb1 = new Table();

        tb1.Attributes.Add("class", "table table-bordered table-striped table-hover");
        tb1.Attributes.Add("id", "dt_basic");
        TableHeaderRow tRowHead = new TableHeaderRow();

        tRowHead.TableSection = TableRowSection.TableHeader;

        for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
        {
            TableHeaderCell cellHead = new TableHeaderCell();
            cellHead.Text = ar[cellCtr - 1];
            cellHead.Attributes.Add("class", "text-center");
            tRowHead.Cells.Add(cellHead);
        }
        tb1.Rows.Add(tRowHead);



        TableRow tRowBody = new TableRow();

        tRowBody.TableSection = TableRowSection.TableBody;

        TableCell cellNum = new TableCell();

        cellNum.Attributes.Add("class", "text-center");
        cellNum.Text = num.ToString();
        tRowBody.Cells.Add(cellNum);

        TableCell cellName = new TableCell();

        cellName.Text = new AcademicPosition().getAcademicPosition(lecturerALL.AcademicPositionCode).AcademicPositionThName + " " + lecturerALL.ThName + " " + lecturerALL.ThSurName;
        tRowBody.Cells.Add(cellName);

        TableCell cellPosition = new TableCell();

        cellPosition.Attributes.Add("class", "text-center");
        cellPosition.Text = new BoardPos().getBoardPos(lecturerALL.Position).Position_Thai;
        tRowBody.Cells.Add(cellPosition);

        TableCell cellHourRef = new TableCell();

        cellHourRef.Attributes.Add("class", "text-center");
        cellHourRef.Text = new WorkLoadCalculate().getHourRef(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lecturerALL.IdCode).ToString();
        tRowBody.Cells.Add(cellHourRef);

        TableCell cellTotalCredit = new TableCell();

        cellTotalCredit.Attributes.Add("class", "text-center");
        cellTotalCredit.Text = new WorkLoadCalculate().getTotalCredit(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lecturerALL.IdCode).ToString();
        tRowBody.Cells.Add(cellTotalCredit);

        Sysuser2 user2 = new Sysuser2();

        user2 = new Sysuser2().getSysuser2(lecturerALL.IdCode);
        WorkLoadConfigData workload = new WorkLoadConfigData();

        workload = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, lecturerALL.Position);

        TableCell cellLoad = new TableCell();

        cellLoad.Attributes.Add("class", "text-center");
        cellLoad.Text = workload.HourReference.ToString() + " / " + workload.TotalCredit.ToString();
        tRowBody.Cells.Add(cellLoad);

        string    urlAdd = "AddWorkLoad.aspx?lecturer=" + lecturerALL.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue;
        HyperLink hypAdd = new HyperLink();

        hypAdd.Text = "<h4><i class='fa fa-book'></i></h4>";
        hypAdd.Attributes.Add("data-target", "#modal001");
        hypAdd.Attributes.Add("data-toggle", "modal");
        hypAdd.NavigateUrl = urlAdd;
        hypAdd.ToolTip     = "Add";
        hypAdd.Target      = "_Blank";

        TableCell cellAdd = new TableCell();

        cellAdd.Width = 100;
        cellAdd.Attributes.Add("class", "text-center");
        cellAdd.Controls.Add(hypAdd);
        tRowBody.Cells.Add(cellAdd);

        float add_ref    = new AddWorkLoad().getAddWorkLoad(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lecturerALL.IdCode).HourRefer;
        float add_credit = new AddWorkLoad().getAddWorkLoad(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lecturerALL.IdCode).HourRefer;

        string    urlUpdate = "#";
        string    urlDelete = "#";
        HyperLink hypUpdate = new HyperLink();
        HyperLink hypDelete = new HyperLink();

        if (add_credit + add_ref == 0)
        {
            hypUpdate.Text = "<h4><i class='fa fa-ban'></i></h4>";
            hypUpdate.Attributes.Add("data-target", "#modal001");
            hypUpdate.ToolTip = "Update";
            hypUpdate.Target  = "_Blank";

            hypDelete.Text    = "<h4><i class='fa fa-ban'></i></h4>";
            hypDelete.ToolTip = "Delete";
            hypDelete.Target  = "_Blank";
        }
        else
        {
            urlUpdate = "EditWorkLoad.aspx?lecturer=" + lecturerALL.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue;

            urlDelete = "delAddWorkLoad.aspx?lecturer=" + lecturerALL.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue;

            hypUpdate.Text = "<h4><i class='fa fa-edit'></i></h4>";
            hypUpdate.Attributes.Add("data-target", "#modal001");
            hypUpdate.Attributes.Add("data-toggle", "modal");
            hypUpdate.NavigateUrl = urlUpdate;
            hypUpdate.ToolTip     = "Update";
            hypUpdate.Target      = "_Blank";

            hypDelete.Text = "<h4><i class='fa fa-trash-o'></i></h4>";
            hypDelete.Attributes.Add("data-target", "#modal001");
            hypDelete.Attributes.Add("data-toggle", "modal");
            hypDelete.NavigateUrl = urlDelete;
            hypDelete.ToolTip     = "Delete";
            hypDelete.Target      = "_Blank";
        }



        TableCell cellUpdate = new TableCell();

        cellUpdate.Width = 100;
        cellUpdate.Attributes.Add("class", "text-center");
        cellUpdate.Controls.Add(hypUpdate);
        tRowBody.Cells.Add(cellUpdate);

        TableCell cellDelete = new TableCell();

        cellDelete.Width = 100;
        cellDelete.Attributes.Add("class", "text-center");
        cellDelete.Controls.Add(hypDelete);
        tRowBody.Cells.Add(cellDelete);

        tb1.Rows.Add(tRowBody);

        num++;

        TableRow  row  = new TableRow();
        TableCell cell = new TableCell();

        cell.Controls.Add(tb1);
        row.Cells.Add(cell);
        tblWorkLoad.Rows.Add(row);
    }