Ejemplo n.º 1
0
    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;
            }
        }
    }
Ejemplo n.º 2
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        string result = "-";

        result = new ExtendAvailableStudent().cancelExtendStudent(academic_year, semester, course_code, Convert.ToInt16(sec_num), Convert.ToInt16(subsec_num), student_id, lecturer_code);

        if (result == "OK")
        {
            divDelete.Visible  = false;
            divSuccess.Visible = true;
            divError.Visible   = false;
        }
        else
        {
            divDelete.Visible  = false;
            divSuccess.Visible = false;
            divError.Visible   = true;
        }
    }
Ejemplo n.º 3
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("ตรวจสอบไม่พบ นักศึกษาที่ค้นหา");
            }
        }
    }