Beispiel #1
0
    // V 1.0.0
    public string deleteLecturerTable(LecturerTableData delete_data, string degree_char)
    {
        string response = "";

        try
        {
            string        TableName = getTableName(degree_char);
            ConnectDB     db        = new ConnectDB();
            SqlDataSource oracleObj = db.ConnectionOracle();
            string        sql       = "Delete From " + TableName + " Where ACADEMIC_YEAR='" + delete_data.AcademicYear + "' And SEMESTER='" + delete_data.Semester + "' And COURSE_CODE='" + delete_data.Course_Code + "' And SEC_NO=" + delete_data.Sec_No + " And SUBSEC_NO=" + delete_data.SubSec_No + " And ROOM_CODE='" + delete_data.Room_Code + "' And BUILDING_CODE='" + delete_data.Building_Code + "' And CAMPUS_CODE='" + delete_data.Campus_Code + "' And TEACHING_DAY='" + delete_data.Teaching_Day + "' And TEACHING_START_TIME='" + delete_data.Teaching_Start_Time + "' And TEACHING_END_TIME='" + delete_data.Teaching_End_Time + "'  ";

            oracleObj.DeleteCommand = sql;

            try
            {
                if (oracleObj.Delete() > 0)
                {
                    response = "OK";
                }
            }
            catch (Exception e)
            {
                response = e.Message.ToString();
            }
        }
        catch
        {
            HttpContext.Current.Session["response"] = "Unit Test:LecturerTable:deleteLecturerTable" + " ไม่สามารถดำเนินการได้";
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }

        return(response);
    }
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        string result = "";

        if ((Session["save_student_data"] != null) && (Session["Extend_Data"] != null))
        {
            LecturerTableData          insert_extend_data       = new LecturerTableData();
            Student                    insert_studentData       = new Student();
            ExtendAvailableStudentData insert_extendStudentData = new ExtendAvailableStudentData();

            insert_extend_data = (LecturerTableData)Session["Extend_Data"];
            insert_studentData = (Student)Session["save_student_data"];

            insert_extendStudentData.AcademicYear    = insert_extend_data.AcademicYear;
            insert_extendStudentData.Semester        = insert_extend_data.Semester;
            insert_extendStudentData.Course_Code     = insert_extend_data.Course_Code;
            insert_extendStudentData.Course_Type     = insert_extend_data.Course_Type;
            insert_extendStudentData.Sec_No          = insert_extend_data.Sec_No;
            insert_extendStudentData.SubSec_No       = insert_extend_data.SubSec_No;
            insert_extendStudentData.Student_ID      = insert_studentData.Student_ID;
            insert_extendStudentData.LECTURER_ADD    = insert_extend_data.Lecturer;
            insert_extendStudentData.LECTURER_CANCEL = "-";

            result = new ExtendAvailableStudent().insertExtendStudent(insert_extendStudentData);

            if (result == "OK")
            {
                divSuccess.Visible = true;
            }
        }
    }
Beispiel #3
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);
    }
Beispiel #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);
    }
Beispiel #5
0
    public LecturerTableData checkSessionDupLectureTime2(List <LecturerTableData> lecture_table)
    {
        List <LecturerTableData> dupLec = new List <LecturerTableData>();
        LecturerTableData        result = new LecturerTableData();

        int index = 0;

        if (HttpContext.Current.Session["index"] != null)
        {
            index = (int)HttpContext.Current.Session["index"];
        }

        if (HttpContext.Current.Session["save_lecturer"] == null)
        {
            result = null;
        }
        else
        {
            List <LecturerTableData> tableData = (List <LecturerTableData>)HttpContext.Current.Session["save_lecturer"];

            foreach (LecturerTableData lec in lecture_table)
            {
                string start     = lec.Teaching_Start_Time.Replace(':', '.');
                string stop      = lec.Teaching_End_Time.Replace(':', '.');
                double num_start = Convert.ToDouble(start);
                double num_stop  = Convert.ToDouble(stop);

                foreach (LecturerTableData table in tableData)
                {
                    string start2     = table.Teaching_Start_Time.Replace(':', '.');
                    string stop2      = table.Teaching_End_Time.Replace(':', '.');
                    double num_start2 = Convert.ToDouble(start2);
                    double num_stop2  = Convert.ToDouble(stop2);


                    if (table.index_of_teaching != index && table.Lecturer != "0000000000000" && table.Lecturer == lec.Lecturer && table.Teaching_Day == lec.Teaching_Day && ((num_start >= num_start2 && num_start < num_stop2) || (num_stop > num_start2 && num_stop <= num_stop2) || (num_start <= num_start2 && num_stop >= num_stop2)))
                    {
                        dupLec.Add(table);
                    }
                }
            }

            if (dupLec.Count == 0)
            {
                result = null;
            }
            else
            {
                result = dupLec[0];
            }
        }



        return(result);
    }
