예제 #1
0
    // V 1.0.0
    public string insertAvailableCourse(AvailableCourseData available_course, string degree_char)
    {
        string        TableName = getTableName(degree_char);
        string        response  = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        UserLoginData loginData = new UserLoginData();

        loginData = (UserLoginData)HttpContext.Current.Session["login_data"];
        LogData log_data = new LogData();

        log_data.ModuleCode = new LogData().Module_Timetable;
        log_data.Username   = loginData.User_ID;
        log_data.Message    = " Add available_course with:" + available_course.AcademicYear;

        string sql = "Insert Into " + TableName + "(ACADEMIC_YEAR,SEMESTER,COURSE_CODE,SEC_NO,NUMBER_STUDENT,FACULTY_CODE,DEPARTMENT_CODE,MAJOR_CODE,SPEC_FIELD_CODE,CURR_CODE,COURSE_TYPE,STATUS) Values('" + available_course.AcademicYear + "','" + available_course.Semester + "','" + available_course.Course_Code + "'," + available_course.Sec_No + "," + available_course.Number_Student + ",'" + available_course.Faculty_Code + "','" + available_course.Department_Code + "','" + available_course.Major_Code + "','" + available_course.Spec_Field_Code + "','" + available_course.Curr_Code + "','" + available_course.Course_Type + "','" + available_course.Status + "')";

        oracleObj.InsertCommand = sql;

        try
        {
            if (oracleObj.Insert() == 1)
            {
                response = "OK";
            }
        }
        catch (Exception e)
        {
            response = e.Message.ToString();
        }


        return(response);
    }
예제 #2
0
    // V 1.0.0
    public string updateAvailableCourse(AvailableCourseData available_course, AvailableCourseData old_data, string degree_char)
    {
        string        TableName = getTableName(degree_char);
        string        response  = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        string sql = "Update " + TableName + " Set NUMBER_STUDENT=" + available_course.Number_Student + " Where ACADEMIC_YEAR='" + old_data.AcademicYear + "' And SEMESTER='" + old_data.Semester + "' And COURSE_CODE='" + old_data.Course_Code + "' And SEC_NO='" + old_data.Sec_No + "'";

        oracleObj.UpdateCommand = sql;

        try
        {
            if (oracleObj.Update() == 1)
            {
                response = "OK";
            }
        }
        catch (Exception e)
        {
            response = e.Message.ToString();
        }


        return(response);
    }
예제 #3
0
    // V 1.0.0
    public List <AvailableCourseData> getAvailableServiceCourse(string academic_year, string semester, string degree_char)
    {
        string TableName = getTableName(degree_char);
        string sql       = "Select * From " + TableName + " Where  ACADEMIC_YEAR='" + academic_year + "' And SEMESTER='" + semester + "' And FACULTY_CODE IS NULL And CURR_CODE IS NULL Order By COURSE_CODE";
        List <AvailableCourseData> avaCourse = new List <AvailableCourseData>();
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

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

        foreach (DataRowView rowData in allData)
        {
            AvailableCourseData ava_course = new AvailableCourseData();
            ava_course.AcademicYear    = rowData["ACADEMIC_YEAR"].ToString();
            ava_course.Semester        = rowData["SEMESTER"].ToString();
            ava_course.Course_Code     = rowData["COURSE_CODE"].ToString();
            ava_course.Sec_No          = Convert.ToInt16(rowData["SEC_NO"].ToString());
            ava_course.Number_Student  = Convert.ToInt16(rowData["NUMBER_STUDENT"].ToString());
            ava_course.Faculty_Code    = rowData["FACULTY_CODE"].ToString();
            ava_course.Department_Code = rowData["DEPARTMENT_CODE"].ToString();
            ava_course.Major_Code      = rowData["MAJOR_CODE"].ToString();
            ava_course.Spec_Field_Code = rowData["SPEC_FIELD_CODE"].ToString();
            ava_course.Curr_Code       = rowData["CURR_CODE"].ToString();
            ava_course.Course_Type     = rowData["COURSE_TYPE"].ToString();
            ava_course.Status          = rowData["STATUS"].ToString();

            avaCourse.Add(ava_course);
        }

        return(avaCourse);
    }
예제 #4
0
    // V 1.0.0
    public List <AvailableStudentData> getAvailableStudent_faculty(string academic_year, string semester, string faculty_code, string degree_char)
    {
        string TableName = getTableName(degree_char);
        List <AvailableStudentData> avaStudent = new List <AvailableStudentData>();

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

        oracleObj.SelectCommand = "Select * From " + TableName + " Where ACADEMIC_YEAR='" + academic_year + "' AND SEMESTER='" + semester + "' AND FACULTY_CODE='" + faculty_code + "'  Order By COURSE_CODE,SEC_NO,SUBSEC_NO";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            AvailableCourseData ava_data = new AvailableCourseData();
            ava_data = new AvailableCourse().getAvailableCourse(rowData["ACADEMIC_YEAR"].ToString(), rowData["SEMESTER"].ToString(), rowData["COURSE_CODE"].ToString(), Convert.ToInt16(rowData["SEC_NO"].ToString()), degree_char);
            CurriculumGeneralData curr_data = new Curriculum().getCurriculum(ava_data.Curr_Code);
            if (curr_data.Degree_Char == degree_char)
            {
                AvailableStudentData ava_student = new AvailableStudentData();
                ava_student.AcademicYear          = rowData["ACADEMIC_YEAR"].ToString();
                ava_student.Semester              = rowData["SEMESTER"].ToString();
                ava_student.Course_Code           = rowData["COURSE_CODE"].ToString();
                ava_student.Course_Type           = rowData["COURSE_TYPE"].ToString();
                ava_student.Sec_No                = Convert.ToInt16(rowData["SEC_NO"].ToString());
                ava_student.SubSec_No             = Convert.ToInt16(rowData["SUBSEC_NO"].ToString());
                ava_student.Curr_Code             = rowData["CURR_CODE"].ToString();
                ava_student.Student_Category_Code = rowData["STD_CATEGORY_CODE"].ToString();
                ava_student.Student_Group_Code    = rowData["STD_GROUP_CODE"].ToString();
                ava_student.Section_Code          = rowData["SECTION_CODE"].ToString();
                ava_student.Student_Year          = Convert.ToInt16(rowData["STUDENT_YEAR"].ToString());
                ava_student.Faculty_Code          = rowData["FACULTY_CODE"].ToString();

                avaStudent.Add(ava_student);
            }
        }

        return(avaStudent);
    }
예제 #5
0
    // V 1.0.0
    public string deleteAvailableCourse(AvailableCourseData delete_data, string degree_char)
    {
        string        TableName = getTableName(degree_char);
        string        response  = "";
        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;

        oracleObj.DeleteCommand = sql;

        try
        {
            if (oracleObj.Delete() > 0)
            {
                response = "OK";
            }
        }
        catch (Exception e)
        {
            response = e.Message.ToString() + " ";
        }

        return(response);
    }
