public List <TeachingTableData> checkStudent2(TeachingTableData new_teachtable, List <AvailableStudentData> stu_data, TeachingTableData old_teachtable, string degree_char) { List <TeachingTableData> db_studenttime = new List <TeachingTableData>(); List <TeachingTableData> db_studenttime_1 = new TeachingTable().checkAllDupStudentTime(new_teachtable, stu_data, degree_char); if (db_studenttime_1 == null) { db_studenttime = null; } else { foreach (TeachingTableData dup in db_studenttime_1) { if (dup.Course_Code != old_teachtable.Course_Code) { db_studenttime.Add(dup); } else if (dup.Course_Code == old_teachtable.Course_Code && dup.Sec_No != old_teachtable.Sec_No) { db_studenttime.Add(dup); } else if (dup.Course_Code == old_teachtable.Course_Code && dup.Sec_No == old_teachtable.Sec_No && dup.SubSec_No != old_teachtable.SubSec_No) { db_studenttime.Add(dup); } } if (db_studenttime.Count == 0) { db_studenttime = null; } } return(db_studenttime); }
public List <TeachingTableData> checkSubRoom(TeachingTableData new_teachtable, TeachingTableData old_teachtable, string degree_char) { List <TeachingTableData> db_subroom = new List <TeachingTableData>(); List <TeachingTableData> db_subroom_1 = new TeachingTable().checkAllSubRoom(new_teachtable, degree_char); if (db_subroom_1 == null) { db_subroom = null; } else { foreach (TeachingTableData dup in db_subroom_1) { if (dup.Course_Code != old_teachtable.Course_Code) { db_subroom.Add(dup); } else if (dup.Course_Code == old_teachtable.Course_Code && dup.Sec_No != old_teachtable.Sec_No) { db_subroom.Add(dup); } else if (dup.Course_Code == old_teachtable.Course_Code && dup.Sec_No == old_teachtable.Sec_No && dup.SubSec_No != old_teachtable.SubSec_No) { db_subroom.Add(dup); } } if (db_subroom.Count == 0) { db_subroom = null; } } return(db_subroom); }
protected void onclick_section_finish(object sender, EventArgs e) { try { bool check = (bool)Session["isOK"]; if (check) { result.Text = new AvailableCourse().updateAvailableCourse(available_data, old_available_data, degree_char); string[] res = new AvailableStudent().updateAvailableStudent(available_student, old_available_student, degree_char); string[] res2 = new TeachingTable().updateTeachingTable(teachtable, old_teaching, degree_char); string[] res3 = new LecturerTable().updateLecturerTable(lecturertable, old_lecturer, degree_char); string[] res4 = new SubCredit().updateSubCredit(subcreditData, degree_char); divBody.Visible = false; divSuccess.Visible = true; } else { float totalCredit = 0; CourseData course_data = new Course().getCourse(available_data.Course_Code); int credit = course_data.Credit; if (lecturertable[0].Course_Type == "1") { if (course_data.Practice != 0) { credit = course_data.Theory; } else { credit = course_data.Credit; } } else if (lecturertable[0].Course_Type == "2") { if (course_data.Theory != 0) { credit = course_data.Practice / 2; } else { credit = course_data.Credit; } } string credit_err = ""; foreach (SubCreditData subcredit in subcreditData) { totalCredit += subcredit.SubCredit; float remain_credit = new WorkLoadCalculate().checkEditLecturerCredit2(subcredit.AcademicYear, subcredit.Semester, subcredit.Lecturer, subcredit.SubCredit, subcredit); if (remain_credit != -1) { credit_err += subcredit.Lecturer + "," + remain_credit; break; } } if (credit_err.Length > 0) { string[] arr = credit_err.Split(','); lblSubDreditErr.Visible = true; LectuereInformationData lec = new LectuereInformationData(); lec = new Lecturer().getLecturer(arr[0]); lblSubDreditErr.Text = "อาจารย์ " + lec.First_ThaiName + " " + lec.Family_ThaiName + " ไม่สามารถสอนได้เกิน " + arr[1] + " เครดิต"; btnSubmit.Focus(); } else if (totalCredit != credit) { lblSubDreditErr.Visible = true; lblSubDreditErr.Text = "จำนวนหน่วยกิตรวมต้องเท่ากับ " + credit; btnSubmit.Focus(); } else { result.Text = new AvailableCourse().updateAvailableCourse(available_data, old_available_data, degree_char); string[] res = new AvailableStudent().updateAvailableStudent(available_student, old_available_student, degree_char); string[] res2 = new TeachingTable().updateTeachingTable(teachtable, old_teaching, degree_char); string[] res3 = new LecturerTable().updateLecturerTable(lecturertable, old_lecturer, degree_char); string[] res4 = new SubCredit().updateSubCredit(subcreditData, degree_char); divBody.Visible = false; divSuccess.Visible = true; } } } catch { divFail.Visible = true; } }
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("ตรวจสอบไม่พบ นักศึกษาที่ค้นหา"); } } }
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; } }
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;'> </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); }
protected void btnOK_Click(object sender, EventArgs e) { try { string response1 = "", response2 = "", response3 = "", response4 = ""; row_delete = Request.QueryString["row"]; degree_char = Request.QueryString["degree_char"]; delete_teach_data = (TeachingTableData)Session["delete_teachtable" + row_delete]; delete_lecturer_data.AcademicYear = delete_teach_data.AcademicYear; delete_lecturer_data.Semester = delete_teach_data.Semester; delete_lecturer_data.Course_Code = delete_teach_data.Course_Code; delete_lecturer_data.Sec_No = delete_teach_data.Sec_No; delete_lecturer_data.SubSec_No = delete_teach_data.SubSec_No; delete_lecturer_data.Room_Code = delete_teach_data.Room_Code; delete_lecturer_data.Building_Code = delete_teach_data.Building_Code; delete_lecturer_data.Campus_Code = delete_teach_data.Campus_Code; delete_lecturer_data.Teaching_Day = delete_teach_data.Teaching_Day; delete_lecturer_data.Teaching_Start_Time = delete_teach_data.Teaching_Start_Time; delete_lecturer_data.Teaching_End_Time = delete_teach_data.Teaching_End_Time; delete_student_data.AcademicYear = delete_teach_data.AcademicYear; delete_student_data.Semester = delete_teach_data.Semester; delete_student_data.Course_Code = delete_teach_data.Course_Code; delete_student_data.Sec_No = delete_teach_data.Sec_No; delete_student_data.SubSec_No = delete_teach_data.SubSec_No; delete_availableCourse_data.AcademicYear = delete_teach_data.AcademicYear; delete_availableCourse_data.Semester = delete_teach_data.Semester; delete_availableCourse_data.Course_Code = delete_teach_data.Course_Code; delete_availableCourse_data.Sec_No = delete_teach_data.Sec_No; if (delete_teach_data.Course_Type == "1") { if (new TeachingTable().checkBeforeDelTeachTable(delete_teach_data, degree_char) == true) { response1 = new TeachingTable().deleteTeachingTable(delete_teach_data, degree_char); } } else { response1 = new TeachingTable().deleteTeachingTable(delete_teach_data, degree_char); } if (response1 == "OK") { response2 = new LecturerTable().deleteLecturerTable(delete_lecturer_data, degree_char); } if (response2 == "OK") { new SubCredit().deleteSubCredit2(delete_lecturer_data.AcademicYear, delete_lecturer_data.Semester, delete_lecturer_data.Course_Code, delete_lecturer_data.Sec_No, delete_lecturer_data.SubSec_No, delete_lecturer_data.Teaching_Day, delete_lecturer_data.Teaching_Start_Time, delete_lecturer_data.Teaching_End_Time, degree_char); } if (new TeachingTable().checkBeforeDelStudent(delete_teach_data, degree_char) == true && response1 == "OK" && response2 == "OK") { response3 = new AvailableStudent().deleteAvailableStudent(delete_student_data, degree_char); } else { response3 = "OK"; } if (new TeachingTable().checkBeforeDelAviCourse(delete_teach_data, degree_char) == true && response1 == "OK" && response2 == "OK" && response3 == "OK") { response4 = new AvailableCourse().deleteAvailableCourse(delete_availableCourse_data, degree_char); } else { response4 = "OK"; } if ((response1 == "OK") && (response2 == "OK") && (response3 == "OK") && (response4 == "OK")) { Response.Redirect("list_Section.aspx"); } else { //lblResult.Text = "teach=" + response1 + " lecturer=" + response2 + " student=" + response3 + " avaliable=" + response4 + "aa" + new TeachingTable().checkBeforeDelTeachTable(delete_teach_data, degree_char); Response.Redirect("list_Section.aspx"); } } catch { Response.Redirect("list_Section.aspx"); } }