Beispiel #6
0
    // V 1.0.0
    public LecturerTableData checkDupLecturer(List <LecturerTableData> lecturer_table, string degree_char)
    {
        LecturerTableData lecturer_dup = new LecturerTableData();

        try
        {
            string        TableName = getTableName(degree_char);
            ConnectDB     db        = new ConnectDB();
            SqlDataSource oracleObj = db.ConnectionOracle();

            foreach (LecturerTableData lec in lecturer_table)
            {
                LecturerTableData lecturer = new LecturerTableData();

                double start_time = Convert.ToDouble(lec.Teaching_Start_Time.Replace(':', '.'));
                double stop_time  = Convert.ToDouble(lec.Teaching_End_Time.Replace(':', '.'));

                string sql = "select * from " + TableName + " where COURSE_TYPE != '4' And COURSE_TYPE != '5' And COURSE_TYPE != '6' And ACADEMIC_YEAR='" + lec.AcademicYear + "' And SEMESTER='" + lec.Semester + "' And LECTURER_ID='" + lec.Lecturer + "' And LECTURER_ID != '0000000000000' And TEACHING_DAY='" + lec.Teaching_Day + "' AND (( " + start_time + " >= TO_NUMBER(replace(teaching_start_time,':','.'),'9999.99')  AND " + start_time + " < TO_NUMBER(replace(teaching_end_time,':','.'),'9999.99')) OR (" + stop_time + " > TO_NUMBER(replace(teaching_start_time,':','.'),'9999.99')  AND " + stop_time + " <= TO_NUMBER(replace(teaching_end_time,':','.'),'9999.99') OR (" + start_time + " <= TO_NUMBER(replace(teaching_start_time,':','.'),'9999.99')  AND " + stop_time + " >= TO_NUMBER(replace(teaching_end_time,':','.'),'9999.99') )))";

                oracleObj.SelectCommand = sql;
                DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                if (allData.Count > 0)
                {
                    DataRowView rowData = allData[0];
                    lecturer.AcademicYear        = rowData["ACADEMIC_YEAR"].ToString();
                    lecturer.Semester            = rowData["SEMESTER"].ToString();
                    lecturer.Course_Code         = rowData["COURSE_CODE"].ToString();
                    lecturer.Course_Type         = rowData["COURSE_TYPE"].ToString();
                    lecturer.Sec_No              = Convert.ToInt16(rowData["SEC_NO"].ToString());
                    lecturer.SubSec_No           = Convert.ToInt16(rowData["SUBSEC_NO"].ToString());
                    lecturer.Room_Code           = rowData["ROOM_CODE"].ToString();
                    lecturer.Building_Code       = rowData["BUILDING_CODE"].ToString();
                    lecturer.Campus_Code         = rowData["CAMPUS_CODE"].ToString();
                    lecturer.Teaching_Day        = rowData["TEACHING_DAY"].ToString();
                    lecturer.Teaching_Start_Time = rowData["TEACHING_START_TIME"].ToString();
                    lecturer.Teaching_End_Time   = rowData["TEACHING_END_TIME"].ToString();
                    lecturer.Lecturer            = rowData["LECTURER_ID"].ToString();
                    lecturer_dup = lecturer;
                    break;
                }
                else
                {
                    lecturer_dup = null;
                }
            }
        }
        catch (Exception err)
        {
            HttpContext.Current.Session["response"] = "Unit Test:LecturerTable:checkDupLecturer" + " ไม่สามารถดำเนินการได้";
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }

        return(lecturer_dup);
    }
