Esempio n. 1
0
    // V 1.0.0
    public List <LectuereInformationData> getLecturerbyFaculty(string faculty_code)
    {
        List <LectuereInformationData> lecturerData = new List <LectuereInformationData>();
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        try
        {
            oracleObj.SelectCommand = "Select * From SYSUSER Where (FACULTYCODE = '" + faculty_code + "') OR  (IDCODE='0000000000000') Order By IDCODE";
            DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
            foreach (DataRowView rowData in allData)
            {
                LectuereInformationData lecturer_data = new LectuereInformationData();
                lecturer_data.Lecturer_ID           = rowData["IDCODE"].ToString();
                lecturer_data.Lecturer_ShortName    = rowData["SHORT_NAME"].ToString();
                lecturer_data.First_ThaiName        = rowData["THNAME"].ToString();
                lecturer_data.Family_ThaiName       = rowData["THSURNAME"].ToString();
                lecturer_data.First_EngName         = rowData["ENNAME"].ToString();
                lecturer_data.Family_EngName        = rowData["ENSURNAME"].ToString();
                lecturer_data.AcademicPosition_Code = rowData["ACADEMICPOSITIONCODE"].ToString();
                lecturer_data.Faculty_Code          = rowData["FACULTYCODE"].ToString();
                lecturer_data.Department_Code       = rowData["DEPARTMENTCODE"].ToString();
                lecturer_data.Grad_Lecturer         = rowData["GRAD_LECTURER"].ToString();
                lecturerData.Add(lecturer_data);
            }
        }
        catch
        {
            HttpContext.Current.Session["response"] = "Unit Test:Lecturer:getLecturerbyFaculty" + " ไม่สามารถดำเนินการได้";
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }

        return(lecturerData);
    }
Esempio n. 2
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.lecturer) || autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                // ======== Process ===========
                Student student_data = new Student();
                row1 = Request.QueryString["show_row"];


                if (Session["showStudentAdvisor" + row1] == null)
                {
                    Response.Redirect("List_Segment_Advisor.aspx");
                }
                else
                {
                    student_data = (Student)Session["showStudentAdvisor" + row1];

                    LectuereInformationData lecturer_data = new LectuereInformationData();
                    lecturer_data = new Lecturer().getLecturer(student_data.Advisor_ID);

                    lblAdvisor.Text = "อาจารย์" + lecturer_data.First_ThaiName + " " + lecturer_data.Family_ThaiName;
                    lblFaculty.Text = new Faculty().getFaculty(student_data.Faculty_Code).Faculty_Thai;

                    degree_char = student_data.Degree_Char;

                    // Head Table
                    string[] ar  = { "รหัสนักศึกษา", "ชื่อ-นามสกุล", "คณะ", "หลักสูตร", "ประเภท", "ประเภท", "กลุ่ม" };
                    Table    tb1 = new Table();
                    tb1.Attributes.Add("class", "table table-bordered table-hover table-striped");
                    tb1.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);
                    }

                    tb1.Rows.Add(tRowHead);

                    StudentAdvisor = new Student().getStudentAdvisor(student_data.Faculty_Code, student_data.Curri_Code, student_data.Std_Category_Code, student_data.Section_Code, student_data.StudentGruop, student_data.Advisor_ID, degree_char);

                    foreach (Student data in StudentAdvisor)
                    {
                        TableRow tRowBody = new TableRow();
                        tRowBody.TableSection = TableRowSection.TableBody;


                        TableCell cellStudentID = new TableCell();
                        cellStudentID.Text = data.Student_ID;
                        tRowBody.Cells.Add(cellStudentID);

                        TableCell cellName = new TableCell();
                        cellName.Text = data.First_ThaiName + " " + data.Family_ThaiName;
                        tRowBody.Cells.Add(cellName);

                        TableCell cellFaculty = new TableCell();
                        cellFaculty.Text = new Faculty().getFaculty(data.Faculty_Code).Faculty_Thai;
                        tRowBody.Cells.Add(cellFaculty);

                        TableCell cellCurr = new TableCell();
                        cellCurr.Text = new Curriculum().getCurriculum(data.Curri_Code).Curr_ThaiName;
                        tRowBody.Cells.Add(cellCurr);

                        TableCell cellCategory = new TableCell();
                        cellCategory.Text = new StdCategory().getStdCategory(data.Std_Category_Code).StdCategory_Thai;
                        tRowBody.Cells.Add(cellCategory);

                        TableCell cellSection = new TableCell();
                        cellSection.Text = new Section().getSection(data.Section_Code).Section_Thai;
                        tRowBody.Cells.Add(cellSection);

                        TableCell cellGroup = new TableCell();
                        cellGroup.Text = new StdGroup().getStdGroup(data.StudentGruop).StdGroup_Thai;
                        tRowBody.Cells.Add(cellGroup);

                        tb1.Rows.Add(tRowBody);
                    }



                    TableRow  row  = new TableRow();
                    TableCell cell = new TableCell();
                    cell.Controls.Add(tb1);
                    row.Cells.Add(cell);
                    tblStudentAdvisor.Rows.Add(row);
                }
                // ============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
    protected void onclick_section_finish(object sender, EventArgs e)
    {
        try
        {
            bool check = (bool)Session["isOK"];

            if (check)
            {
                result.Text = new AvailableCourse().updateAvailableCourse(available_data, old_available_data, degree_char);

                string[] res = new AvailableStudent().updateAvailableStudent(available_student, old_available_student, degree_char);

                string[] res2 = new TeachingTable().updateTeachingTable(teachtable, old_teaching, degree_char);

                string[] res3 = new LecturerTable().updateLecturerTable(lecturertable, old_lecturer, degree_char);

                string[] res4 = new SubCredit().updateSubCredit(subcreditData, degree_char);

                divBody.Visible    = false;
                divSuccess.Visible = true;
            }
            else
            {
                float totalCredit = 0;

                CourseData course_data = new Course().getCourse(available_data.Course_Code);
                int        credit      = course_data.Credit;

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


                string credit_err = "";
                foreach (SubCreditData subcredit in subcreditData)
                {
                    totalCredit += subcredit.SubCredit;

                    float remain_credit = new WorkLoadCalculate().checkEditLecturerCredit2(subcredit.AcademicYear, subcredit.Semester, subcredit.Lecturer, subcredit.SubCredit, subcredit);

                    if (remain_credit != -1)
                    {
                        credit_err += subcredit.Lecturer + "," + remain_credit;
                        break;
                    }
                }

                if (credit_err.Length > 0)
                {
                    string[] arr = credit_err.Split(',');
                    lblSubDreditErr.Visible = true;
                    LectuereInformationData lec = new LectuereInformationData();
                    lec = new Lecturer().getLecturer(arr[0]);
                    lblSubDreditErr.Text = "อาจารย์ " + lec.First_ThaiName + " " + lec.Family_ThaiName + " ไม่สามารถสอนได้เกิน " + arr[1] + " เครดิต";
                    btnSubmit.Focus();
                }
                else if (totalCredit != credit)
                {
                    lblSubDreditErr.Visible = true;
                    lblSubDreditErr.Text    = "จำนวนหน่วยกิตรวมต้องเท่ากับ " + credit;
                    btnSubmit.Focus();
                }
                else
                {
                    result.Text = new AvailableCourse().updateAvailableCourse(available_data, old_available_data, degree_char);

                    string[] res = new AvailableStudent().updateAvailableStudent(available_student, old_available_student, degree_char);

                    string[] res2 = new TeachingTable().updateTeachingTable(teachtable, old_teaching, degree_char);

                    string[] res3 = new LecturerTable().updateLecturerTable(lecturertable, old_lecturer, degree_char);

                    string[] res4 = new SubCredit().updateSubCredit(subcreditData, degree_char);

                    divBody.Visible    = false;
                    divSuccess.Visible = true;
                }
            }
        }
        catch
        {
            divFail.Visible = true;
        }
    }
    private void txtChanged(object sender, EventArgs e)
    {
        float check_float;

        TextBox txtbox = new TextBox();

        txtbox = (TextBox)sender;

        lblSubDreditErr.Visible  = false;
        lblSubDreditPass.Visible = false;
        Session["isOK"]          = false;

        if (!float.TryParse(txtbox.Text, out check_float))
        {
            lblSubDreditErr.Visible = true;
            lblSubDreditErr.Text    = "โปรดตรวจสอบค่า หน่วยกิต";
        }
        else
        {
            lblSubDreditErr.Visible = false;
            float totalCredit = 0;

            CourseData course_data = new Course().getCourse(available_data.Course_Code);
            int        credit      = course_data.Credit;

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


            string credit_err = "";

            foreach (SubCreditData subcredit in subcreditData)
            {
                string txtid = subcredit.Lecturer + subcredit.Teaching_Day + subcredit.Teaching_Start_Time.Replace(":", "").Replace(".", "") + subcredit.Teaching_End_Time.Replace(":", "").Replace(".", "");


                if (txtid == txtbox.ID)
                {
                    subcredit.SubCredit = float.Parse(txtbox.Text);
                }

                totalCredit += subcredit.SubCredit;

                float remain_credit = new WorkLoadCalculate().checkEditLecturerCredit2(subcredit.AcademicYear, subcredit.Semester, subcredit.Lecturer, subcredit.SubCredit, subcredit);


                if (remain_credit != -1)
                {
                    credit_err += subcredit.Lecturer + "," + remain_credit;
                    break;
                }
            }

            if (credit_err.Length > 0)
            {
                string[] arr = credit_err.Split(',');
                lblSubDreditErr.Visible = true;
                LectuereInformationData lec = new LectuereInformationData();
                lec = new Lecturer().getLecturer(arr[0]);
                lblSubDreditErr.Text = "อาจารย์ " + lec.First_ThaiName + " " + lec.Family_ThaiName + " ไม่สามารถสอนได้เกิน " + arr[1] + " เครดิต";
            }
            else if (totalCredit != credit)
            {
                lblSubDreditErr.Visible = true;
                lblSubDreditErr.Text    = "จำนวนหน่วยกิตรวมต้องเท่ากับ " + credit;
            }
            else
            {
                Session["isOK"]          = true;
                lblSubDreditErr.Visible  = false;
                lblSubDreditPass.Visible = true;
                lblSubDreditPass.Text    = "สามารถดำเนินการได้";
            }
        }

        btnSubmit.Focus();
    }