예제 #6
0
    // V 1.0.0
    public List <AvailableCourseData> getDistinctCourse(string academic_year, string semester, string faculty_code, string curr_code, string degree_char)
    {
        string TableName = getTableName(degree_char);
        string sql       = "select distinct academic_year,semester,curr_code,faculty_code,course_code from " + TableName + " Where ACADEMIC_YEAR='" + academic_year + "' And Semester='" + semester + "' And Faculty_Code='" + faculty_code + "' And Curr_Code='" + curr_code + "'";
        List <AvailableCourseData> avaCourse = new List <AvailableCourseData>();
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

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

        foreach (DataRowView rowData in allData)
        {
            AvailableCourseData ava_course = new AvailableCourseData();
            ava_course.AcademicYear = rowData["ACADEMIC_YEAR"].ToString();
            ava_course.Semester     = rowData["SEMESTER"].ToString();
            ava_course.Faculty_Code = rowData["FACULTY_CODE"].ToString();
            ava_course.Curr_Code    = rowData["CURR_CODE"].ToString();
            ava_course.Course_Code  = rowData["COURSE_CODE"].ToString();
            avaCourse.Add(ava_course);
        }

        return(avaCourse);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        divFail.Visible          = false;
        divSuccess.Visible       = false;
        lblSubDreditPass.Visible = false;
        Session["isOK"]          = false;

        if ((Session["save_data"] != null) && (Session["save_student"] != null) && (Session["save_teaching"] != null) && (Session["save_lecturer"] != null) && (Session["academic_year"] != null) && (Session["semester"] != null) && (Session["course_code"] != null) && (Session["Sec"] != null) && (Session["subsec_num"] != null))
        {
            try
            {
                available_data    = (AvailableCourseData)Session["save_data"];
                available_student = (List <AvailableStudentData>)Session["save_student"];
                teachtable        = (List <TeachingTableData>)Session["save_teaching"];
                lecturertable     = (List <LecturerTableData>)Session["save_lecturer"];

                CurriculumGeneralData curr = new Curriculum().getCurriculum(available_data.Curr_Code);
                degree_char = curr.Degree_Char;

                string old_academic_year = (string)Session["academic_year"];
                string old_semester      = (string)Session["semester"];
                string old_course_code   = (string)Session["course_code"];
                int    old_sec_num       = (int)Session["Sec"];
                int    old_subsec_num    = (int)Session["subsec_num"];

                old_available_data.AcademicYear = old_academic_year;
                old_available_data.Semester     = old_semester;
                old_available_data.Course_Code  = old_course_code;
                old_available_data.Sec_No       = old_sec_num;

                old_available_student.AcademicYear = old_academic_year;
                old_available_student.Semester     = old_semester;
                old_available_student.Course_Code  = old_course_code;
                old_available_student.Sec_No       = old_sec_num;
                old_available_student.SubSec_No    = old_subsec_num;

                old_teaching.AcademicYear = old_academic_year;
                old_teaching.Semester     = old_semester;
                old_teaching.Course_Code  = old_course_code;
                old_teaching.Sec_No       = old_sec_num;
                old_teaching.SubSec_No    = old_subsec_num;

                old_lecturer.AcademicYear = old_academic_year;
                old_lecturer.Semester     = old_semester;
                old_lecturer.Course_Code  = old_course_code;
                old_lecturer.Sec_No       = old_sec_num;
                old_lecturer.SubSec_No    = old_subsec_num;


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

                lblSemester.Text     = available_data.Semester;
                lblAcademicYear.Text = available_data.AcademicYear;
                //lblFaculty.Text = new Faculty().getFaculty(available_data.Faculty_Code).Faculty_Thai;
                //lblCurriculum.Text = available_data.Curr_Code + " " + new Curriculum().getCurriculum(available_data.Curr_Code).Curr_ThaiName;
                lblCourse.Text = course_data.Course_Code + " : " + course_data.Course_Thainame + " " + course_data.Credit.ToString() + "(" + course_data.Theory.ToString() + "-" + course_data.Practice.ToString() + "-" + course_data.Self_Study.ToString() + ")";

                lblSecNo.Text         = teachtable[0].SubSec_No.ToString();
                lblNumberStudent.Text = teachtable[0].SubNumber_Student.ToString();
                lblCourseType.Text    = new CourseType().getCourseType(teachtable[0].Course_Type).CourseType_Thainame;

                if (available_data.Curr_Code.Substring(4) == "999999999")
                {
                    lblFaculty.Text    = "วิชาบริการศึกษา";
                    lblCurriculum.Text = curr.Curr_ThaiName + " (ปีหลักสูตร " + curr.Curr_Year + ")";
                }
                else
                {
                    lblFaculty.Text    = new Faculty().getFaculty(available_data.Faculty_Code).Faculty_Thai;
                    lblCurriculum.Text = curr.Curr_Code + " " + curr.Curr_ThaiName;
                }

                // Head Table
                string[] ar1 = { "หลักสูตร", "ประเภทนักศึกษา", "รอบ", "ชั้นปี", "กลุ่ม" };
                Table    tb1 = new Table();
                tb1.Attributes.Add("class", "table table-bordered table-striped");
                tb1.Attributes.Add("id", "dt_basic1");
                TableHeaderRow tRowHead = new TableHeaderRow();
                tRowHead.TableSection = TableRowSection.TableHeader;
                for (int cellCtr = 1; cellCtr <= ar1.Length; cellCtr++)
                {
                    // Create a new cell and add it to the row.
                    TableHeaderCell cellHead = new TableHeaderCell();
                    cellHead.Text = ar1[cellCtr - 1];
                    tRowHead.Cells.Add(cellHead);
                }

                tb1.Rows.Add(tRowHead);

                foreach (AvailableStudentData available in available_student)
                {
                    if (available.Student_Group_Code != "-")
                    {
                        TableRow tRowBody = new TableRow();
                        tRowBody.TableSection = TableRowSection.TableBody;


                        TableCell             cellCurriculum = new TableCell();
                        CurriculumGeneralData std_curr       = new Curriculum().getCurriculum(available.Curr_Code);
                        cellCurriculum.Text = std_curr.Curr_Code + " " + std_curr.Curr_ThaiName;
                        tRowBody.Cells.Add(cellCurriculum);

                        TableCell cellStdCategory = new TableCell();
                        cellStdCategory.Text = new StdCategory().getStdCategory(available.Student_Category_Code).StdCategory_Thai;
                        tRowBody.Cells.Add(cellStdCategory);

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

                        TableCell cellStudentYear = new TableCell();
                        cellStudentYear.Text = available.Student_Year.ToString();
                        tRowBody.Cells.Add(cellStudentYear);

                        TableCell cellStudentGroup = new TableCell();
                        cellStudentGroup.Text = new StdGroup().getStdGroup(available.Student_Group_Code).StdGroup_Thai;
                        tRowBody.Cells.Add(cellStudentGroup);

                        tb1.Rows.Add(tRowBody);
                    }
                }

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

                if (tb1.Rows.Count <= 1)
                {
                    tblStudentList.Visible = false;
                }


                // Head Table
                string[] ar3 = { "คณะ" };
                Table    tb3 = new Table();
                tb3.Attributes.Add("class", "table table-bordered table-striped");
                tb3.Attributes.Add("id", "dt_basic3");
                TableHeaderRow tRowHead3 = new TableHeaderRow();
                tRowHead3.TableSection = TableRowSection.TableHeader;
                for (int cellCtr = 1; cellCtr <= ar3.Length; cellCtr++)
                {
                    // Create a new cell and add it to the row.
                    TableHeaderCell cellHead3 = new TableHeaderCell();
                    cellHead3.Text = ar3[cellCtr - 1];
                    tRowHead3.Cells.Add(cellHead3);
                }

                tb3.Rows.Add(tRowHead3);

                foreach (AvailableStudentData available in available_student)
                {
                    if (available.Faculty_Code != "-" && available.Student_Group_Code == "-")
                    {
                        TableRow tRowBody = new TableRow();
                        tRowBody.TableSection = TableRowSection.TableBody;

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


                        tb3.Rows.Add(tRowBody);
                    }
                }

                TableRow  row3  = new TableRow();
                TableCell cell3 = new TableCell();
                cell3.Controls.Add(tb3);
                row3.Cells.Add(cell3);
                tblStudentList2.Rows.Clear();
                tblStudentList2.Rows.Add(row3);

                if (tb3.Rows.Count <= 1)
                {
                    tblStudentList2.Visible = false;
                }

                // Head Table
                string[] ar4 = { "หลักสูตร" };
                Table    tb4 = new Table();
                tb4.Attributes.Add("class", "table table-bordered table-striped");
                tb4.Attributes.Add("id", "dt_basic4");
                TableHeaderRow tRowHead4 = new TableHeaderRow();
                tRowHead4.TableSection = TableRowSection.TableHeader;
                for (int cellCtr = 1; cellCtr <= ar4.Length; cellCtr++)
                {
                    // Create a new cell and add it to the row.
                    TableHeaderCell cellHead4 = new TableHeaderCell();
                    cellHead4.Text = ar4[cellCtr - 1];
                    tRowHead4.Cells.Add(cellHead4);
                }

                tb4.Rows.Add(tRowHead4);

                foreach (AvailableStudentData available in available_student)
                {
                    if (available.Curr_Code != "-" && available.Student_Group_Code == "-")
                    {
                        TableRow tRowBody = new TableRow();
                        tRowBody.TableSection = TableRowSection.TableBody;

                        TableCell             cellCurri = new TableCell();
                        CurriculumGeneralData std_curr2 = new Curriculum().getCurriculum(available.Curr_Code);
                        cellCurri.Text = std_curr2.Curr_Code + " " + std_curr2.Curr_ThaiName;
                        tRowBody.Cells.Add(cellCurri);


                        tb4.Rows.Add(tRowBody);
                    }
                }

                TableRow  row4  = new TableRow();
                TableCell cell4 = new TableCell();
                cell4.Controls.Add(tb4);
                row4.Cells.Add(cell4);
                tblStudentList3.Rows.Clear();
                tblStudentList3.Rows.Add(row4);

                if (tb4.Rows.Count <= 1)
                {
                    tblStudentList3.Visible = false;
                }

                // Head Table
                string[] ar2     = { "ช่วงที่", "วันสอน", "เวลา", "อาคาร", "ห้องเรียน", "ผู้สอน" };
                int      num_row = 1;

                Table tb2 = new Table();
                tb2.Attributes.Add("class", "table table-bordered table-striped");
                tb2.Attributes.Add("id", "dt_basic2");
                TableHeaderRow tRowHead2 = new TableHeaderRow();
                tRowHead2.TableSection = TableRowSection.TableHeader;
                for (int cellCtr = 1; cellCtr <= ar2.Length; cellCtr++)
                {
                    // Create a new cell and add it to the row.
                    TableHeaderCell cellHead2 = new TableHeaderCell();
                    cellHead2.Text = ar2[cellCtr - 1];
                    tRowHead2.Cells.Add(cellHead2);
                }

                tb2.Rows.Add(tRowHead2);

                foreach (TeachingTableData table in teachtable)
                {
                    TableRow tRowBody2 = new TableRow();
                    tRowBody2.TableSection = TableRowSection.TableBody;


                    TableCell cellRow = new TableCell();
                    cellRow.Text = num_row.ToString();
                    tRowBody2.Cells.Add(cellRow);

                    TableCell cellDay = new TableCell();
                    cellDay.Text = utlObj.getDayOfWeek_Thai(table.Teaching_Day);
                    tRowBody2.Cells.Add(cellDay);

                    TableCell cellTime = new TableCell();
                    cellTime.Attributes.Add("class", "text-center");
                    cellTime.Text = table.Teaching_Start_Time + " - " + table.Teaching_End_Time;
                    tRowBody2.Cells.Add(cellTime);

                    TableCell cellBuilding = new TableCell();
                    cellBuilding.Text = new Building().getBuilding(table.Building_Code).Building_ThaiName;
                    tRowBody2.Cells.Add(cellBuilding);

                    TableCell cellRoom = new TableCell();
                    if (table.Room_Code == "0")     // ไม่ระบุห้องเรียน
                    {
                        cellRoom.Text = "ไม่ระบุ";
                    }
                    else
                    {
                        cellRoom.Text = new Room().getRoom(table.Campus_Code, table.Building_Code, table.Room_Code).Room_ThaiName;
                    }
                    tRowBody2.Cells.Add(cellRoom);



                    string lec_all = "";

                    foreach (LecturerTableData lect_data in lecturertable)
                    {
                        if (table.Room_Code == lect_data.Room_Code && table.Teaching_Day == lect_data.Teaching_Day && table.Teaching_Start_Time == lect_data.Teaching_Start_Time && table.Teaching_End_Time == lect_data.Teaching_End_Time)
                        {
                            lec_all += lecturerObj.getLecturer(lect_data.Lecturer).First_ThaiName + " " + lecturerObj.getLecturer(lect_data.Lecturer).Family_ThaiName + "<br />";
                        }
                    }

                    TableCell cellLecturer = new TableCell();
                    cellLecturer.Text = lec_all;
                    tRowBody2.Cells.Add(cellLecturer);



                    tb2.Rows.Add(tRowBody2);
                    num_row++;
                }

                TableRow  row2  = new TableRow();
                TableCell cell2 = new TableCell();
                cell2.Controls.Add(tb2);
                row2.Cells.Add(cell2);
                tblTeaching.Rows.Add(row2);

                if (!Page.IsPostBack)
                {
                    createCreditTable();
                }
                else
                {
                    createCreditTable2();
                }

                divSuccess.Visible = false;
                divFail.Visible    = false;
                divBody.Visible    = true;
            }
            catch
            {
                divSuccess.Visible = false;
                divFail.Visible    = true;
                divBody.Visible    = false;
            }
        }
        else
        {
            divShow.Visible = false;
            divFail.Visible = true;
        }
    }