Beispiel #7
0
    // V 1.0.0
    public string[] updateLecturerTable(List <LecturerTableData> lecturer_table, LecturerTableData old_lecturer, string degree_char)
    {
        string[] response = new string[lecturer_table.Count];

        try
        {
            string        TableName = getTableName(degree_char);
            int           i         = 0;
            ConnectDB     db        = new ConnectDB();
            SqlDataSource oracleObj = db.ConnectionOracle();

            if (deleteLecturerTable(old_lecturer.AcademicYear, old_lecturer.Semester, old_lecturer.Course_Code, old_lecturer.Sec_No, old_lecturer.SubSec_No, degree_char) == "OK")
            {
                foreach (LecturerTableData data in lecturer_table)
                {
                    string sql = "Insert Into " + TableName + "(ACADEMIC_YEAR,SEMESTER,COURSE_CODE,COURSE_TYPE,SEC_NO,SUBSEC_NO,ROOM_CODE,TEACHING_DAY,TEACHING_START_TIME,TEACHING_END_TIME,LECTURER_ID,BUILDING_CODE,CAMPUS_CODE) Values('" + data.AcademicYear + "','" + data.Semester + "','" + data.Course_Code + "','" + data.Course_Type + "'," + data.Sec_No + "," + data.SubSec_No + ",'" + data.Room_Code + "','" + data.Teaching_Day + "','" + data.Teaching_Start_Time + "','" + data.Teaching_End_Time + "','" + data.Lecturer + "','" + data.Building_Code + "','" + data.Campus_Code + "' )";

                    oracleObj.InsertCommand = sql;

                    try
                    {
                        if (oracleObj.Insert() == 1)
                        {
                            response[i] = "OK";
                        }
                    }
                    catch (Exception e)
                    {
                        response[i] = e.Message.ToString() + " ";
                    }
                    i++;
                }
            }
            else
            {
                for (int j = 0; j < response.Length; j++)
                {
                    response[j] = "Can't Update";
                }
            }
        }
        catch
        {
            HttpContext.Current.Session["response"] = "Unit Test:LecturerTable:updateLecturerTable" + " ไม่สามารถดำเนินการได้";
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }

        return(response);
    }
Beispiel #8
0
    // V 1.0.0
    public List <LecturerTableData> getLecturerTable(string academic_year, string semester, string teaching_day, string lecture_id, string degree_char)
    {
        List <LecturerTableData> lecturerData = new List <LecturerTableData>();

        try
        {
            string        TableName = getTableName(degree_char);
            string        sql       = "";
            ConnectDB     db        = new ConnectDB();
            SqlDataSource oracleObj = db.ConnectionOracle();

            sql = "Select * From " + TableName + " WHERE ACADEMIC_YEAR='" + academic_year + "' And SEMESTER='" + semester + "' And TEACHING_DAY='" + teaching_day + "' And  LECTURER_ID='" + lecture_id + "' Order By TEACHING_START_TIME";

            oracleObj.SelectCommand = sql;
            DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
            foreach (DataRowView rowData in allData)
            {
                LecturerTableData lecturer_data = new LecturerTableData();

                lecturer_data.AcademicYear        = rowData["ACADEMIC_YEAR"].ToString();
                lecturer_data.Semester            = rowData["SEMESTER"].ToString();
                lecturer_data.Course_Code         = rowData["COURSE_CODE"].ToString();
                lecturer_data.Course_Type         = rowData["COURSE_TYPE"].ToString();
                lecturer_data.Sec_No              = Convert.ToInt16(rowData["SEC_NO"].ToString());
                lecturer_data.SubSec_No           = Convert.ToInt16(rowData["SUBSEC_NO"].ToString());
                lecturer_data.Room_Code           = rowData["ROOM_CODE"].ToString();
                lecturer_data.Building_Code       = rowData["BUILDING_CODE"].ToString();
                lecturer_data.Campus_Code         = rowData["CAMPUS_CODE"].ToString();
                lecturer_data.Teaching_Day        = rowData["TEACHING_DAY"].ToString();
                lecturer_data.Teaching_Start_Time = rowData["TEACHING_START_TIME"].ToString();
                lecturer_data.Teaching_End_Time   = rowData["TEACHING_END_TIME"].ToString();
                lecturer_data.Lecturer            = rowData["LECTURER_ID"].ToString();
                lecturer_data.Course_Degree_Char  = degree_char;

                lecturerData.Add(lecturer_data);
            }
        }
        catch
        {
            HttpContext.Current.Session["response"] = "Unit Test:LecturerTable:getLecturerTable" + " ไม่สามารถดำเนินการได้";
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }

        return(lecturerData);
    }