Esempio n. 5
0
    protected void btnSHOW_Click(object sender, EventArgs e)
    {
        if (ddlCURRICULUM.SelectedValue == "0")
        {
            divShow.Visible = false;
            MsgValidate("โปรดระบุ หลักสูตร");
        }
        else if (ddlADVISOR.SelectedValue == "00")
        {
            divShow.Visible = false;
            MsgValidate("โปรดระบุ อาจารย์");
        }
        else
        {
            divShow.Visible = true;
            divFail.Visible = false;
            // lblLectuere.Text = "";

            int            show_row    = 0;
            List <Student> studentData = new List <Student>();
            studentData = new Student().getGroupStudentAdvisor(ddlFACULTY.SelectedValue, ddlDepartment.SelectedValue, ddlCURRICULUM.SelectedValue, "0", "0", "0", ddlADVISOR.SelectedValue, ddlDEGREE.SelectedValue);

            studentData.Sort(delegate(Student advisor1, Student advisor2) { return(advisor1.Advisor_ID.CompareTo(advisor2.Advisor_ID)); });

            var result = studentData.GroupBy(a => a.Advisor_ID);
            int count  = 0;
            int i      = 0;
            foreach (var r in result)
            {
                count++;
            }

            Table[]          tb1      = new Table[count];
            TableHeaderRow[] tRowHead = new TableHeaderRow[count];


            foreach (var r in result)
            {
                // Head Table
                // string[]  ar = { "ระดับการศึกษา", "คณะ", "หลักสูตร", "ประเภท", "รอบ", "ห้อง", "ดูข้อมูล", "แก้ไข" };

                List <string> ar = new List <string>(new string[] { "ระดับการศึกษา", "คณะ", "หลักสูตร", "ประเภท", "รอบ", "ห้อง", "ดูข้อมูล", "แก้ไข" });


                tb1[i] = new Table();
                tb1[i].Attributes.Add("width", "100%");
                tb1[i].Attributes.Add("class", "table table-bordered table-hover table-striped");
                tb1[i].Attributes.Add("id", "dt_basic" + i);

                tRowHead[i] = new TableHeaderRow();
                tRowHead[i].TableSection = TableRowSection.TableHeader;
                for (int cellCtr = 1; cellCtr <= ar.Count; cellCtr++)
                {
                    // Create a new cell and add it to the row.
                    TableHeaderCell cellHead = new TableHeaderCell();
                    cellHead.Text = ar[cellCtr - 1];
                    cellHead.Attributes.Add("class", "text-center");
                    tRowHead[i].Cells.Add(cellHead);
                }

                tb1[i].Rows.Add(tRowHead[i]);
                string Lectuere_Name = "";
                foreach (Student data in studentData)
                {
                    if (data.Advisor_ID == r.Key)
                    {
                        Session["showStudentAdvisor" + show_row] = data;
                        Lecturer_data = new Lecturer().getLecturer(data.Advisor_ID);

                        Lectuere_Name = Lecturer_data.Lecturer_ShortName + " " + Lecturer_data.First_ThaiName + " " + Lecturer_data.Family_ThaiName;

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

                        TableCell cellDegree = new TableCell();
                        cellDegree.Text = new Degree().getDegreeChar(data.Degree_Char).Degree_Thai;
                        cellDegree.Attributes.Add("class", "text-center");
                        tRowBody.Cells.Add(cellDegree);

                        TableCell cellFaculty = new TableCell();
                        cellFaculty.Text = new Faculty().getFaculty(data.Faculty_Code).Faculty_Thai;
                        cellFaculty.Attributes.Add("class", "text-center");
                        tRowBody.Cells.Add(cellFaculty);

                        TableCell             cellCurr  = new TableCell();
                        CurriculumGeneralData curr_data = new Curriculum().getCurriculum(data.Curri_Code);
                        cellCurr.Text = curr_data.Curr_Code + " " + curr_data.Curr_ThaiName + " (" + curr_data.Curr_Year + ")";
                        tRowBody.Cells.Add(cellCurr);

                        TableCell cellCategory = new TableCell();
                        cellCategory.Text = new StdCategory().getStdCategory(data.Std_Category_Code).StdCategory_Thai;
                        cellCategory.Attributes.Add("class", "text-center");
                        tRowBody.Cells.Add(cellCategory);

                        TableCell cellSection = new TableCell();
                        cellSection.Text = new Section().getSection(data.Section_Code).Section_Thai;
                        cellSection.Attributes.Add("class", "text-center");
                        tRowBody.Cells.Add(cellSection);

                        TableCell cellGroup = new TableCell();
                        cellGroup.Text = new StdGroup().getStdGroup(data.StudentGruop).StdGroup_Thai;
                        cellGroup.Attributes.Add("class", "text-center");
                        tRowBody.Cells.Add(cellGroup);

                        TableCell cellView = new TableCell();
                        string    urlView  = "View_Seg_Advisor.aspx?show_row=" + show_row.ToString();
                        HyperLink hypView  = new HyperLink();
                        hypView.Attributes.Add("target", "_blank");
                        hypView.Attributes.Add("class", "text-center");
                        hypView.Text        = "<h4><i class='fa fa-search'></i></h4>";
                        hypView.NavigateUrl = urlView;
                        hypView.ToolTip     = "ดูข้อมูล";
                        cellView.Controls.Add(hypView);
                        tRowBody.Cells.Add(cellView);

                        TableCell cellEdit = new TableCell();
                        HyperLink hypEdit  = new HyperLink();

                        if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                        {
                            string urlEdit = "Edit_Segment_Advisor.aspx?show_row=" + show_row.ToString();
                            hypEdit.Attributes.Add("class", "text-center");
                            hypEdit.Text        = "<h4><i class='fa fa-edit'></i></h4>";
                            hypEdit.NavigateUrl = urlEdit;
                            hypEdit.ToolTip     = "แก้ไข";
                            cellEdit.Controls.Add(hypEdit);
                            tRowBody.Cells.Add(cellEdit);
                        }
                        else
                        {
                            string urlEdit = "#";
                            hypEdit.Attributes.Add("class", "text-center");
                            hypEdit.Text        = "<h4><i class=\"fa fa-lock\"></i></h4>";
                            hypEdit.NavigateUrl = urlEdit;
                            hypEdit.ToolTip     = "ไม่พบสิทธิ์การแก้ไขข้อมูล";
                            cellEdit.Controls.Add(hypEdit);
                            tRowBody.Cells.Add(cellEdit);
                        }



                        tb1[i].Rows.Add(tRowBody);

                        show_row++;
                    }
                }

                string table_struct = "<div class='jarviswidget jarviswidget-color-primary' data-widget-editbutton='false' data-widget-custombutton='false' data-widget-deletebutton='false' data-widget-fullscreenbutton='false'><header><span class='widget-icon'><i class='fa fa-table'></i></span><h2>" + Lectuere_Name + "</h2></header><div>";
                table_struct += "<div class='widget-body no-padding'><div class='widget-body-toolbar'></div>";
                LiteralControl div_row = new LiteralControl(table_struct);

                panelStudentAdvisor.Controls.Add(div_row);
                panelStudentAdvisor.Controls.Add(tb1[i]);
                LiteralControl div_row2 = new LiteralControl("</div></div></div>");

                panelStudentAdvisor.Controls.Add(div_row2);
                i++;
            }

            if (count == 0)
            {
                string table_struct = "<div class='jarviswidget jarviswidget-color-primary' data-widget-editbutton='false' data-widget-custombutton='false' data-widget-deletebutton='false' data-widget-fullscreenbutton='false'><header><span class='widget-icon'><i class='fa fa-table'></i></span><h2>ไม่พบข้อมูล</h2></header><div>";
                table_struct += "<div class='widget-body no-padding'><div class='widget-body-toolbar'></div>";
                table_struct += "</div></div></div>";
                LiteralControl div_row = new LiteralControl(table_struct);
                panelStudentAdvisor.Controls.Add(div_row);
            }
        }
    }