예제 #8
0
    private void createCreditTable2()
    {
        available_data = (AvailableCourseData)Session["save_data"];
        CourseData course_data = new Course().getCourse(available_data.Course_Code);

        tblSubCredit.Rows.Clear();

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

        Table tb5 = new Table();

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

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

        tb5.Rows.Add(tRowHead5);

        int i = 0;

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

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

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

        //    lec_code = lect_data.Lecturer;
        //    }

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

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

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

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

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

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

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

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


            int credit = course_data.Credit;

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


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

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


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

            tb5.Rows.Add(tRowBody5);
            i++;
        }

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

        cell5.Controls.Add(tb5);
        row5.Cells.Add(cell5);
        tblSubCredit.Rows.Add(row5);
    }
예제 #9
0
    protected void Page_Load(object sender, EventArgs e)

    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            login_data = (UserLoginData)Session["login_data"];

            if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                divFail.Visible = false;

                if ((Session["save_data"] != null) && (Session["service_course"] != null))
                {
                    ConnectDB     db        = new ConnectDB();
                    SqlDataSource oracleObj = db.ConnectionOracle_tqf2();


                    available_data = (AvailableCourseData)Session["save_data"];
                    service_code   = (bool)Session["service_course"];



                    if (service_code == true)
                    {
                        // ตรวจสอบกำหนดการ

                        int diffDate = -1;


                        config_data1 = new TeachExamConfig().getTeachExamConfig();

                        if (config_data1.Date_Stop != null)
                        {
                            diffDate = utlObj.getDiffDate(config_data1.Date_Stop, utlObj.getToday());
                        }



                        string sql = "";
                        curr_year       = available_data.Curr_Code.Substring(0, 4);
                        curr_code       = available_data.Curr_Code.Substring(4);
                        lblFaculty.Text = "วิชาบริการศึกษา";
                        //available_data.Faculty_Code = "xx";
                        //available_data.Department_Code = "xxxx";
                        available_data.Major_Code = "xxxxxx";
                        lblCurri.Text             = new Curriculum().getCurriculum(available_data.Curr_Code).Curr_ThaiName + " (" + curr_year + ")";


                        //วิชาการคณะ
                        if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                        {
                            List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                            sql = "Select DISTINCT COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + curr_code + "' AND YEARVERSION='" + curr_year + "' AND  COURSECODE NOT Like '%x' AND (";

                            int ii = 0;
                            foreach (string fac in faculty_authorized)
                            {
                                ii++;
                                sql += "COURSECODE Like '" + fac + "%'";

                                if (faculty_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") Order By COURSECODE";
                            // lblCurri.Text = sql;
                        }

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

                            sql = "Select DISTINCT COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + curr_code + "' AND YEARVERSION='" + curr_year + "' AND  COURSECODE NOT Like '%x' AND (";

                            int ii = 0;
                            foreach (string dep in department_authorized)
                            {
                                ii++;
                                sql += "COURSECODE Like '" + dep + "%'";

                                if (department_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") Order By COURSECODE";
                        }

                        oracleObj.SelectCommand = sql;
                        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                        all_course.Clear();
                        foreach (DataRowView rowData in allData)
                        {
                            int diffExtDate = -1;
                            config_data2 = new TeachExamConfig().getExtendTeachExamConfig(rowData["COURSECODE"].ToString().Substring(0, 4));
                            if (config_data2.Date_Stop != null)
                            {
                                diffExtDate = utlObj.getDiffDate(config_data2.Date_Stop, utlObj.getToday());
                            }

                            if (diffDate >= 0)
                            {
                                if (course.checkStatus(rowData["COURSECODE"].ToString()))
                                {
                                    all_course.Add(rowData["COURSECODE"].ToString());
                                }
                            }
                            else if (diffExtDate >= 0)
                            {
                                if (course.checkStatus(rowData["COURSECODE"].ToString()))
                                {
                                    all_course.Add(rowData["COURSECODE"].ToString());
                                }
                            }
                        }
                    }
                    else if (service_code == false)
                    {
                        curr_year = available_data.Curr_Code.Substring(0, 4);
                        curr_code = available_data.Curr_Code.Substring(4);

                        lblFaculty.Text = new Faculty().getFaculty(available_data.Faculty_Code).Faculty_Thai;
                        lblCurri.Text   = curr_code + " " + new Curriculum().getCurriculum(available_data.Curr_Code).Curr_ThaiName + " (" + curr_year + ")";

                        string sql = "";

                        //วิชาการคณะ
                        if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                        {
                            List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                            sql = "Select DISTINCT COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + curr_code + "' AND YEARVERSION='" + curr_year + "' AND  COURSECODE NOT Like '%x' AND (";

                            int ii = 0;
                            foreach (string fac in faculty_authorized)
                            {
                                ii++;
                                sql += "COURSECODE Like '" + fac + "%'";

                                if (faculty_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") Order By COURSECODE";
                        }

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

                            sql = "Select DISTINCT COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + curr_code + "' AND YEARVERSION='" + curr_year + "' AND  COURSECODE NOT Like '%x' AND (";

                            int ii = 0;
                            foreach (string dep in department_authorized)
                            {
                                ii++;
                                sql += "COURSECODE Like '" + dep + "%'";

                                if (department_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") Order By COURSECODE";
                        }

                        oracleObj.SelectCommand = sql;

                        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                        all_course.Clear();
                        foreach (DataRowView rowData in allData)
                        {
                            if (course.checkStatus(rowData["COURSECODE"].ToString()))
                            {
                                all_course.Add(rowData["COURSECODE"].ToString());
                            }
                        }
                    }


                    RadioButton[] radio = new RadioButton[all_course.Count];
                    int           i     = 0;

                    // Head Table
                    string[] ar  = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "เลือก" };
                    Table    tb1 = new Table();
                    tb1.Attributes.Add("class", "table table-bordered table-hover");
                    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.Attributes.Add("class", "text-center");
                        cellHead.Text = ar[cellCtr - 1];
                        tRowHead.Cells.Add(cellHead);
                    }

                    tb1.Rows.Add(tRowHead);

                    foreach (string course_code in all_course)
                    {
                        TableRow tRowBody = new TableRow();
                        tRowBody.TableSection = TableRowSection.TableBody;

                        course_data = course.getCourse(course_code);


                        TableCell cellCourse_Code = new TableCell();
                        cellCourse_Code.Text = course_data.Course_Code;
                        tRowBody.Cells.Add(cellCourse_Code);

                        TableCell cellCourse_Name = new TableCell();
                        cellCourse_Name.Text = course_data.Course_Thainame + "<br/>" + course_data.Course_Engname;
                        tRowBody.Cells.Add(cellCourse_Name);

                        TableCell cellCourse_Credit = new TableCell();
                        cellCourse_Credit.Text = Convert.ToString(course_data.Credit) + "(" + Convert.ToString(course_data.Theory) + "-" + Convert.ToString(course_data.Practice) + "-" + course_data.Self_Study.ToString() + ")";
                        cellCourse_Credit.Attributes.Add("class", "text-center");
                        tRowBody.Cells.Add(cellCourse_Credit);

                        TableCell cellCourse_Radio = new TableCell();

                        radio[i]    = new RadioButton();
                        radio[i].ID = course_data.Course_Code;
                        cellCourse_Radio.Attributes.Add("class", "text-center");
                        radio[i].AutoPostBack    = true;
                        radio[i].GroupName       = "course_group";
                        radio[i].CheckedChanged += new EventHandler(radioButtons_CheckedChanged);
                        cellCourse_Radio.Controls.Add(radio[i]);


                        tRowBody.Cells.Add(cellCourse_Radio);

                        tb1.Rows.Add(tRowBody);

                        i++;
                    }

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

                    //Disable Next button when page load
                    btnNext.Disabled = true;
                }
                else
                {
                    divShow.Visible = false;
                    divFail.Visible = true;
                }
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
예제 #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.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                divFail.Visible = false;

                if ((Session["save_data"] != null) && (Session["service_course"] != null))
                {
                    ConnectDB     db        = new ConnectDB();
                    SqlDataSource oracleObj = db.ConnectionOracle();

                    available_data = (AvailableCourseData)Session["save_data"];
                    service_code   = (bool)Session["service_course"];

                    CurriculumGeneralData curr = new Curriculum().getCurriculum(available_data.Curr_Code);
                    degree_char = curr.Degree_Char;


                    CourseData course_data = new CourseData();
                    Course     course      = new Course();

                    List <string> all_course = new List <string>();
                    string        TableName  = new AvailableCourse().getTableName(degree_char);

                    string sql = "";

                    if (service_code == true)
                    {
                        lblFaculty.Text = "วิชาบริการศึกษา";
                        lblCurri.Text   = curr.Curr_ThaiName + " (ปีหลักสูตร " + curr.Curr_Year + ")";

                        // ตรวจสอบกำหนดการ

                        int diffDate = -1;


                        config_data1 = new TeachExamConfig().getTeachExamConfig();

                        if (config_data1.Date_Stop != null)
                        {
                            diffDate = utlObj.getDiffDate(config_data1.Date_Stop, utlObj.getToday());
                        }

                        //วิชาการคณะ
                        if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                        {
                            List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                            sql = "Select COURSE_CODE From " + TableName + " Where ACADEMIC_YEAR='" + available_data.AcademicYear + "' And SEMESTER='" + available_data.Semester + "' And CURR_CODE='" + available_data.Curr_Code + "' And (";

                            int ii = 0;
                            foreach (string fac in faculty_authorized)
                            {
                                ii++;
                                sql += "FACULTY_CODE= '" + fac + "'";

                                if (faculty_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") GROUP By COURSE_CODE Order By COURSE_CODE";
                        }
                        //วิชาการภาค
                        else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                        {
                            List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                            sql = "Select COURSE_CODE From " + TableName + " Where ACADEMIC_YEAR='" + available_data.AcademicYear + "' And SEMESTER='" + available_data.Semester + "' And CURR_CODE='" + available_data.Curr_Code + "' And (";

                            int ii = 0;
                            foreach (string dep in department_authorized)
                            {
                                ii++;
                                sql += "DEPARTMENT_CODE= '" + dep + "'";

                                if (department_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") GROUP By COURSE_CODE Order By COURSE_CODE";
                        }

                        oracleObj.SelectCommand = sql;
                        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                        all_course.Clear();
                        foreach (DataRowView rowData in allData)
                        {
                            int diffExtDate = -1;
                            config_data2 = new TeachExamConfig().getExtendTeachExamConfig(rowData["COURSE_CODE"].ToString().Substring(0, 4));
                            if (config_data2.Date_Stop != null)
                            {
                                diffExtDate = utlObj.getDiffDate(config_data2.Date_Stop, utlObj.getToday());
                            }

                            if (diffDate >= 0)
                            {
                                all_course.Add(rowData["COURSE_CODE"].ToString());
                            }
                            else if (diffExtDate >= 0)
                            {
                                all_course.Add(rowData["COURSE_CODE"].ToString());
                            }
                        }
                    }
                    else if (service_code == false)
                    {
                        lblFaculty.Text = new Faculty().getFaculty(available_data.Faculty_Code).Faculty_Thai;
                        lblCurri.Text   = curr.Curr_Code + " " + curr.Curr_ThaiName;

                        sql = "Select COURSE_CODE From " + TableName + " Where ACADEMIC_YEAR='" + available_data.AcademicYear + "' And SEMESTER='" + available_data.Semester + "' And FACULTY_CODE='" + available_data.Faculty_Code + "' And DEPARTMENT_CODE='" + available_data.Department_Code + "' And CURR_CODE='" + available_data.Curr_Code + "' GROUP By COURSE_CODE Order By COURSE_CODE";

                        oracleObj.SelectCommand = sql;
                        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                        foreach (DataRowView rowData in allData)
                        {
                            all_course.Add(rowData["COURSE_CODE"].ToString());
                        }
                    }



                    RadioButton[] radio = new RadioButton[all_course.Count];
                    int           i     = 0;

                    // Head Table
                    string[] ar  = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "เลือก" };
                    Table    tb1 = new Table();
                    tb1.Attributes.Add("class", "table table-bordered table-hover");
                    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.Attributes.Add("class", "text-center");
                        cellHead.Text = ar[cellCtr - 1];
                        tRowHead.Cells.Add(cellHead);
                    }

                    tb1.Rows.Add(tRowHead);

                    foreach (string course_code in all_course)
                    {
                        TableRow tRowBody = new TableRow();
                        tRowBody.TableSection = TableRowSection.TableBody;

                        course_data = course.getCourse(course_code);

                        if (course_data.Practice != 0 && course_data.Theory != 0)
                        {
                            TableCell cellCourse_Code = new TableCell();
                            cellCourse_Code.Text = course_data.Course_Code;
                            tRowBody.Cells.Add(cellCourse_Code);

                            TableCell cellCourse_Name = new TableCell();
                            cellCourse_Name.Text = course_data.Course_Thainame + "<br/>" + course_data.Course_Engname;
                            tRowBody.Cells.Add(cellCourse_Name);

                            TableCell cellCourse_Credit = new TableCell();
                            cellCourse_Credit.Attributes.Add("class", "text-center");
                            cellCourse_Credit.Text = Convert.ToString(course_data.Credit) + "(" + Convert.ToString(course_data.Theory) + "-" + Convert.ToString(course_data.Practice) + "-" + course_data.Self_Study.ToString() + ")";
                            tRowBody.Cells.Add(cellCourse_Credit);

                            TableCell cellCourse_Radio = new TableCell();
                            cellCourse_Radio.Attributes.Add("class", "text-center");
                            radio[i]              = new RadioButton();
                            radio[i].ID           = course_data.Course_Code;
                            radio[i].AutoPostBack = true;
                            radio[i].GroupName    = "course_group";
                            if (Session["selected_course"] != null)
                            {
                                if (radio[i].ID == (string)Session["selected_course"])
                                {
                                    radio[i].Checked = true;
                                }
                            }
                            radio[i].CheckedChanged += new EventHandler(radioButtons_CheckedChanged);
                            cellCourse_Radio.Controls.Add(radio[i]);
                            tRowBody.Cells.Add(cellCourse_Radio);

                            tb1.Rows.Add(tRowBody);

                            i++;
                        }
                    }

                    if (!Page.IsPostBack)
                    {
                        //A1.Disabled = true;
                    }

                    TableRow  row  = new TableRow();
                    TableCell cell = new TableCell();
                    cell.Controls.Add(tb1);
                    row.Cells.Add(cell);
                    tblCourse.Rows.Add(row);
                }
                else
                {
                    divShow.Visible = false;
                    divFail.Visible = true;
                }
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
예제 #11
0
    protected void onclick_section1(object sender, EventArgs e)
    {
        try
        {
            uint chknum;
            AvailableCourseData available_data = new AvailableCourseData();

            available_data.AcademicYear = txtACADEMIC_YEAR.Text;
            available_data.Semester     = ddlSEMESTER.SelectedValue;
            available_data.Faculty_Code = ddlFACULTY.SelectedValue;
            if (rbt1.Checked)
            {
                CurriculumGeneralData curr_data = new CurriculumGeneralData();
                curr_data = new Curriculum().getCurriculum(ddlCURRICULUM.SelectedValue);
                available_data.Curr_Code       = ddlCURRICULUM.SelectedValue;
                available_data.Department_Code = curr_data.Department_Code;
                available_data.Major_Code      = curr_data.Major_Code;
            }
            else if (rbt2.Checked)
            {
                available_data.Curr_Code = ddlServiceCURRICULUM.SelectedValue;
            }

            available_data.Status = "0601";

            Session["service_course"] = rbt2.Checked;
            Session["save_data"]      = available_data;

            if (rbt1.Checked)
            {
                if (txtACADEMIC_YEAR.Text.Length != 4)
                {
                    MsgValidate("โปรดระบุ ปีการศึกษาเป็นตัวเลขจำนวน 4 ตัว");
                }
                else if (!uint.TryParse(txtACADEMIC_YEAR.Text, out chknum))
                {
                    MsgValidate("โปรดระบุ ปีการศึกษาเป็นตัวเลขเท่านั้น");
                }
                else if (ddlSEMESTER.SelectedValue == "0")
                {
                    MsgValidate("โปรดระบุ ภาคการศึกษา");
                }
                else if (ddlDEGREE.SelectedValue == "0")
                {
                    MsgValidate("โปรดระบุ ระดับการศึกษา");
                }
                else if (ddlCURRICULUM.SelectedValue == "0")
                {
                    MsgValidate("โปรดระบุ หลักสูตร");
                }
                else
                {
                    Response.Redirect("add_Section2.aspx");
                }
            }
            else if (rbt2.Checked)
            {
                if (txtACADEMIC_YEAR.Text.Length != 4)
                {
                    MsgValidate("โปรดระบุ ปีการศึกษาเป็นตัวเลขจำนวน 4 ตัว");
                }
                else if (!uint.TryParse(txtACADEMIC_YEAR.Text, out chknum))
                {
                    MsgValidate("โปรดระบุ ปีการศึกษาเป็นตัวเลขเท่านั้น");
                }
                else if (ddlSEMESTER.SelectedValue == "0")
                {
                    MsgValidate("โปรดระบุ ภาคการศึกษา");
                }
                else if (ddlDEGREE.SelectedValue == "0")
                {
                    MsgValidate("โปรดระบุ ระดับการศึกษา");
                }
                else if (ddlServiceCURRICULUM.SelectedValue == "0")
                {
                    MsgValidate("โปรดระบุ หลักสูตร");
                }
                else
                {
                    Response.Redirect("add_Section2.aspx");
                }
            }
        }
        catch
        {
            MsgValidate("ไม่สามารถดำเนินการได้");
        }
    }
예제 #12
0
    protected void btnSEARCH_Click(object sender, EventArgs e)
    {
        divShow.Visible = true;

        txtCOURSE_CODE.Text = new utility().removeAllQuotes(txtCOURSE_CODE.Text);

        try
        {
            divShow.Visible = true;
            uint chknum;

            if (txtACADEMIC_YEAR.Text.Length != 4)
            {
                MsgValidate("โปรดระบุ ปีการศึกษาเป็นตัวเลขจำนวน 4 ตัว");
            }
            else if (!uint.TryParse(txtACADEMIC_YEAR.Text, out chknum))
            {
                MsgValidate("โปรดระบุ ปีการศึกษาเป็นตัวเลขเท่านั้น");
            }
            else
            {
                degree_char = ddlDegreeLevel.SelectedValue;
                string   table_struct1 = "";
                string   course_code1  = "";
                Lecturer lecturerObj   = new Lecturer();
                List <TeachingTableData>    teachtable        = new List <TeachingTableData>();
                List <TeachingTableData>    subteachtable     = new List <TeachingTableData>();
                List <AvailableStudentData> available_student = new List <AvailableStudentData>();

                available_data = new AvailableCourse().getAvailableCourse(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, txtCOURSE_CODE.Text, degree_char);

                CourseData course = new CourseData();
                int        loop   = available_data.Count;

                for (int i = 0; i < loop; i++)
                {
                    AvailableCourseData ava_course = available_data[i];

                    course = new Course().getCourse(ava_course.Course_Code);

                    string course_code = ava_course.Course_Code;

                    string course_name   = course.Course_Thainame;
                    string course_credit = course.Credit.ToString();
                    if (course.Course_Type_Code == "1" || course.Course_Type_Code == "2" || course.Course_Type_Code == "6")
                    {
                        course_credit += "(" + course.Theory + "-" + course.Practice + "-" + course.Self_Study + ")";
                    }

                    teachtable    = new TeachingTable().getTeachingTable(ava_course.AcademicYear, ava_course.Semester, ava_course.Course_Code, ava_course.Sec_No, degree_char);
                    subteachtable = new TeachingTable().getSubTeachingTable(ava_course.AcademicYear, ava_course.Semester, ava_course.Course_Code, ava_course.Sec_No, degree_char);


                    if (course_code != course_code1)
                    {
                        course_code1 = course_code;

                        table_struct1 += "<div class='row'>";
                        table_struct1 += "<article class='col-sm-12 col-md-12 col-lg-12'>";
                        table_struct1 += "<div class='jarviswidget jarviswidget-color-primary' id='" + course_code + "' data-widget-editbutton='false' data-widget-deletebutton='false' data-widget-fullscreenbutton='false' data-widget-sortable='false'>";
                        table_struct1 += "<header><span class='widget-icon'><i class='fa fa-table'></i></span><h2>" + course_code + " : " + course_name + " " + course_credit + "</h2></header>";
                        table_struct1 += "<div><div class='widget-body no-padding'><div class='widget-body-toolbar'></div>";
                        table_struct1 += "<table class='table table-bordered table-striped table-hover smart-form'>";
                        table_struct1 += "<thead><tr><th class='text-center' style='width:50px'>ตอนที่</th><th class='text-center' style='width:50px'>วัน</th><th class='text-center' style='width:70px'>เวลา</th><th class='text-center'>ผู้สอน</th><th class='text-center'>ห้องเรียน</th><th class='text-center'>ข้อมูล น.ศ.</th><th class='text-center' style='width:50px'>จำนวน น.ศ.</th></tr></thead>";
                        table_struct1 += "<tbody>";
                    }

                    foreach (TeachingTableData teach_table in teachtable)
                    {
                        available_student = new AvailableStudent().getAvailableStudent(teach_table.AcademicYear, teach_table.Semester, teach_table.Course_Code, teach_table.Sec_No, teach_table.SubSec_No, degree_char);


                        string week_day   = utlObj.getDayOfWeek_Thai(teach_table.Teaching_Day);
                        string teach_time = teach_table.Teaching_Start_Time + " - " + teach_table.Teaching_End_Time;

                        string building_room = new Building().getBuilding(teach_table.Building_Code).Building_ShortName;

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


                        string course_type = "";

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


                        string lec_all = "";
                        List <LecturerTableData> lecturerData = new List <LecturerTableData>();
                        lecturerData = new LecturerTable().getLecturerTable(teach_table, degree_char);
                        foreach (LecturerTableData lect in lecturerData)
                        {
                            lec_all += lecturerObj.getLecturer(lect.Lecturer).Title_ThaiName + " " + lecturerObj.getLecturer(lect.Lecturer).First_ThaiName + " " + lecturerObj.getLecturer(lect.Lecturer).Family_ThaiName + "<br>";
                        }

                        string student_list = "";
                        foreach (AvailableStudentData student in available_student)
                        {
                            if (student.Student_Group_Code != "-")
                            {
                                student_list += student.Curr_Code.Substring(4) + " - " + student.Student_Year + " " + new Section().getSection(student.Section_Code).Section_Short + new StdGroup().getStdGroup(student.Student_Group_Code).StdGroup_Thai + " " + new StdCategory().getStdCategory(student.Student_Category_Code).StdCategory_Thai + "<br/>";
                            }
                            else if (student.Student_Group_Code == "-" && student.Faculty_Code != "-")
                            {
                                student_list += new Faculty().getFaculty(student.Faculty_Code).Faculty_Thai + "<br/>";
                            }
                            else if (student.Student_Group_Code == "-" && student.Curr_Code != "-")
                            {
                                student_list += student.Curr_Code.Substring(4) + " " + new Curriculum().getCurriculum(student.Curr_Code).Curr_ThaiName + "<br/>";
                            }
                        }

                        table_struct1 += "<tr>";
                        table_struct1 += "<td class='text-center'>" + course_type + ava_course.Sec_No.ToString() + "</td>";
                        table_struct1 += "<td class='text-center'>" + week_day + "</td>";
                        table_struct1 += "<td>" + teach_time + "</td>";
                        table_struct1 += "<td>" + lec_all + "</td>";
                        table_struct1 += "<td class='text-center'>" + building_room + "</td>";
                        table_struct1 += "<td class='text-center'>" + student_list + "</td>";
                        table_struct1 += "<td class='text-center'>" + ava_course.Number_Student.ToString() + "</td>";
                        table_struct1 += "</tr>";
                    }

                    // Pratice Extened
                    foreach (TeachingTableData teach_table in subteachtable)
                    {
                        available_student = new AvailableStudent().getAvailableStudent(teach_table.AcademicYear, teach_table.Semester, teach_table.Course_Code, teach_table.Sec_No, teach_table.SubSec_No, degree_char);

                        string week_day   = utlObj.getDayOfWeek_Thai(teach_table.Teaching_Day);
                        string teach_time = teach_table.Teaching_Start_Time + " - " + teach_table.Teaching_End_Time;

                        string building_room = new Building().getBuilding(teach_table.Building_Code).Building_ShortName;

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

                        string course_type = "";

                        if (teach_table.Course_Type == "1")
                        {
                            course_type = "S.";
                        }
                        else if (teach_table.Course_Type == "2")
                        {
                            course_type = "L.";
                        }


                        string lec_all = "";
                        List <LecturerTableData> lecturerData = new List <LecturerTableData>();
                        lecturerData = new LecturerTable().getLecturerTable(teach_table, degree_char);
                        foreach (LecturerTableData lect in lecturerData)
                        {
                            lec_all += lecturerObj.getLecturer(lect.Lecturer).Title_ThaiName + " " + lecturerObj.getLecturer(lect.Lecturer).First_ThaiName + " " + lecturerObj.getLecturer(lect.Lecturer).Family_ThaiName + "<br>";
                        }

                        string student_list = "";
                        foreach (AvailableStudentData student in available_student)
                        {
                            if (student.Student_Group_Code != "-")
                            {
                                student_list += student.Curr_Code.Substring(4) + " - " + student.Student_Year + " " + new Section().getSection(student.Section_Code).Section_Short + new StdGroup().getStdGroup(student.Student_Group_Code).StdGroup_Thai + " " + new StdCategory().getStdCategory(student.Student_Category_Code).StdCategory_Thai + "<br/>";
                            }
                            else if (student.Student_Group_Code == "-" && student.Faculty_Code != "-")
                            {
                                student_list += new Faculty().getFaculty(student.Faculty_Code).Faculty_Thai + "<br/>";
                            }
                            else if (student.Student_Group_Code == "-" && student.Curr_Code != "-")
                            {
                                student_list += student.Curr_Code.Substring(4) + " " + new Curriculum().getCurriculum(student.Curr_Code).Curr_ThaiName + "<br/>";
                            }
                        }

                        table_struct1 += "<tr>";
                        table_struct1 += "<td class='text-center'>" + course_type + teach_table.SubSec_No.ToString() + "</td>";
                        table_struct1 += "<td class='text-center'>" + week_day + "</td>";
                        table_struct1 += "<td>" + teach_time + "</td>";
                        table_struct1 += "<td>" + lec_all + "</td>";
                        table_struct1 += "<td class='text-center'>" + building_room + "</td>";
                        table_struct1 += "<td class='text-center'>" + student_list + "</td>";
                        table_struct1 += "<td class='text-center'>" + teach_table.SubNumber_Student.ToString() + "</td>";
                        table_struct1 += "</tr>";
                    }

                    if (i < (available_data.Count - 1))
                    {
                        if (available_data[i + 1].Course_Code != course_code)
                        {
                            table_struct1 += "</tbody>";
                            table_struct1 += "</table></div></div></div></article></div>";
                        }
                    }
                    else
                    {
                        table_struct1 += "</tbody>";
                        table_struct1 += "</table></div></div></div></article></div>";
                    }
                }

                LiteralControl div_row = new LiteralControl(table_struct1);
                panelListAvailableCourse.Controls.Add(div_row);
            }
        }
        catch
        {
            divShow.Visible = false;
            divFail.Visible = true;
        }
    }
예제 #13
0
    protected string createTableStruct()
    {
        degree_char = ddlDegreeLevel.SelectedValue;
        string table_struct = "";
        string course_code1 = "";

        List <AvailableStudentData> available_student = new List <AvailableStudentData>();
        List <TeachingTableData>    teachtable        = new List <TeachingTableData>();
        List <TeachingTableData>    subteachtable     = new List <TeachingTableData>();

        available_data = new AvailableCourse().getAvailableCourse(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, txtCOURSE_CODE.Text, degree_char);

        CourseData course = new CourseData();
        int        loop   = available_data.Count;

        table_struct += "<table><tr><td colspan='17' style='font-family:Tahoma;font-size:large;text-align:center;vertical-align:middle;height:2cm;border:none;' >";
        table_struct += "รายวิชาที่เปิดสอน " + available_data[0].Semester + "/" + available_data[0].AcademicYear + "";
        table_struct += "</td></tr></table>";

        for (int i = 0; i < loop; i++)
        {
            AvailableCourseData ava_course = available_data[i];

            course = new Course().getCourse(ava_course.Course_Code);

            string course_code = ava_course.Course_Code;

            string course_name   = course.Course_Thainame;
            string course_credit = course.Credit.ToString();
            if (course.Course_Type_Code == "1" || course.Course_Type_Code == "2" || course.Course_Type_Code == "6")
            {
                course_credit += "(" + course.Theory + "-" + course.Practice + "-" + course.Self_Study + ")";
            }

            teachtable    = new TeachingTable().getTeachingTable(ava_course.AcademicYear, ava_course.Semester, ava_course.Course_Code, ava_course.Sec_No, degree_char);
            subteachtable = new TeachingTable().getSubTeachingTable(ava_course.AcademicYear, ava_course.Semester, ava_course.Course_Code, ava_course.Sec_No, degree_char);


            if (course_code != course_code1)
            {
                course_code1 = course_code;

                //table_struct += "<div class='row'>";
                //table_struct += "<article class='col-sm-12 col-md-12 col-lg-12'>";
                //table_struct += "<div class='jarviswidget jarviswidget-color-primary' id='" + course_code + "' data-widget-editbutton='false' data-widget-deletebutton='false' data-widget-fullscreenbutton='false' data-widget-sortable='false'>";
                //table_struct += "<header><span class='widget-icon'><i class='fa fa-table'></i></span><h2>" + course_code + " : " + course_name + " " + course_credit + "</h2></header>";
                //table_struct += "<div><div class='widget-body no-padding'><div class='widget-body-toolbar'></div>";

                table_struct += "<table>";
                table_struct += "<thead>";
                table_struct += "<tr><th colspan='17' style='font-family:Tahoma;font-size:medium;text-align:left;vertical-align:middle;height:1cm;border:none;'>" + course_code + " : " + course_name + " " + course_credit + "</th></tr>";
                table_struct += "<tr style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;border:none;height:1cm' ><th>ตอนที่</th><th colspan='2'>วัน</th><th colspan='2'>เวลา</th><th colspan='4'>ผู้สอน</th><th colspan='2'>ห้องเรียน</th><th colspan='4'>ข้อมูล น.ศ.</th><th colspan='2'>จำนวน น.ศ.</th></tr>";
                table_struct += "</thead>";
                table_struct += "<tbody>";
            }

            foreach (TeachingTableData teach_table in teachtable)
            {
                available_student = new AvailableStudent().getAvailableStudent(teach_table.AcademicYear, teach_table.Semester, teach_table.Course_Code, teach_table.Sec_No, teach_table.SubSec_No, degree_char);


                string week_day   = utlObj.getDayOfWeek_Thai(teach_table.Teaching_Day);
                string teach_time = teach_table.Teaching_Start_Time + " - " + teach_table.Teaching_End_Time;

                string building_room = new Building().getBuilding(teach_table.Building_Code).Building_ShortName;

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


                string course_type = "";

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


                string lec_all = "";
                List <LecturerTableData> lecturerData = new List <LecturerTableData>();
                lecturerData = new LecturerTable().getLecturerTable(teach_table, degree_char);
                foreach (LecturerTableData lect in lecturerData)
                {
                    lec_all += lecturerObj.getLecturer(lect.Lecturer).Title_ThaiName + " " + lecturerObj.getLecturer(lect.Lecturer).First_ThaiName + " " + lecturerObj.getLecturer(lect.Lecturer).Family_ThaiName + "<br/>";
                }

                string a1 = lec_all.Substring(lec_all.Length - 5);

                if (a1 == "<br/>")
                {
                    lec_all = lec_all.Remove(lec_all.Length - 5);
                }

                string student_list = "";
                foreach (AvailableStudentData student in available_student)
                {
                    if (student.Student_Group_Code != "-")
                    {
                        student_list += student.Curr_Code.Substring(4) + " - " + student.Student_Year + " " + new Section().getSection(student.Section_Code).Section_Short + new StdGroup().getStdGroup(student.Student_Group_Code).StdGroup_Thai + " " + new StdCategory().getStdCategory(student.Student_Category_Code).StdCategory_Thai + "<br/>";
                    }
                    else if (student.Student_Group_Code == "-" && student.Faculty_Code != "-")
                    {
                        student_list += new Faculty().getFaculty(student.Faculty_Code).Faculty_Thai + "<br/>";
                    }
                    else if (student.Student_Group_Code == "-" && student.Curr_Code != "-")
                    {
                        student_list += student.Curr_Code.Substring(4) + " " + new Curriculum().getCurriculum(student.Curr_Code).Curr_ThaiName + "<br/>";
                    }
                }

                string a2 = student_list.Substring(student_list.Length - 5);

                if (a2 == "<br/>")
                {
                    student_list = student_list.Remove(student_list.Length - 5);
                }


                table_struct += "<tr>";
                table_struct += "<td style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:2cm;border:none;' >" + course_type + ava_course.Sec_No.ToString() + "</td>";
                table_struct += "<td colspan='2' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:2cm;border:none;' >" + week_day + "</td>";
                table_struct += "<td colspan='2' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:2cm;border:none;' >" + teach_time + "</td>";
                table_struct += "<td colspan='4' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:2cm;border:none;' >" + lec_all + "</td>";
                table_struct += "<td colspan='2' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:2cm;border:none;' >" + building_room + "</td>";

                table_struct += "<td colspan='4' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:2cm;border:none;IsTextWrapped:true' >" + student_list + "</td>";


                table_struct += "<td colspan='2' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:2cm;border:none;' >" + ava_course.Number_Student.ToString() + "</td>";
                table_struct += "</tr>";
            }

            // Pratice Extened
            foreach (TeachingTableData teach_table in subteachtable)
            {
                available_student = new AvailableStudent().getAvailableStudent(teach_table.AcademicYear, teach_table.Semester, teach_table.Course_Code, teach_table.Sec_No, teach_table.SubSec_No, degree_char);

                string week_day   = utlObj.getDayOfWeek_Thai(teach_table.Teaching_Day);
                string teach_time = teach_table.Teaching_Start_Time + " - " + teach_table.Teaching_End_Time;

                string building_room = new Building().getBuilding(teach_table.Building_Code).Building_ShortName;

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

                string course_type = "";

                if (teach_table.Course_Type == "1")
                {
                    course_type = "S.";
                }
                else if (teach_table.Course_Type == "2")
                {
                    course_type = "L.";
                }


                string lec_all = "";
                List <LecturerTableData> lecturerData = new List <LecturerTableData>();
                lecturerData = new LecturerTable().getLecturerTable(teach_table, degree_char);
                foreach (LecturerTableData lect in lecturerData)
                {
                    lec_all += lecturerObj.getLecturer(lect.Lecturer).Title_ThaiName + " " + lecturerObj.getLecturer(lect.Lecturer).First_ThaiName + " " + lecturerObj.getLecturer(lect.Lecturer).Family_ThaiName + "<br/>";
                }

                string a3 = lec_all.Substring(lec_all.Length - 5);

                if (a3 == "<br/>")
                {
                    lec_all = lec_all.Remove(lec_all.Length - 5);
                }

                string student_list = "";
                foreach (AvailableStudentData student in available_student)
                {
                    if (student.Student_Group_Code != "-")
                    {
                        student_list += student.Curr_Code.Substring(4) + " - " + student.Student_Year + " " + new Section().getSection(student.Section_Code).Section_Short + new StdGroup().getStdGroup(student.Student_Group_Code).StdGroup_Thai + " " + new StdCategory().getStdCategory(student.Student_Category_Code).StdCategory_Thai + "<br/>";
                    }
                    else if (student.Student_Group_Code == "-" && student.Faculty_Code != "-")
                    {
                        student_list += new Faculty().getFaculty(student.Faculty_Code).Faculty_Thai + "<br/>";
                    }
                    else if (student.Student_Group_Code == "-" && student.Curr_Code != "-")
                    {
                        student_list += student.Curr_Code.Substring(4) + " " + new Curriculum().getCurriculum(student.Curr_Code).Curr_ThaiName + "<br/>";
                    }
                }

                string a4 = student_list.Substring(student_list.Length - 5);

                if (a4 == "<br/>")
                {
                    student_list = student_list.Remove(student_list.Length - 5);
                }

                table_struct += "<tr>";
                table_struct += "<td style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:2cm;border:none;'>" + course_type + teach_table.SubSec_No.ToString() + "</td>";
                table_struct += "<td colspan='2' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:2cm;border:none;'>" + week_day + "</td>";
                table_struct += "<td colspan='2' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:2cm;border:none;'>" + teach_time + "</td>";
                table_struct += "<td colspan='4' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:2cm;border:none;'>" + lec_all + "</td>";
                table_struct += "<td colspan='2' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:2cm;border:none;'>" + building_room + "</td>";
                table_struct += "<td colspan='4' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:2cm;border:none;'>" + student_list + "</td>";
                table_struct += "<td colspan='2' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:2cm;border:none;'>" + teach_table.SubNumber_Student.ToString() + "</td>";
                table_struct += "</tr>";
            }

            table_struct += "<tr><td style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:1cm;border:none;'>&nbsp</td></tr>";

            if (i < (available_data.Count - 1))
            {
                if (available_data[i + 1].Course_Code != course_code)
                {
                    table_struct += "</tbody>";
                    table_struct += "</table>";
                    //</div></div></div></article></div>";
                }
            }
            else
            {
                table_struct += "</tbody>";
                table_struct += "</table>";
                //table_struct += "</div></div></div></article></div>";
            }
        }

        return(table_struct);
    }