Beispiel #9
0
    public LecturerTableData checkSessionDupLectureTime1(List <LecturerTableData> lecture_table)
    {
        LecturerTableData result = new LecturerTableData();

        result = null;

        if (HttpContext.Current.Session["save_lecturer"] != null)
        {
            List <LecturerTableData> tableData = (List <LecturerTableData>)HttpContext.Current.Session["save_lecturer"];

            foreach (LecturerTableData lec in lecture_table)
            {
                string start     = lec.Teaching_Start_Time.Replace(':', '.');
                string stop      = lec.Teaching_End_Time.Replace(':', '.');
                double num_start = Convert.ToDouble(start);
                double num_stop  = Convert.ToDouble(stop);

                foreach (LecturerTableData table in tableData)
                {
                    string start2     = table.Teaching_Start_Time.Replace(':', '.');
                    string stop2      = table.Teaching_End_Time.Replace(':', '.');
                    double num_start2 = Convert.ToDouble(start2);
                    double num_stop2  = Convert.ToDouble(stop2);

                    if (table.Lecturer != "0000000000000" && table.Lecturer == lec.Lecturer && table.Teaching_Day == lec.Teaching_Day && ((num_start >= num_start2 && num_start < num_stop2) || (num_stop > num_start2 && num_stop <= num_stop2) || (num_start <= num_start2 && num_stop >= num_stop2)))
                    {
                        result = table;
                        break;
                    }
                }
            }

            return(result);
        }
        else
        {
            return(null);
        }
    }
Beispiel #10
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);
    }
Beispiel #11
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");
            }
        }
    }