Esempio n. 6
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.lecturer))
            {
                // ======== Process ===========
                if (!Page.IsPostBack)
                {
                    if (Session["Extend_Data"] == null)
                    {
                        Response.Redirect("List_Course_Lecturer.aspx");
                    }

                    Session.Remove("save_student_data");

                    divFail.Visible      = false;
                    divDupRegis.Visible  = false;
                    divDupExtend.Visible = false;
                    btnSAVE.Enabled      = false;
                    btnEdit.Enabled      = false;
                    btnEdit.Visible      = false;

                    LecturerTableData lec = (LecturerTableData)Session["Extend_Data"];
                    lecturer_data = new Lecturer().getLecturer(lec.Lecturer);
                    course_data   = new Course().getCourse(lec.Course_Code);

                    string course_type = "";
                    string course_sec  = "";

                    if (lec.Course_Type == "1")
                    {
                        course_type = "S.";
                    }
                    else if (lec.Course_Type == "2")
                    {
                        course_type = "L.";
                    }
                    else if (lec.Course_Type == "4")
                    {
                        course_type = "T.";
                    }
                    else if (lec.Course_Type == "5")
                    {
                        course_type = "M.";
                    }
                    else if (lec.Course_Type == "6")
                    {
                        course_type = "SP.";
                    }
                    else if (lec.Course_Type == "7")
                    {
                        course_type = "D.";
                    }

                    if (lec.SubSec_No != 0)
                    {
                        course_sec = lec.SubSec_No.ToString();
                    }
                    else
                    {
                        course_sec = lec.Sec_No.ToString();
                    }

                    lblLec.Text  = lecturer_data.Lecturer_ShortName + " " + lecturer_data.First_ThaiName + " " + lecturer_data.Family_ThaiName;
                    lblHead.Text = course_type + course_sec + " " + course_data.Course_Code + " " + course_data.Course_Thainame + " " + course_data.Course_Engname;
                }

                row1 = Request.QueryString["show_row"];
                divSuccess.Visible = false;
                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        config_data   = new SystemConfig().getConfig();
        academic_year = config_data.AcademicYear;
        semester      = config_data.Semester;


        Student student_data = new Student();

        row1 = Request.QueryString["show_row"];

        if (Session["showRegCourse" + row1] == null)
        {
            Response.Redirect("List_StudentRegis_SecAdvisor.aspx");
        }
        else
        {
            student_data = (Student)Session["showRegCourse" + row1];

            lblStudentName.Text = student_data.Student_ID + " " + student_data.First_ThaiName + " " + student_data.Family_ThaiName;

            if (!Page.IsPostBack)
            {
                Session.Remove("ApproveRegis");
            }

            try
            {
                string          Lecturer_ID  = (string)Session["Lecturer_ID"];
                GradAdvisorData advisor_data = new GradAdvisorData();
                advisor_data = new Student().getAdvisorCoAdvisor(student_data.Student_ID);

                if (advisor_data.Advisor_ID == null)
                {
                    lblAlertAdvisor.Text = "";
                    if (Session["ApproveRegis"] != null)
                    {
                        btnApprove.Enabled = true;
                    }
                    else
                    {
                        btnApprove.Enabled = false;
                    }
                }
                else if (advisor_data.Advisor_ID == "0")
                {
                    lblAlertAdvisor.Text = "";
                    if (Session["ApproveRegis"] != null)
                    {
                        btnApprove.Enabled = true;
                    }
                    else
                    {
                        btnApprove.Enabled = false;
                    }
                }
                else
                {
                    if (Lecturer_ID == advisor_data.Advisor_ID)
                    {
                        lblAlertAdvisor.Text = "";
                        if (Session["ApproveRegis"] != null)
                        {
                            btnApprove.Enabled = true;
                        }
                        else
                        {
                            btnApprove.Enabled = false;
                        }
                    }
                    else
                    {
                        lblAlertAdvisor.Text = "นักศึกษาได้แต่งตั้งอาจารย์ที่ปรึกษาแล้ว";
                        btnApprove.Enabled   = false;
                    }
                }


                LectuereInformationData lecturer_data = new LectuereInformationData();
                lecturer_data = new Lecturer().getLecturer(student_data.Advisor_ID);

                degree_char = student_data.Degree_Char;

                studentRegisData = new Student_Registration().getRegistration(academic_year, semester, student_data.Student_ID, degree_char);

                int        numrow = 1;
                CheckBox[] chk    = new CheckBox[studentRegisData.Count];
                txtCredit = new TextBox[studentRegisData.Count];
                int i = 0;

                // Head Table
                //string[] ar = { "ตอนที่", "รหัสวิชา", "ชื่อวิชา", "ผู้สอน", "ห้องเรียน", "เวลาเรียน", "สอบกลางภาค", "สอบปลายภาค", "อนุมัติ" };
                string[] ar  = { "ตอนที่", "รหัสวิชา", "ชื่อวิชา", "ผู้สอน", "ห้องเรียน", "เวลาเรียน", "ประเภทการลงทะเบียน", "สถานะการลงทะเบียน", "สถานะการชำระเงิน", "จำนวนหน่วยกิต", "อนุมัติ" };
                Table    tb1 = new Table();
                tb1.Attributes.Add("class", "table table-bordered table-hover table-striped");
                tb1.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];
                    cellHead.Attributes.Add("class", "text-align-center");
                    tRowHead.Cells.Add(cellHead);
                }

                tb1.Rows.Add(tRowHead);

                List <RegistrationData> ApproveRegisData = new List <RegistrationData>();
                if (Session["ApproveRegis"] != null)
                {
                    ApproveRegisData = (List <RegistrationData>)Session["ApproveRegis"];
                }

                foreach (RegistrationData data in studentRegisData)
                {
                    teachingData = new TeachingTable().getSubTeachingTable(academic_year, semester, data.Course_Code, data.Sec_No, data.SubSec_No, degree_char);

                    lec_table = degree_char;

                    // กรณีวิชาที่เพิ่มโดยอาจารย์ผู้สอน เป็นวิชาที่อยู่คนละระดับการศึกษา
                    if (teachingData.Count <= 0)
                    {
                        if (degree_char == "U" || degree_char == "B")
                        {
                            teachingData = new TeachingTable().getSubTeachingTable(academic_year, semester, data.Course_Code, data.Sec_No, data.SubSec_No, "M");
                            lec_table    = "M";
                        }
                        else
                        {
                            teachingData = new TeachingTable().getSubTeachingTable(academic_year, semester, data.Course_Code, data.Sec_No, data.SubSec_No, "B");
                            lec_table    = "B";
                        }
                    }
                    //=======================

                    CourseData course_reg = new CourseData();
                    course_reg = new Course().getCourse(data.Course_Code);

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

                    string course_type = "";
                    if (data.Course_Type == "1")
                    {
                        course_type = "S.";
                    }
                    else if (data.Course_Type == "2")
                    {
                        course_type = "L.";
                    }
                    else if (data.Course_Type == "4")
                    {
                        course_type = "T.";
                    }
                    else if (data.Course_Type == "5")
                    {
                        course_type = "M.";
                    }
                    else if (data.Course_Type == "6")
                    {
                        course_type = "SP.";
                    }
                    else if (data.Course_Type == "7")
                    {
                        course_type = "D.";
                    }

                    if (data.SubSec_No != 0)
                    {
                        course_type += data.SubSec_No;
                    }
                    else
                    {
                        course_type += data.Sec_No;
                    }

                    TableCell cellSec = new TableCell();
                    cellSec.Text = course_type;
                    cellSec.Attributes.Add("class", "text-align-center");
                    tRowBody.Cells.Add(cellSec);

                    TableCell cellCourseCode = new TableCell();
                    cellCourseCode.Text = course_reg.Course_Code;
                    cellCourseCode.Attributes.Add("class", "text-align-center");
                    tRowBody.Cells.Add(cellCourseCode);

                    TableCell cellCourse = new TableCell();
                    cellCourse.Text = course_reg.Course_Thainame;
                    tRowBody.Cells.Add(cellCourse);

                    TableCell cellLecturer = new TableCell();
                    string    lec_name     = "";
                    foreach (TeachingTableData teach in teachingData)
                    {
                        lecturerData = new LecturerTable().getLecturerTable(teach, lec_table);
                        foreach (LecturerTableData lec in lecturerData)
                        {
                            lec_name += new Lecturer().getLecturer(lec.Lecturer).Lecturer_ShortName + ",";
                        }

                        lec_name = lec_name.Substring(0, lec_name.Length - 1);

                        lec_name += "<br>";
                    }

                    cellLecturer.Text = lec_name;
                    tRowBody.Cells.Add(cellLecturer);
                    TableCell cellRoom = new TableCell();

                    foreach (TeachingTableData teach in teachingData)
                    {
                        cellRoom.Text += teach.Building_Code + "-" + teach.Room_Code;
                        if (teach.Campus_Code == "2")
                        {
                            cellRoom.Text += "*";
                        }
                        else if (teach.Campus_Code == "3")
                        {
                            cellRoom.Text += "**";
                        }

                        cellRoom.Text += "<br/>";
                    }
                    cellRoom.Attributes.Add("class", "text-align-center");

                    tRowBody.Cells.Add(cellRoom);

                    TableCell cellTeaching = new TableCell();
                    foreach (TeachingTableData teach in teachingData)
                    {
                        string day = "";

                        if (teach.Teaching_Day == "1")
                        {
                            day = "Mon";
                        }
                        else if (teach.Teaching_Day == "2")
                        {
                            day = "Tue";
                        }
                        if (teach.Teaching_Day == "3")
                        {
                            day = "Wed";
                        }
                        if (teach.Teaching_Day == "4")
                        {
                            day = "Thu";
                        }
                        if (teach.Teaching_Day == "5")
                        {
                            day = "Fri";
                        }
                        if (teach.Teaching_Day == "6")
                        {
                            day = "Sat";
                        }
                        if (teach.Teaching_Day == "7")
                        {
                            day = "Sun";
                        }

                        cellTeaching.Text += day + " " + teach.Teaching_Start_Time + " - " + teach.Teaching_End_Time + "<br>";
                        cellTeaching.Attributes.Add("class", "text-align-center");
                    }
                    tRowBody.Cells.Add(cellTeaching);

                    //TableCell cellMid = new TableCell();
                    //cellMid.Text = new utility().getThaiBirthDay(exam_data.ExamMid_Day) + " เวลา:" + exam_data.ExamMid_StartTime + "-" + exam_data.ExamMid_EndTime;
                    //tRowBody.Cells.Add(cellMid);

                    //TableCell cellFinal = new TableCell();
                    //cellFinal.Text = new utility().getThaiBirthDay(exam_data.ExamFinal_Day) + " เวลา:" + exam_data.ExamFinal_StartTime + "-" + exam_data.ExamFinal_EndTime;
                    //tRowBody.Cells.Add(cellFinal);

                    TableCell cellRegType = new TableCell();
                    cellRegType.Text = data.Reg_Type;
                    cellRegType.Attributes.Add("class", "text-align-center");
                    tRowBody.Cells.Add(cellRegType);

                    TableCell cellRegStatus = new TableCell();
                    cellRegStatus.Text = statusObj.getStatus(data.Status).Status_Thai;
                    cellRegStatus.Attributes.Add("class", "text-align-center");
                    tRowBody.Cells.Add(cellRegStatus);

                    TableCell cellPaymentStatus = new TableCell();
                    cellPaymentStatus.Text = statusObj.getStatus(new Student_Payment().getPaymentStatus(data.Payment_ID, degree_char)).Status_Thai;
                    cellPaymentStatus.Attributes.Add("class", "text-align-center");
                    tRowBody.Cells.Add(cellPaymentStatus);

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

                    if ((data.Course_Type == "4") || (data.Course_Type == "5") || (data.Course_Type == "7"))
                    {
                        txtCredit[i]           = new TextBox();
                        txtCredit[i].ID        = "credit" + numrow.ToString();
                        txtCredit[i].MaxLength = 2;
                        txtCredit[i].Width     = 30;
                        txtCredit[i].Attributes.Add("class", "text-center");
                        txtCredit[i].Text = data.Credit.ToString();
                        if (data.Approve_Status == "y")
                        {
                            txtCredit[i].ReadOnly  = true;
                            txtCredit[i].BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
                        }
                        else
                        {
                            txtCredit[i].ReadOnly     = false;
                            txtCredit[i].AutoPostBack = true;
                            txtCredit[i].TextChanged += new EventHandler(txtCredit_TextChanged);
                        }
                        cellCredit.Controls.Add(txtCredit[i]);
                    }
                    else
                    {
                        cellCredit.Text = data.Credit.ToString();
                    }
                    tRowBody.Cells.Add(cellCredit);

                    TableCell cellchkApprove = new TableCell();

                    if (data.Approve_Status == "n")
                    {
                        chk[i] = new CheckBox();
                        chk[i].AutoPostBack = true;
                        chk[i].ID           = "approve" + numrow.ToString();

                        foreach (RegistrationData chkdata in ApproveRegisData)
                        {
                            if (data.Academic_Year == chkdata.Academic_Year && data.Semester == chkdata.Semester && data.Course_Code == chkdata.Course_Code && data.Sec_No == chkdata.Sec_No && data.SubSec_No == chkdata.SubSec_No)
                            {
                                chk[i].Checked = true;
                            }
                        }

                        chk[i].CheckedChanged += new EventHandler(chkApprove_CheckedChanged);
                        cellchkApprove.Controls.Add(chk[i]);
                        cellchkApprove.Attributes.Add("class", "text-align-center");
                    }
                    else
                    {
                        if (data.Approve_Status == "y")
                        {
                            cellchkApprove.Text = "อนุมัติ";
                            cellchkApprove.Attributes.Add("class", "txt-green-bold text-align-center");
                        }
                    }


                    tRowBody.Cells.Add(cellchkApprove);

                    numrow++;
                    i++;

                    tb1.Rows.Add(tRowBody);
                }



                TableRow  row  = new TableRow();
                TableCell cell = new TableCell();
                cell.Controls.Add(tb1);
                row.Cells.Add(cell);
                tblStudentAdvisor.Rows.Add(row);
            }
            catch (Exception err)
            {
                HttpContext.Current.Session["response"] = "ไม่สามารถดำเนินการได้" + err.ToString();
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
    protected void btnSHOW_Click(object sender, EventArgs e)
    {
        if (ddlADVISOR.SelectedValue == "00")
        {
            divShow.Visible = false;
            MsgValidate("โปรดระบุ อาจารย์");
        }
        else
        {
            divShow.Visible = true;
            divFail.Visible = false;


            // Head Table
            string[] ar = { "ตอนที่", "รหัสวิชา", "ชื่อวิชา", "ห้องเรียน", "เวลาเรียน", "ผู้สอน", "ข้อมูลนักศึกษา" };
            tblCourseList.Attributes.Add("class", "table table-bordered table-hover table-striped");
            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];
                cellHead.Attributes.Add("class", "text-center");
                tRowHead.Cells.Add(cellHead);
            }

            tblCourseList.Rows.Add(tRowHead);


            int show_row = 0;
            List <LecturerTableData> lecturerData = new List <LecturerTableData>();

            lecturerData = new LecturerTable().getAllDegreeLecturerTable(config_data.AcademicYear, config_data.Semester, ddlADVISOR.SelectedValue);

            foreach (LecturerTableData data in lecturerData)
            {
                Session["showCourse" + show_row] = data;

                TableRow tRowBody;


                if ((prev_course == "") || (prev_course != data.Course_Code) || (prev_sec != data.Sec_No) || (prev_subsec != data.SubSec_No))
                {
                    tRowBody = new TableRow();
                    tRowBody.TableSection = TableRowSection.TableBody;

                    string course_type = "";
                    string course_sec  = "";

                    if (data.Course_Type == "1")
                    {
                        course_type = "S.";
                    }
                    else if (data.Course_Type == "2")
                    {
                        course_type = "L.";
                    }
                    else if (data.Course_Type == "4")
                    {
                        course_type = "T.";
                    }
                    else if (data.Course_Type == "5")
                    {
                        course_type = "M.";
                    }
                    else if (data.Course_Type == "6")
                    {
                        course_type = "SP.";
                    }
                    else if (data.Course_Type == "7")
                    {
                        course_type = "D.";
                    }

                    if (data.SubSec_No != 0)
                    {
                        course_sec = data.SubSec_No.ToString();
                    }
                    else
                    {
                        course_sec = data.Sec_No.ToString();
                    }



                    TableCell cellSec = new TableCell();
                    cellSec.Text = course_type + course_sec;
                    cellSec.Attributes.Add("class", "text-center");
                    tRowBody.Cells.Add(cellSec);

                    TableCell cellCourseCode = new TableCell();
                    cellCourseCode.Text = data.Course_Code;
                    cellCourseCode.Attributes.Add("class", "text-center");
                    tRowBody.Cells.Add(cellCourseCode);

                    TableCell cellCourseName = new TableCell();
                    cellCourseName.Text = new Course().getCourse(data.Course_Code).Course_Thainame;
                    tRowBody.Cells.Add(cellCourseName);


                    string building_room = data.Building_Code;

                    if (data.Room_Code == "0")     // ไม่ระบุห้องเรียน
                    {
                        building_room += "-ไม่ระบุ";
                    }
                    else
                    {
                        building_room += "-" + data.Room_Code;
                    }

                    if (data.Campus_Code == "2")
                    {
                        building_room += "*";
                    }
                    else if (data.Campus_Code == "3")
                    {
                        building_room += "**";
                    }

                    TableCell cellRoom = new TableCell();
                    cellRoom.Text = building_room;
                    cellRoom.Attributes.Add("class", "text-center");
                    tRowBody.Cells.Add(cellRoom);

                    string day = "";

                    if (data.Teaching_Day == "1")
                    {
                        day = "Mon";
                    }
                    else if (data.Teaching_Day == "2")
                    {
                        day = "Tue";
                    }
                    if (data.Teaching_Day == "3")
                    {
                        day = "Wed";
                    }
                    if (data.Teaching_Day == "4")
                    {
                        day = "Thu";
                    }
                    if (data.Teaching_Day == "5")
                    {
                        day = "Fri";
                    }
                    if (data.Teaching_Day == "6")
                    {
                        day = "Sat";
                    }
                    if (data.Teaching_Day == "7")
                    {
                        day = "Sun";
                    }

                    string teach_time = data.Teaching_Start_Time + " - " + data.Teaching_End_Time;

                    TableCell cellTime = new TableCell();
                    cellTime.Text = day + " " + teach_time;
                    cellTime.Attributes.Add("class", "text-center");
                    tRowBody.Cells.Add(cellTime);

                    string lec_all = "";
                    List <LecturerTableData> allLecturerData = new List <LecturerTableData>();
                    allLecturerData = new LecturerTable().getAllLecturerSecCourse(config_data.AcademicYear, config_data.Semester, data.Course_Code, data.Sec_No, data.SubSec_No, data.Teaching_Day, data.Teaching_Start_Time, data.Teaching_End_Time);
                    foreach (LecturerTableData lect in allLecturerData)
                    {
                        LectuereInformationData lecturer_data = new LectuereInformationData();
                        lecturer_data = lecturerObj.getLecturer(lect.Lecturer);

                        lec_all += lecturer_data.Lecturer_ShortName + " " + lecturer_data.Title_ThaiName + " " + lecturer_data.First_ThaiName + " " + lecturer_data.Family_ThaiName + "<br>";
                    }

                    TableCell cellLectuere = new TableCell();
                    cellLectuere.Text = lec_all;
                    //cellLectuere.Attributes.Add("class", "text-center");
                    tRowBody.Cells.Add(cellLectuere);

                    TableCell cellView = new TableCell();
                    string    urlView  = "List_Course_Student.aspx?show_row=" + show_row.ToString();
                    HyperLink hypView  = new HyperLink();
                    hypView.Attributes.Add("target", "_blank");
                    // hypView.Attributes.Add("data-target", "#View_Segment_Adivisor");
                    // hypView.Attributes.Add("data-toggle", "modal");
                    hypView.Attributes.Add("class", "text-center");
                    hypView.Text        = "<h4><i class='fa fa-search'></i></h4>";
                    hypView.NavigateUrl = urlView;
                    hypView.ToolTip     = "ดูข้อมูล";
                    cellView.Controls.Add(hypView);
                    tRowBody.Cells.Add(cellView);

                    tblCourseList.Rows.Add(tRowBody);

                    show_row++;

                    prev_course = data.Course_Code;
                    prev_sec    = data.Sec_No;
                    prev_subsec = data.SubSec_No;
                }
                else
                {
                    tRowBody = tblCourseList.Rows[show_row];


                    string building_room = data.Building_Code;

                    if (data.Room_Code == "0")     // ไม่ระบุห้องเรียน
                    {
                        building_room += "-ไม่ระบุ";
                    }
                    else
                    {
                        building_room += "-" + data.Room_Code;
                    }

                    if (data.Campus_Code == "2")
                    {
                        building_room += "*";
                    }
                    else if (data.Campus_Code == "3")
                    {
                        building_room += "**";
                    }
                    tRowBody.Cells[3].Text += "<br><br>" + building_room;

                    string day = "";

                    if (data.Teaching_Day == "1")
                    {
                        day = "Mon";
                    }
                    else if (data.Teaching_Day == "2")
                    {
                        day = "Tue";
                    }
                    if (data.Teaching_Day == "3")
                    {
                        day = "Wed";
                    }
                    if (data.Teaching_Day == "4")
                    {
                        day = "Thu";
                    }
                    if (data.Teaching_Day == "5")
                    {
                        day = "Fri";
                    }
                    if (data.Teaching_Day == "6")
                    {
                        day = "Sat";
                    }
                    if (data.Teaching_Day == "7")
                    {
                        day = "Sun";
                    }

                    string teach_time = data.Teaching_Start_Time + " - " + data.Teaching_End_Time;
                    tRowBody.Cells[4].Text += "<br><br>" + day + " " + teach_time;


                    string lec_all = "";
                    List <LecturerTableData> allLecturerData = new List <LecturerTableData>();
                    allLecturerData = new LecturerTable().getAllLecturerSecCourse(config_data.AcademicYear, config_data.Semester, data.Course_Code, data.Sec_No, data.SubSec_No, data.Teaching_Day, data.Teaching_Start_Time, data.Teaching_End_Time);
                    foreach (LecturerTableData lect in allLecturerData)
                    {
                        LectuereInformationData lecturer_data = new LectuereInformationData();
                        lecturer_data = lecturerObj.getLecturer(lect.Lecturer);

                        lec_all += lecturer_data.Lecturer_ShortName + " " + lecturer_data.Title_ThaiName + " " + lecturer_data.First_ThaiName + " " + lecturer_data.Family_ThaiName + "<br>";
                    }

                    tRowBody.Cells[5].Text += "<br>" + lec_all;
                }
            }
        }
    }