Beispiel #12
0
    protected void btnSEARCH_Click(object sender, EventArgs e)
    {
        utility utlObj = new utility();
        UInt64  chknum;

        txtSTD_FIRSTNAME.Text  = "";
        txtSTD_SURNAME.Text    = "";
        txt_STD_FACULTY.Text   = "";
        txtSTD_DEPARTMENT.Text = "";
        txtSTD_MAJOR.Text      = "";
        txtSTD_SPEC_FIELD.Text = "";

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

        Session.Remove("save_student_data");

        if (txtSTUDENT_ID.Text.Length != 13)
        {
            //divShow.Visible = false;
            MsgValidate("กรุณาระบุ รหัสนักศึกษาด้วยตัวเลข 13 หลัก");
        }
        else if (!UInt64.TryParse(txtSTUDENT_ID.Text, out chknum))
        {
            MsgValidate("กรุณาระบุ รหัสนักศึกษาด้วยตัวเลขเท่านั้น");
        }
        else
        {
            divFail.Visible = false;

            extend_data        = (LecturerTableData)Session["Extend_Data"];
            course_degree_char = extend_data.Course_Degree_Char;
            string degree_admission = utlObj.getFactorFromStudentID(txtSTUDENT_ID.Text, utlObj.stdID_Factor_DegreeAdmission);

            if (degree_admission == "1" || degree_admission == "2" || degree_admission == "3")
            {
                degree_char = "U";
            }
            else if (degree_admission == "4" || degree_admission == "5" || degree_admission == "6")
            {
                degree_char = "B";
            }
            else if (degree_admission == "7")
            {
                degree_char = "P";
            }
            else if (degree_admission == "8")
            {
                degree_char = "M";
            }
            else if (degree_admission == "9")
            {
                degree_char = "D";
            }

            studentData = new Student().getStudent(txtSTUDENT_ID.Text, degree_char);

            if (studentData.Student_ID != null)
            {
                RegistrationData regisData = new RegistrationData();
                regisData = new Student_Registration().getDupRegistration(extend_data.AcademicYear, extend_data.Semester, extend_data.Course_Code, studentData.Student_ID, degree_char);

                List <ExtendAvailableStudentData> dupextendData = new List <ExtendAvailableStudentData>();
                dupextendData = new ExtendAvailableStudent().getExtendStudent(extend_data.AcademicYear, extend_data.Semester, extend_data.Course_Code, extend_data.Course_Type, studentData.Student_ID);

                //divShow.Visible = true;
                CourseData course_data = new CourseData();
                course_data = new Course().getCourse(extend_data.Course_Code);

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

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

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



                lblHead.Text = course_type + course_sec + " " + extend_data.Course_Code + " " + course_data.Course_Thainame + "( " + course_data.Course_Engname + " )";

                txtSTD_FIRSTNAME.Text  = studentData.First_ThaiName;
                txtSTD_SURNAME.Text    = studentData.Family_ThaiName;
                txt_STD_FACULTY.Text   = new Faculty().getFaculty(studentData.Faculty_Code).Faculty_Thai;
                txtSTD_DEPARTMENT.Text = new Department().getDepartment(studentData.Department_Code).Department_Thai;
                txtSTD_MAJOR.Text      = new Major().getMajor(studentData.Major_Code).Major_Thai;
                txtSTD_SPEC_FIELD.Text = new SpecialField().getSpecialField(studentData.Spec_Field_Code).SpecialField_Thai;

                if (regisData.Course_Code != null)
                {
                    divDupRegis.Visible = true;

                    string course_type1 = "";
                    course_data = new Course().getCourse(regisData.Course_Code);
                    List <TeachingTableData> teachingData = new List <TeachingTableData>();
                    teachingData = new TeachingTable().getSubTeachingTable(regisData.Academic_Year, regisData.Semester, regisData.Course_Code, regisData.Sec_No, regisData.SubSec_No, degree_char);

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


                    lblErr2.Text  = "";
                    lblErr2.Text += "<div class='row'>";
                    lblErr2.Text += "<article class='col-sm-12 col-md-12 col-lg-12'>";
                    lblErr2.Text += "<div class='jarviswidget jarviswidget-color-primary' id='" + regisData.Course_Code + "' data-widget-editbutton='false' data-widget-deletebutton='false' data-widget-fullscreenbutton='false' data-widget-sortable='false'>";
                    lblErr2.Text += "<header><span class='widget-icon'><i class='fa fa-table'></i></span><h2>ข้อมูลการลงทะเบียน</h2></header>";
                    lblErr2.Text += "<div><div class='widget-body no-padding'><div class='widget-body-toolbar'></div>";
                    lblErr2.Text += "<table class='table table-bordered table-striped table-hover smart-form'>";
                    lblErr2.Text += "<thead><tr><th class='text-center' style='width:50px'>ตอนที่</th><th class='text-center' style='width:50px'>วิชา</th><th class='text-center' style='width:50px'>ห้องเรียน</th><th class='text-center' style='width:50px'>เวลาเรียน</th><th class='text-center' style='width:50px'>ผู้สอน</th></tr></thead>";
                    lblErr2.Text += "<tbody>";
                    lblErr2.Text += "<tr>";
                    if (regisData.SubSec_No != 0)
                    {
                        lblErr2.Text += "<td class='text-center'>" + course_type1 + regisData.SubSec_No + "</td>";
                    }
                    else
                    {
                        lblErr2.Text += "<td class='text-center'>" + course_type1 + regisData.Sec_No + "</td>";
                    }
                    lblErr2.Text += "<td class='text-left'>" + regisData.Course_Code + " " + course_data.Course_Thainame + "</td>";

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

                        room += "<br/>";
                    }
                    lblErr2.Text += "<td class='text-center'>" + room + "</td>";

                    string teachtime = "";
                    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";
                        }

                        teachtime += day + " " + teach.Teaching_Start_Time + " - " + teach.Teaching_End_Time + "<br>";
                    }
                    lblErr2.Text += "<td class='text-center'>" + teachtime + "</td>";

                    string lec_name = "";
                    List <LecturerTableData> lecturerData = new List <LecturerTableData>();
                    foreach (TeachingTableData teach in teachingData)
                    {
                        lecturerData = new LecturerTable().getLecturerTable(teach, degree_char);
                        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>";
                    }
                    lblErr2.Text += "<td class='text-center'>" + lec_name + "</td>";

                    lblErr2.Text += "</tr>";
                    lblErr2.Text += "</tbody>";
                    lblErr2.Text += "</table></div></div></div></article></div>";
                }
                else if (dupextendData.Count != 0)
                {
                    divDupExtend.Visible = true;

                    lblErr3.Text  = "";
                    lblErr3.Text += "<div class='row'>";
                    lblErr3.Text += "<article class='col-sm-12 col-md-12 col-lg-12'>";
                    lblErr3.Text += "<div class='jarviswidget jarviswidget-color-primary' id='" + regisData.Course_Code + "' data-widget-editbutton='false' data-widget-deletebutton='false' data-widget-fullscreenbutton='false' data-widget-sortable='false'>";
                    lblErr3.Text += "<header><span class='widget-icon'><i class='fa fa-table'></i></span><h2>ข้อมูลการลงทะเบียน</h2></header>";
                    lblErr3.Text += "<div><div class='widget-body no-padding'><div class='widget-body-toolbar'></div>";
                    lblErr3.Text += "<table class='table table-bordered table-striped table-hover smart-form'>";
                    lblErr3.Text += "<thead><tr><th class='text-center' style='width:50px'>ตอนที่</th><th class='text-center' style='width:50px'>วิชา</th><th class='text-center' style='width:50px'>ห้องเรียน</th><th class='text-center' style='width:50px'>เวลาเรียน</th><th class='text-center' style='width:50px'>ผู้สอน</th></tr></thead>";

                    foreach (ExtendAvailableStudentData data in dupextendData)
                    {
                        string course_type1 = "";
                        course_data = new Course().getCourse(data.Course_Code);
                        List <TeachingTableData> teachingData = new List <TeachingTableData>();
                        teachingData = new TeachingTable().getSubTeachingTable(data.AcademicYear, data.Semester, data.Course_Code, data.Sec_No, data.SubSec_No, course_degree_char);

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


                        lblErr3.Text += "<tbody>";
                        lblErr3.Text += "<tr>";

                        if (data.SubSec_No != 0)
                        {
                            lblErr3.Text += "<td class='text-center'>" + course_type1 + data.SubSec_No + "</td>";
                        }
                        else
                        {
                            lblErr3.Text += "<td class='text-center'>" + course_type1 + data.Sec_No + "</td>";
                        }

                        lblErr3.Text += "<td class='text-left'>" + data.Course_Code + " " + course_data.Course_Thainame + "</td>";

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

                            room += "<br/>";
                        }

                        lblErr3.Text += "<td class='text-center'>" + room + "</td>";

                        string teachtime = "";
                        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";
                            }

                            teachtime += day + " " + teach.Teaching_Start_Time + " - " + teach.Teaching_End_Time + "<br>";
                        }

                        lblErr3.Text += "<td class='text-center'>" + teachtime + "</td>";

                        string lec_name = "";
                        List <LecturerTableData> lecturerData = new List <LecturerTableData>();
                        foreach (TeachingTableData teach in teachingData)
                        {
                            lecturerData = new LecturerTable().getLecturerTable(teach, course_degree_char);
                            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>";
                        }

                        lblErr3.Text += "<td class='text-center'>" + lec_name + "</td>";

                        lblErr3.Text += "</tr>";
                        lblErr3.Text += "</tbody>";
                    }

                    lblErr3.Text += "</table></div></div></div></article></div>";
                }
                else
                {
                    divFail.Visible              = false;
                    divDupRegis.Visible          = false;
                    btnSAVE.Enabled              = true;
                    Session["save_student_data"] = studentData;
                }
            }
            else
            {
                // divShow.Visible = false;
                MsgValidate("ตรวจสอบไม่พบ นักศึกษาที่ค้นหา");
            }
        }
    }
Beispiel #13
0
    // V 1.0.0
    public List <LecturerTableData> getAllLecturerSecCourse(string academic_year, string semester, string course_code, int sec_num, int subsec_num, string teach_day, string start_time, string end_time)
    {
        List <LecturerTableData> lecturerData = new List <LecturerTableData>();

        try
        {
            string        sql       = "";
            ConnectDB     db        = new ConnectDB();
            SqlDataSource oracleObj = db.ConnectionOracle();

            sql = "Select * From LECTURER_TABLE WHERE ACADEMIC_YEAR='" + academic_year + "' And SEMESTER='" + semester + "' AND COURSE_CODE='" + course_code + "' AND  SEC_NO=" + sec_num + " AND SUBSEC_NO=" + subsec_num + " AND TEACHING_DAY='" + teach_day + "' AND TEACHING_START_TIME='" + start_time + "' AND TEACHING_END_TIME = '" + end_time + "' ";

            oracleObj.SelectCommand = sql;
            DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
            foreach (DataRowView rowData in allData)
            {
                LecturerTableData lecturer_data = new LecturerTableData();

                lecturer_data.AcademicYear        = rowData["ACADEMIC_YEAR"].ToString();
                lecturer_data.Semester            = rowData["SEMESTER"].ToString();
                lecturer_data.Course_Code         = rowData["COURSE_CODE"].ToString();
                lecturer_data.Course_Type         = rowData["COURSE_TYPE"].ToString();
                lecturer_data.Sec_No              = Convert.ToInt16(rowData["SEC_NO"].ToString());
                lecturer_data.SubSec_No           = Convert.ToInt16(rowData["SUBSEC_NO"].ToString());
                lecturer_data.Room_Code           = rowData["ROOM_CODE"].ToString();
                lecturer_data.Building_Code       = rowData["BUILDING_CODE"].ToString();
                lecturer_data.Campus_Code         = rowData["CAMPUS_CODE"].ToString();
                lecturer_data.Teaching_Day        = rowData["TEACHING_DAY"].ToString();
                lecturer_data.Teaching_Start_Time = rowData["TEACHING_START_TIME"].ToString();
                lecturer_data.Teaching_End_Time   = rowData["TEACHING_END_TIME"].ToString();
                lecturer_data.Lecturer            = rowData["LECTURER_ID"].ToString();
                lecturer_data.Course_Degree_Char  = "B";

                lecturerData.Add(lecturer_data);
            }

            sql = "Select * From GRAD_LECTURER_TABLE WHERE ACADEMIC_YEAR='" + academic_year + "' And SEMESTER='" + semester + "' AND COURSE_CODE='" + course_code + "' AND  SEC_NO=" + sec_num + " AND SUBSEC_NO=" + subsec_num + " AND TEACHING_DAY='" + teach_day + "' AND TEACHING_START_TIME='" + start_time + "' AND TEACHING_END_TIME = '" + end_time + "' ";

            oracleObj.SelectCommand = sql;
            allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
            foreach (DataRowView rowData in allData)
            {
                LecturerTableData lecturer_data = new LecturerTableData();

                lecturer_data.AcademicYear        = rowData["ACADEMIC_YEAR"].ToString();
                lecturer_data.Semester            = rowData["SEMESTER"].ToString();
                lecturer_data.Course_Code         = rowData["COURSE_CODE"].ToString();
                lecturer_data.Course_Type         = rowData["COURSE_TYPE"].ToString();
                lecturer_data.Sec_No              = Convert.ToInt16(rowData["SEC_NO"].ToString());
                lecturer_data.SubSec_No           = Convert.ToInt16(rowData["SUBSEC_NO"].ToString());
                lecturer_data.Room_Code           = rowData["ROOM_CODE"].ToString();
                lecturer_data.Building_Code       = rowData["BUILDING_CODE"].ToString();
                lecturer_data.Campus_Code         = rowData["CAMPUS_CODE"].ToString();
                lecturer_data.Teaching_Day        = rowData["TEACHING_DAY"].ToString();
                lecturer_data.Teaching_Start_Time = rowData["TEACHING_START_TIME"].ToString();
                lecturer_data.Teaching_End_Time   = rowData["TEACHING_END_TIME"].ToString();
                lecturer_data.Lecturer            = rowData["LECTURER_ID"].ToString();
                lecturer_data.Course_Degree_Char  = "M";

                lecturerData.Add(lecturer_data);
            }
        }
        catch
        {
            HttpContext.Current.Session["response"] = "Unit Test:LecturerTable:getAllLecturerSecCourse" + " ไม่สามารถดำเนินการได้";
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }

        return(lecturerData);
    }
Beispiel #14
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);
    }
    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");
            }
        }
    }