Esempio n. 9
0
    protected void btnSHOW_Click(object sender, EventArgs e)
    {
        if (ddlCURRICULUM.SelectedValue == "0")
        {
            divShow.Visible = false;
            MsgValidate("โปรดระบุ หลักสูตร");
        }
        else if (ddlADVISOR.SelectedValue == "00")
        {
            divShow.Visible = false;
            MsgValidate("กรุณาระบุ อาจารย์ที่ปรึกษาหลัก/ร่วม");
        }
        else
        {
            divShow.Visible = true;
            divFail.Visible = false;

            string degree_admission = "";

            if (ddlDEGREE.SelectedValue == "M")
            {
                degree_admission = "8";
            }
            else if (ddlDEGREE.SelectedValue == "D")
            {
                degree_admission = "9";
            }
            else if (ddlDEGREE.SelectedValue == "P")
            {
                degree_admission = "7";
            }
            else
            {
                degree_admission = "6";
            }

            //Advisor&Co-Advisor
            List <GradAdvisorCoAdvisorData> advisor_coadvisor_data = new List <GradAdvisorCoAdvisorData>();
            List <GradAdvisorData>          advisor_data           = new List <GradAdvisorData>();
            List <GradAdvisorData>          coadvisor_data         = new List <GradAdvisorData>();

            if (ddlADVISOR.SelectedValue == "xx")
            {
                advisor_data   = new Student().getStudentGradAdvisor();
                coadvisor_data = new Student().getStudentGradCoAdvisor();

                foreach (GradAdvisorData data in coadvisor_data)
                {
                    if (data.CoAdvisor_ID1 != null && data.CoAdvisor_ID1 != "0")
                    {
                        if (new Lecturer().getLecturer(data.CoAdvisor_ID1).Faculty_Code == ddlFACULTY.SelectedValue)
                        {
                            GradAdvisorCoAdvisorData advisor_coadvisor = new GradAdvisorCoAdvisorData();
                            advisor_coadvisor.lectuere_id  = data.CoAdvisor_ID1;
                            advisor_coadvisor.student_id   = data.Student_ID;
                            advisor_coadvisor.advisor_type = "co";
                            advisor_coadvisor_data.Add(advisor_coadvisor);
                        }
                    }
                    if (data.CoAdvisor_ID2 != null && data.CoAdvisor_ID2 != "0")
                    {
                        if (new Lecturer().getLecturer(data.CoAdvisor_ID2).Faculty_Code == ddlFACULTY.SelectedValue)
                        {
                            GradAdvisorCoAdvisorData advisor_coadvisor = new GradAdvisorCoAdvisorData();
                            advisor_coadvisor.lectuere_id  = data.CoAdvisor_ID2;
                            advisor_coadvisor.student_id   = data.Student_ID;
                            advisor_coadvisor.advisor_type = "co";
                            advisor_coadvisor_data.Add(advisor_coadvisor);
                        }
                    }
                    if (data.CoAdvisor_ID3 != null && data.CoAdvisor_ID3 != "0")
                    {
                        if (new Lecturer().getLecturer(data.CoAdvisor_ID3).Faculty_Code == ddlFACULTY.SelectedValue)
                        {
                            GradAdvisorCoAdvisorData advisor_coadvisor = new GradAdvisorCoAdvisorData();
                            advisor_coadvisor.lectuere_id  = data.CoAdvisor_ID3;
                            advisor_coadvisor.student_id   = data.Student_ID;
                            advisor_coadvisor.advisor_type = "co";
                            advisor_coadvisor_data.Add(advisor_coadvisor);
                        }
                    }
                    if (data.CoAdvisor_ID4 != null && data.CoAdvisor_ID4 != "0")
                    {
                        if (new Lecturer().getLecturer(data.CoAdvisor_ID4).Faculty_Code == ddlFACULTY.SelectedValue)
                        {
                            GradAdvisorCoAdvisorData advisor_coadvisor = new GradAdvisorCoAdvisorData();
                            advisor_coadvisor.lectuere_id  = data.CoAdvisor_ID4;
                            advisor_coadvisor.student_id   = data.Student_ID;
                            advisor_coadvisor.advisor_type = "co";
                            advisor_coadvisor_data.Add(advisor_coadvisor);
                        }
                    }
                    if (data.CoAdvisor_ID5 != null && data.CoAdvisor_ID5 != "0")
                    {
                        if (new Lecturer().getLecturer(data.CoAdvisor_ID5).Faculty_Code == ddlFACULTY.SelectedValue)
                        {
                            GradAdvisorCoAdvisorData advisor_coadvisor = new GradAdvisorCoAdvisorData();
                            advisor_coadvisor.lectuere_id  = data.CoAdvisor_ID5;
                            advisor_coadvisor.student_id   = data.Student_ID;
                            advisor_coadvisor.advisor_type = "co";
                            advisor_coadvisor_data.Add(advisor_coadvisor);
                        }
                    }
                }

                foreach (GradAdvisorData data in advisor_data)
                {
                    if (new Lecturer().getLecturer(data.Advisor_ID).Faculty_Code == ddlFACULTY.SelectedValue)
                    {
                        GradAdvisorCoAdvisorData advisor_coadvisor = new GradAdvisorCoAdvisorData();
                        advisor_coadvisor.lectuere_id  = data.Advisor_ID;
                        advisor_coadvisor.student_id   = data.Student_ID;
                        advisor_coadvisor.advisor_type = "main";
                        advisor_coadvisor_data.Add(advisor_coadvisor);
                    }
                }
            }
            else
            {
                advisor_data   = new Student().getStudentGradAdvisor(ddlADVISOR.SelectedValue);
                coadvisor_data = new Student().getStudentGradCoAdvisor(ddlADVISOR.SelectedValue);

                foreach (GradAdvisorData data in coadvisor_data)
                {
                    GradAdvisorCoAdvisorData advisor_coadvisor = new GradAdvisorCoAdvisorData();

                    if (data.CoAdvisor_ID1 == ddlADVISOR.SelectedValue)
                    {
                        advisor_coadvisor.lectuere_id  = data.CoAdvisor_ID1;
                        advisor_coadvisor.student_id   = data.Student_ID;
                        advisor_coadvisor.advisor_type = "co";
                        advisor_coadvisor_data.Add(advisor_coadvisor);
                    }
                    else if (data.CoAdvisor_ID2 == ddlADVISOR.SelectedValue)
                    {
                        advisor_coadvisor.lectuere_id  = data.CoAdvisor_ID2;
                        advisor_coadvisor.student_id   = data.Student_ID;
                        advisor_coadvisor.advisor_type = "co";
                        advisor_coadvisor_data.Add(advisor_coadvisor);
                    }
                    else if (data.CoAdvisor_ID3 == ddlADVISOR.SelectedValue)
                    {
                        advisor_coadvisor.lectuere_id  = data.CoAdvisor_ID3;
                        advisor_coadvisor.student_id   = data.Student_ID;
                        advisor_coadvisor.advisor_type = "co";
                        advisor_coadvisor_data.Add(advisor_coadvisor);
                    }
                    else if (data.CoAdvisor_ID4 == ddlADVISOR.SelectedValue)
                    {
                        advisor_coadvisor.lectuere_id  = data.CoAdvisor_ID4;
                        advisor_coadvisor.student_id   = data.Student_ID;
                        advisor_coadvisor.advisor_type = "co";
                        advisor_coadvisor_data.Add(advisor_coadvisor);
                    }
                    else if (data.CoAdvisor_ID5 == ddlADVISOR.SelectedValue)
                    {
                        advisor_coadvisor.lectuere_id  = data.CoAdvisor_ID5;
                        advisor_coadvisor.student_id   = data.Student_ID;
                        advisor_coadvisor.advisor_type = "co";
                        advisor_coadvisor_data.Add(advisor_coadvisor);
                    }
                }

                foreach (GradAdvisorData data in advisor_data)
                {
                    GradAdvisorCoAdvisorData advisor_coadvisor = new GradAdvisorCoAdvisorData();
                    advisor_coadvisor.lectuere_id  = data.Advisor_ID;
                    advisor_coadvisor.student_id   = data.Student_ID;
                    advisor_coadvisor.advisor_type = "main";
                    advisor_coadvisor_data.Add(advisor_coadvisor);
                }
            }



            advisor_coadvisor_data.Sort(delegate(GradAdvisorCoAdvisorData advisor1, GradAdvisorCoAdvisorData advisor2) { return(advisor1.lectuere_id.CompareTo(advisor2.lectuere_id)); });
            var result = advisor_coadvisor_data.GroupBy(a => a.lectuere_id);
            int count  = 0;
            int i      = 0;
            foreach (var r in result)
            {
                count++;
            }

            Table[]          tb1      = new Table[count];
            TableHeaderRow[] tRowHead = new TableHeaderRow[count];



            foreach (var r in result)
            {
                // Head Table
                //string[] ar = { "รหัสนักศึกษา", "ชื่อ-นามสกุล", "คณะ", "หลักสูตร", "สถานะอาจารย์", "แก้ไข" };
                List <string> ar = new List <string>(new string[] { "รหัสนักศึกษา", "ชื่อ-นามสกุล", "คณะ", "หลักสูตร", "สถานะอาจารย์", "แก้ไข" });



                tb1[i] = new Table();
                tb1[i].Attributes.Add("class", "table table-bordered table-hover table-striped");
                tb1[i].Attributes.Add("id", "dt_basic" + i);

                tRowHead[i] = new TableHeaderRow();
                tRowHead[i].TableSection = TableRowSection.TableHeader;

                for (int cellCtr = 1; cellCtr <= ar.Count; cellCtr++)
                {
                    // Create a new cell and add it to the row.
                    TableHeaderCell cellHead = new TableHeaderCell();
                    cellHead.Text = ar[cellCtr - 1];
                    cellHead.Attributes.Add("class", "text-align-center");
                    tRowHead[i].Cells.Add(cellHead);
                }

                tb1[i].Rows.Add(tRowHead[i]);

                string Lectuere_Name = "";

                foreach (GradAdvisorCoAdvisorData data in advisor_coadvisor_data)
                {
                    if (data.lectuere_id == r.Key)
                    {
                        Lecturer_data = new Lecturer().getLecturer(data.lectuere_id);
                        Lectuere_Name = Lecturer_data.Lecturer_ShortName + " " + Lecturer_data.First_ThaiName + " " + Lecturer_data.Family_ThaiName;

                        string sql = "";

                        if (degree_admission == "6")
                        {
                            // sql = "Select * From Student std, STUDENT_INFORMATION std_info, STUDENT_PARENT std_parent Where std.STUDENT_ID='" + data.student_id + "' And std_info.STUDENT_ID = '" + data.student_id + "' And std_parent.STUDENT_ID='" + data.student_id + "' And std.FACULTY_CODE='" + ddlFACULTY.SelectedValue + "' And std.DEPARTMENT_CODE='" + ddlDepartment.SelectedValue + "'";
                            sql = "Select * From Student std, STUDENT_INFORMATION std_info, STUDENT_PARENT std_parent Where std.STUDENT_ID='" + data.student_id + "' And std_info.STUDENT_ID = '" + data.student_id + "' And std_parent.STUDENT_ID='" + data.student_id + "'";
                        }
                        else
                        {
                            //sql = "Select * From Grad_Student std, Grad_STUDENT_INFORMATION std_info, Grad_STUDENT_PARENT std_parent Where std.STUDENT_ID='" + data.student_id + "' And std_info.STUDENT_ID = '" + data.student_id + "' And std_parent.STUDENT_ID='" + data.student_id + "' And std.FACULTY_CODE='" + ddlFACULTY.SelectedValue + "' And std.DEPARTMENT_CODE='" + ddlDepartment.SelectedValue + "'";
                            sql = "Select * From Grad_Student std, Grad_STUDENT_INFORMATION std_info, Grad_STUDENT_PARENT std_parent Where std.STUDENT_ID='" + data.student_id + "' And std_info.STUDENT_ID = '" + data.student_id + "' And std_parent.STUDENT_ID='" + data.student_id + "'";
                        }


                        if (ddlDEGREE.SelectedValue != "x")
                        {
                            sql += " And std.DEGREE_ADMISSION_CODE = '" + degree_admission + "' ";
                        }

                        if (ddlCURRICULUM.SelectedValue != "x")
                        {
                            sql += " And std.CURRI_CODE = '" + ddlCURRICULUM.SelectedValue + "' ";
                        }


                        Student student_data = new Student();
                        student_data = new Student().getManualOneStudent(sql);

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

                        if (student_data.Student_ID != null)
                        {
                            TableCell cellStudentID = new TableCell();
                            cellStudentID.Text = student_data.Student_ID;
                            cellStudentID.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellStudentID);

                            TableCell cellName = new TableCell();
                            cellName.Text = student_data.First_ThaiName + " " + student_data.Family_ThaiName;
                            cellName.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellName);

                            TableCell cellFaculty = new TableCell();
                            cellFaculty.Text = student_data.FacultyThai;
                            cellFaculty.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellFaculty);

                            TableCell cellCurr = new TableCell();
                            cellCurr.Text = student_data.CurrThai;
                            tRowBody.Cells.Add(cellCurr);

                            TableCell cellAdvisor = new TableCell();
                            if (data.advisor_type == "main")
                            {
                                cellAdvisor.Text = "ที่ปรึกษาหลัก";
                            }
                            else
                            {
                                cellAdvisor.Text = "ที่ปรึกษาร่วม";
                            }

                            cellAdvisor.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellAdvisor);


                            TableCell cellEdit = new TableCell();
                            HyperLink hypEdit  = new HyperLink();

                            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 == student_data.Faculty_Code)
                                    {
                                        editable = true;
                                        break;
                                    }
                                }

                                if (editable == true)
                                {
                                    string urlEdit = "Edit_Grad_Advisor.aspx?student_id=" + student_data.Student_ID + "&degree=" + student_data.Degree_Char;
                                    hypEdit.Attributes.Add("class", "text-center");
                                    hypEdit.Text        = "<h4><i class='fa fa-edit'></i></h4>";
                                    hypEdit.NavigateUrl = urlEdit;
                                    hypEdit.ToolTip     = "แก้ไข";
                                    cellEdit.Controls.Add(hypEdit);
                                    tRowBody.Cells.Add(cellEdit);
                                }
                                else
                                {
                                    string urlEdit = "#";
                                    hypEdit.Attributes.Add("class", "text-center");
                                    hypEdit.Text        = "<h4><i class=\"fa fa-lock\"></i></h4>";
                                    hypEdit.NavigateUrl = urlEdit;
                                    hypEdit.ToolTip     = "ไม่สามารถแก้ไขข้อมูลนักศึกษาต่างคณะได้";
                                    cellEdit.Controls.Add(hypEdit);
                                    tRowBody.Cells.Add(cellEdit);
                                }
                            }
                            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 == student_data.Department_Code)
                                    {
                                        editable = true;
                                        break;
                                    }
                                }

                                if (editable == true)
                                {
                                    string urlEdit = "Edit_Grad_Advisor.aspx?student_id=" + student_data.Student_ID + "&degree=" + student_data.Degree_Char;
                                    hypEdit.Attributes.Add("class", "text-center");
                                    hypEdit.Text        = "<h4><i class='fa fa-edit'></i></h4>";
                                    hypEdit.NavigateUrl = urlEdit;
                                    hypEdit.ToolTip     = "แก้ไข";
                                    cellEdit.Controls.Add(hypEdit);
                                    tRowBody.Cells.Add(cellEdit);
                                }
                                else
                                {
                                    string urlEdit = "#";
                                    hypEdit.Attributes.Add("class", "text-center");
                                    hypEdit.Text        = "<h4><i class=\"fa fa-lock\"></i></h4>";
                                    hypEdit.NavigateUrl = urlEdit;
                                    hypEdit.ToolTip     = "ไม่สามารถแก้ไขข้อมูลนักศึกษาต่างภาควิชาได้";
                                    cellEdit.Controls.Add(hypEdit);
                                    tRowBody.Cells.Add(cellEdit);
                                }
                            }
                            else
                            {
                                string urlEdit = "#";
                                hypEdit.Attributes.Add("class", "text-center");
                                hypEdit.Text        = "<h4><i class=\"fa fa-lock\"></i></h4>";
                                hypEdit.NavigateUrl = urlEdit;
                                hypEdit.ToolTip     = "ไม่พบสิทธิ์การแก้ไขข้อมูล";
                                cellEdit.Controls.Add(hypEdit);
                                tRowBody.Cells.Add(cellEdit);
                            }

                            tb1[i].Rows.Add(tRowBody);
                        }
                    }
                }

                string table_struct = "<div class='jarviswidget jarviswidget-color-primary' data-widget-editbutton='false' data-widget-custombutton='false' data-widget-deletebutton='false' data-widget-fullscreenbutton='false'><header><span class='widget-icon'><i class='fa fa-table'></i></span><h2>" + Lectuere_Name + "</h2></header><div>";
                table_struct += "<div class='widget-body no-padding'><div class='widget-body-toolbar'></div>";
                LiteralControl div_row = new LiteralControl(table_struct);

                panelStudentAdvisor.Controls.Add(div_row);
                panelStudentAdvisor.Controls.Add(tb1[i]);
                LiteralControl div_row2 = new LiteralControl("</div></div></div>");

                panelStudentAdvisor.Controls.Add(div_row2);

                i++;
            }

            if (count == 0)
            {
                string table_struct = "<div class='jarviswidget jarviswidget-color-primary' data-widget-editbutton='false' data-widget-custombutton='false' data-widget-deletebutton='false' data-widget-fullscreenbutton='false'><header><span class='widget-icon'><i class='fa fa-table'></i></span><h2>ไม่พบข้อมูล</h2></header><div>";
                table_struct += "<div class='widget-body no-padding'><div class='widget-body-toolbar'></div>";
                table_struct += "</div></div></div>";
                LiteralControl div_row = new LiteralControl(table_struct);
                panelStudentAdvisor.Controls.Add(div_row);
            }
        }
    }
Esempio n. 10
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.lecturer))
            {
                // ======== Process ===========
                config_data   = new SystemConfig().getConfig();
                academic_year = config_data.AcademicYear;
                semester      = config_data.Semester;

                row1 = Request.QueryString["show_row"];


                if (Session["showCourse" + row1] == null)
                {
                    Response.Redirect("List_Course_Lecturer.aspx");
                }
                else
                {
                    LecturerTableData lectuere_data = new LecturerTableData();

                    lnkADD.NavigateUrl = "Extend_Student.aspx?show_row=" + row1;

                    lectuere_data = (LecturerTableData)Session["showCourse" + row1];

                    Session["Extend_Data"] = lectuere_data;

                    lec_info    = new Lecturer().getLecturer(lectuere_data.Lecturer);
                    course_info = new Course().getCourse(lectuere_data.Course_Code);


                    string course_type = "";
                    string course_sec  = "";

                    if (lectuere_data.Course_Type == "1")
                    {
                        course_type = "S.";
                    }
                    else if (lectuere_data.Course_Type == "2")
                    {
                        course_type = "L.";
                    }
                    else if (lectuere_data.Course_Type == "4")
                    {
                        course_type = "T.";
                    }
                    else if (lectuere_data.Course_Type == "5")
                    {
                        course_type = "M.";
                    }
                    else if (lectuere_data.Course_Type == "6")
                    {
                        course_type = "SP.";
                    }
                    else if (lectuere_data.Course_Type == "7")
                    {
                        course_type = "D.";
                    }

                    if (lectuere_data.SubSec_No != 0)
                    {
                        course_sec = lectuere_data.SubSec_No.ToString();
                    }
                    else
                    {
                        course_sec = lectuere_data.Sec_No.ToString();
                    }

                    lblLec.Text = lec_info.Lecturer_ShortName + " " + lec_info.First_ThaiName + " " + lec_info.Family_ThaiName;

                    lblHeader.Text = course_type + course_sec + " " + course_info.Course_Code + " " + course_info.Course_Thainame + " " + course_info.Course_Engname;

                    if (!Page.IsPostBack)
                    {
                        // Session.Remove("ApproveRegis");
                    }

                    try
                    {
                        List <RegistrationData> temp1 = new Student_Registration().getStudentRegistration(academic_year, semester, lectuere_data.Course_Code, lectuere_data.Sec_No, lectuere_data.SubSec_No);
                        // List<RegistrationData> temp2 = new Student_Registration().getStudentRegistration(academic_year, semester, lectuere_data.Course_Code, lectuere_data.Sec_No, lectuere_data.SubSec_No, "M");

                        foreach (RegistrationData reg in temp1)
                        {
                            studentRegisData.Add(reg);
                        }

                        //foreach (RegistrationData reg in temp2)
                        //{
                        //    studentRegisData.Add(reg);
                        //}

                        studentExtendData = new ExtendAvailableStudent().getExtendStudent(academic_year, semester, lectuere_data.Course_Code, lectuere_data.Sec_No, lectuere_data.SubSec_No);

                        int numrow  = 1;
                        int numrow2 = 1;

                        string[] ar  = { "ลำดับที่", "รหัสนักศึกษา", "ชื่อ-นามสกุล", "คณะ", "หลักสูตร", "ประเภท", "รอบ", "ห้อง", "อาจารย์ที่ปรึกษา อนุมัติ" };
                        string[] ar2 = { "ลำดับที่", "รหัสนักศึกษา", "ชื่อ-นามสกุล", "คณะ", "หลักสูตร", "ประเภท", "รอบ", "ห้อง", "อาจารย์ผู้ดำเนินการ", "ยกเลิก" };
                        Table    tb1 = new Table();
                        Table    tb2 = new Table();

                        tb1.Attributes.Add("class", "table table-bordered table-hover table-striped");
                        tb1.Attributes.Add("id", "dt_basic");
                        tb2.Attributes.Add("class", "table table-bordered table-hover table-striped");
                        tb2.Attributes.Add("id", "dt_basic");

                        TableHeaderRow tRowHead = new TableHeaderRow();
                        tRowHead.TableSection = TableRowSection.TableHeader;
                        TableHeaderRow tRowHead2 = new TableHeaderRow();
                        tRowHead2.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];
                            cellHead.Attributes.Add("class", "text-align-center");
                            tRowHead.Cells.Add(cellHead);
                        }
                        tb1.Rows.Add(tRowHead);

                        for (int cellCtr = 1; cellCtr <= ar2.Length; cellCtr++)
                        {
                            // Create a new cell and add it to the row.
                            TableHeaderCell cellHead = new TableHeaderCell();
                            cellHead.Text = ar2[cellCtr - 1];
                            cellHead.Attributes.Add("class", "text-align-center");
                            tRowHead2.Cells.Add(cellHead);
                        }
                        tb2.Rows.Add(tRowHead2);


                        foreach (RegistrationData data in studentRegisData)
                        {
                            TableRow tRowBody = new TableRow();
                            tRowBody.TableSection = TableRowSection.TableBody;

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

                            TableCell cellStudent_ID = new TableCell();
                            cellStudent_ID.Text = data.Student_ID;
                            cellStudent_ID.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellStudent_ID);

                            TableCell cellStudent_Name = new TableCell();
                            cellStudent_Name.Text = data.First_Thainame + " " + data.Family_Thainame;
                            cellStudent_Name.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellStudent_Name);

                            TableCell cellFaculty = new TableCell();
                            cellFaculty.Text = new Faculty().getFaculty(data.Faculty_Code).Faculty_Thai;
                            cellFaculty.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellFaculty);

                            TableCell cellCurri = new TableCell();
                            cellCurri.Text = data.Curr_Code.Substring(4) + " " + new Curriculum().getCurriculum(data.Curr_Code).Curr_ThaiName;
                            //cellCurri.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellCurri);

                            Student student_data = new Student();
                            student_data = new Student().getStudent(data.Student_ID, new Curriculum().getCurriculum(data.Curr_Code).Degree_Char);

                            TableCell cellCategory = new TableCell();
                            cellCategory.Text = student_data.StdCategoryThai;
                            cellCategory.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellCategory);

                            TableCell cellSection = new TableCell();
                            cellSection.Text = student_data.SectionThai;
                            cellSection.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellSection);

                            TableCell cellGroup = new TableCell();
                            cellGroup.Text = student_data.StdGroupName;
                            cellGroup.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellGroup);

                            TableCell cellApprove = new TableCell();
                            if (data.Approve_Status == "y")
                            {
                                cellApprove.Text = "อนุมัติ";
                                cellApprove.Attributes.Add("class", "txt-green-bold text-align-center");
                            }
                            else
                            {
                                cellApprove.Text = "รออนุมัติ";
                                cellApprove.Attributes.Add("class", "txt-red text-align-center");
                            }


                            tRowBody.Cells.Add(cellApprove);

                            tb1.Rows.Add(tRowBody);

                            numrow++;
                        }


                        TableRow  row  = new TableRow();
                        TableCell cell = new TableCell();
                        cell.Controls.Add(tb1);
                        row.Cells.Add(cell);
                        tblStudentAdvisor.Rows.Add(row);


                        foreach (ExtendAvailableStudentData data in studentExtendData)
                        {
                            Student student_data = new Student();
                            student_data = new Student().getStudent(data.Student_ID, new DegreeAdmission().getDegreeAdmissionChar(utlObj.getFactorFromStudentID(data.Student_ID, utlObj.stdID_Factor_DegreeAdmission)));

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

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

                            TableCell cellStudent_ID = new TableCell();
                            cellStudent_ID.Text = data.Student_ID;
                            cellStudent_ID.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellStudent_ID);

                            TableCell cellStudent_Name = new TableCell();
                            cellStudent_Name.Text = student_data.First_ThaiName + " " + student_data.Family_ThaiName;
                            cellStudent_Name.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellStudent_Name);

                            TableCell cellFaculty = new TableCell();
                            cellFaculty.Text = student_data.FacultyThai;
                            cellFaculty.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellFaculty);

                            TableCell cellCurri = new TableCell();
                            cellCurri.Text = student_data.Curri_Code.Substring(4) + " " + student_data.CurrThai;
                            //cellCurri.Text = "-";
                            tRowBody.Cells.Add(cellCurri);

                            TableCell cellCategory = new TableCell();
                            cellCategory.Text = student_data.StdCategoryThai;
                            cellCategory.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellCategory);

                            TableCell cellSection = new TableCell();
                            cellSection.Text = student_data.SectionThai;
                            cellSection.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellSection);

                            TableCell cellGroup = new TableCell();
                            cellGroup.Text = student_data.StdGroupName;
                            cellGroup.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellGroup);

                            TableCell cellLecturerAdd = new TableCell();
                            cellLecturerAdd.Text = new Lecturer().getLecturer(data.LECTURER_ADD).Lecturer_ShortName;
                            cellLecturerAdd.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellLecturerAdd);

                            TableCell cellApprove = new TableCell();
                            cellApprove.Text = "<a href='Cancel_Extend_Student.aspx?student_id=" + data.Student_ID + "&academic_year=" + data.AcademicYear + "&semester=" + data.Semester + "&course_code=" + data.Course_Code + "&sec=" + data.Sec_No + "&subsec=" + data.SubSec_No + "&lecturer_code=" + lectuere_data.Lecturer + "&show_row=" + row1 + "' title='Cancel' data-target='#deleteModal' data-toggle='modal'><h4><i class='fa fa-trash-o'></i></h4></a>";
                            cellApprove.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellApprove);

                            tb2.Rows.Add(tRowBody);

                            numrow2++;
                        }

                        TableRow  row2  = new TableRow();
                        TableCell cell2 = new TableCell();
                        cell2.Controls.Add(tb2);
                        row2.Cells.Add(cell2);
                        tblExtendStudentAdvisor.Rows.Add(row2);
                    }
                    catch (Exception err)
                    {
                        HttpContext.Current.Session["response"] = "ไม่สามารถดำเนินการได้";
                        HttpContext.Current.Response.Redirect("err_response.aspx");
                    }
                }
                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }