// V 1.0.0 public string updateExamTable(ExamTableData dataUpdate, string degree_char) { string TableName = getTableName(degree_char); string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Update " + TableName + " Set EXAM_MID_ROOM='" + dataUpdate.ExamMid_Room + "',EXAM_MID_DAY='" + dataUpdate.ExamMid_Day + "',EXAM_MID_START_TIME='" + dataUpdate.ExamMid_StartTime + "',EXAM_MID_END_TIME='" + dataUpdate.ExamMid_EndTime + "',EXAM_FINAL_ROOM='" + dataUpdate.ExamFinal_Room + "',EXAM_FINAL_DAY='" + dataUpdate.ExamFinal_Day + "',EXAM_FINAL_START_TIME='" + dataUpdate.ExamFinal_StartTime + "',EXAM_FINAL_END_TIME='" + dataUpdate.ExamFinal_EndTime + "' Where ACADEMIC_YEAR='" + dataUpdate.AcademicYear + "' And SEMESTER='" + dataUpdate.Semester + "' And COURSE_CODE='" + dataUpdate.Course_Code + "' AND CURR_CODE='" + dataUpdate.Curr_Code + "' AND FAC_CODE='" + dataUpdate.Faculty_Code + "' AND DEP_CODE='" + dataUpdate.Department_Code + "'"; oracleObj.UpdateCommand = sql; try { if (oracleObj.Update() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString() + sql; } return(response); }
// V 1.0.0 public string insertExamTable(ExamTableData dataInsert, string degree_char) { string TableName = getTableName(degree_char); string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Insert Into " + TableName + " (ACADEMIC_YEAR,SEMESTER,COURSE_CODE,EXAM_TYPE,EXAM_MID_ROOM,EXAM_MID_DAY,EXAM_MID_START_TIME,EXAM_MID_END_TIME,EXAM_FINAL_ROOM,EXAM_FINAL_DAY,EXAM_FINAL_START_TIME,EXAM_FINAL_END_TIME,CURR_CODE,FAC_CODE,DEP_CODE) Values('" + dataInsert.AcademicYear + "','" + dataInsert.Semester + "','" + dataInsert.Course_Code + "','" + dataInsert.Exam_Type + "','" + dataInsert.ExamMid_Room + "','" + dataInsert.ExamMid_Day + "','" + dataInsert.ExamMid_StartTime + "','" + dataInsert.ExamMid_EndTime + "','" + dataInsert.ExamFinal_Room + "','" + dataInsert.ExamFinal_Day + "','" + dataInsert.ExamFinal_StartTime + "','" + dataInsert.ExamFinal_EndTime + "','" + dataInsert.Curr_Code + "','" + dataInsert.Faculty_Code + "','" + dataInsert.Department_Code + "' )"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); } return(response); }
// V 1.0.0 //public ExamTableData getExamTable(string academic_year, string semester, string course_code, int sec_no, int subsec_no, string degree_char) //{ // ExamTableData exam_data = new ExamTableData(); // string TableName = getTableName(degree_char); // string sql = ""; // ConnectDB db = new ConnectDB(); // SqlDataSource oracleObj = db.ConnectionOracle(); // sql = "Select * From " + TableName + " Where ACADEMIC_YEAR='" + academic_year + "' And SEMESTER='" + semester + "' And COURSE_CODE='" + course_code + "' And SEC_NO=" + sec_no + " And SUBSEC_NO=" + subsec_no; // oracleObj.SelectCommand = sql; // DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); // foreach (DataRowView rowData in allData) // { // exam_data.AcademicYear = rowData["ACADEMIC_YEAR"].ToString(); // exam_data.Semester = rowData["SEMESTER"].ToString(); // exam_data.Course_Code = rowData["COURSE_CODE"].ToString(); // exam_data.Sec_No = Convert.ToInt16(rowData["SEC_NO"].ToString()); // exam_data.SubSec_No = Convert.ToInt16(rowData["SUBSEC_NO"].ToString()); // exam_data.Exam_Type = rowData["EXAM_TYPE"].ToString(); // exam_data.ExamMid_Room = rowData["EXAM_MID_ROOM"].ToString(); // exam_data.ExamMid_Day = rowData["EXAM_MID_DAY"].ToString(); // exam_data.ExamMid_StartTime = rowData["EXAM_MID_START_TIME"].ToString(); // exam_data.ExamMid_EndTime = rowData["EXAM_MID_END_TIME"].ToString(); // exam_data.ExamFinal_Room = rowData["EXAM_FINAL_ROOM"].ToString(); // exam_data.ExamFinal_Day = rowData["EXAM_FINAL_DAY"].ToString(); // exam_data.ExamFinal_StartTime = rowData["EXAM_FINAL_START_TIME"].ToString(); // exam_data.ExamFinal_EndTime = rowData["EXAM_FINAL_END_TIME"].ToString(); // } // return exam_data; //} // V 1.0.0 public ExamTableData getExamTable(string academic_year, string semester, string course_code, string faculty_code, string department_code, string curr_code, string degree_char) { ExamTableData exam_data = new ExamTableData(); string TableName = getTableName(degree_char); string sql = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); sql = "Select * From " + TableName + " Where ACADEMIC_YEAR='" + academic_year + "' And SEMESTER='" + semester + "' And COURSE_CODE='" + course_code + "' AND FAC_CODE='" + faculty_code + "' AND DEP_CODE='" + department_code + "' AND CURR_CODE='" + curr_code + "'"; oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { exam_data.AcademicYear = rowData["ACADEMIC_YEAR"].ToString(); exam_data.Semester = rowData["SEMESTER"].ToString(); exam_data.Course_Code = rowData["COURSE_CODE"].ToString(); // exam_data.Sec_No = Convert.ToInt16(rowData["SEC_NO"].ToString()); // exam_data.SubSec_No = Convert.ToInt16(rowData["SUBSEC_NO"].ToString()); // exam_data.Exam_Type = rowData["EXAM_TYPE"].ToString(); exam_data.ExamMid_Room = rowData["EXAM_MID_ROOM"].ToString(); exam_data.ExamMid_Day = rowData["EXAM_MID_DAY"].ToString(); exam_data.ExamMid_StartTime = rowData["EXAM_MID_START_TIME"].ToString(); exam_data.ExamMid_EndTime = rowData["EXAM_MID_END_TIME"].ToString(); exam_data.ExamFinal_Room = rowData["EXAM_FINAL_ROOM"].ToString(); exam_data.ExamFinal_Day = rowData["EXAM_FINAL_DAY"].ToString(); exam_data.ExamFinal_StartTime = rowData["EXAM_FINAL_START_TIME"].ToString(); exam_data.ExamFinal_EndTime = rowData["EXAM_FINAL_END_TIME"].ToString(); exam_data.Curr_Code = rowData["CURR_CODE"].ToString(); exam_data.Faculty_Code = rowData["FAC_CODE"].ToString(); exam_data.Department_Code = rowData["DEP_CODE"].ToString(); } return(exam_data); }
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) || autro_obj.CheckGroupUser(login_data, group_var.board_reg_sta) || autro_obj.CheckGroupUser(login_data, group_var.officer_reg_sta)) { divShow.Visible = false; divSuccess.Visible = false; divFail.Visible = false; divFail2.Visible = false; try { divShow.Visible = true; academic_year = Request.QueryString["year"]; semester = Request.QueryString["sem"]; course_code = Request.QueryString["course"]; curr_code = Request.QueryString["curr_code"]; fac_code = Request.QueryString["fac_code"]; dep_code = Request.QueryString["dep_code"]; degree_char = Request.QueryString["degree_char"]; //course_type = ""; //if (Request.QueryString["type"] == "S") //{ // course_type = "1"; //} //else if (Request.QueryString["type"] == "L") //{ // course_type = "2"; //} //else if (Request.QueryString["type"] == "T") //{ // course_type = "4"; //} //else if (Request.QueryString["type"] == "M") //{ // course_type = "5"; //} //else if (Request.QueryString["type"] == "SP") //{ // course_type = "6"; //} //else if (Request.QueryString["type"] == "D") //{ // course_type = "7"; //} //sec_num = Convert.ToInt16(Request.QueryString["sec"]); //subsec_num = Convert.ToInt16(Request.QueryString["subsec"]); //getAvailableCourse(string academic_year, string semester, string faculty_code, string department_code, string curr_code, string course_code, string degree_char) available_data = new AvailableCourse().getAvailableCourse(academic_year, semester, fac_code, dep_code, curr_code, course_code, degree_char); // ตรวจสอบกำหนดการ config_data1 = new TeachExamConfig().getTeachExamConfig(); config_data2 = new TeachExamConfig().getExtendTeachExamConfig(available_data[0].Department_Code); int diffDate = -1; int diffExtDate = -1; if (config_data1.Date_Stop != null) { diffDate = utlObj.getDiffDate(config_data1.Date_Stop, utlObj.getToday()); } if (config_data2.Date_Stop != null) { diffExtDate = utlObj.getDiffDate(config_data2.Date_Stop, utlObj.getToday()); } // งานทะเบียน บัญฑิต if (autro_obj.CheckGroupUser(login_data, group_var.board_reg_sta) || autro_obj.CheckGroupUser(login_data, group_var.officer_reg_sta)) { } // วิชาการ คณะ else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty)) { int i = 0; List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty); foreach (string fac in faculty_authorized) { if (available_data[0].Faculty_Code == fac) { i++; break; } } if (i == 0) { MsgValidate("ไม่มีสิทธิ์ในการแก้ไขข้อมูล"); btnSAVE.Enabled = false; } else if (diffDate < 0 && diffExtDate < 0) { MsgValidate("เกินกำหนดระยะเวลาแก้ไขข้อมูล"); btnSAVE.Enabled = false; } } // วิชาการภาค else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { int i = 0; List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department); foreach (string dep in department_authorized) { if (available_data[0].Department_Code == dep) { i++; break; } } if (i == 0) { MsgValidate("ไม่มีสิทธิ์ในการแก้ไขข้อมูล"); btnSAVE.Enabled = false; } else if (diffDate < 0 && diffExtDate < 0) { MsgValidate("เกินกำหนดระยะเวลาแก้ไขข้อมูล"); btnSAVE.Enabled = false; } } exam_data = examObj.getExamTable(available_data[0].AcademicYear, available_data[0].Semester, available_data[0].Course_Code, available_data[0].Faculty_Code, available_data[0].Department_Code, available_data[0].Curr_Code, degree_char); if (exam_data.Course_Code != null) { if (!IsPostBack) { txtMIDEXAM_DAY.Text = exam_data.ExamMid_Day; txtMIDTERM_START_TIME.Text = exam_data.ExamMid_StartTime; txtMIDTERM_END_TIME.Text = exam_data.ExamMid_EndTime; txtFINALEXAM_DAY.Text = exam_data.ExamFinal_Day; txtFINAL_START_TIME.Text = exam_data.ExamFinal_StartTime; txtFINAL_END_TIME.Text = exam_data.ExamFinal_EndTime; } save = false; btnSAVE.Text = "Update"; } else { save = true; btnSAVE.Text = "Save"; } lblSemesterYear.Text = semester + "/" + academic_year; CourseData course_data = new CourseData(); course_data = new Course().getCourse(available_data[0].Course_Code); lblCourse.Text = available_data[0].Course_Code + ":" + course_data.Course_Engname + ", " + course_data.Credit + "(" + course_data.Theory + "-" + course_data.Practice + "-" + course_data.Self_Study + ")"; //if (course_type == "1") //{ // lblSec.Text = "S." + sec_num; //} //else if (course_type == "2") //{ // if (subsec_num != 0) // { // lblSec.Text = "L." + subsec_num; // } // else // { // lblSec.Text = "L." + sec_num; // } //} //else if (course_type == "4") //{ // lblSec.Text = "T." + sec_num; //} //else if (course_type == "5") //{ // lblSec.Text = "M." + sec_num; //} //else if (course_type == "6") //{ // lblSec.Text = "SP." + sec_num; //} //else if (course_type == "7") //{ // lblSec.Text = "D." + sec_num; //} } catch { divFail.Visible = true; } } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }
protected void btnEXCEL_Click(object sender, EventArgs e) { divShow.Visible = true; degree_char = new Curriculum().getCurriculum(ddlCURRICULUM.SelectedValue).Degree_Char; List <AvailableCourseData> excelData = new List <AvailableCourseData>(); excelData = (List <AvailableCourseData>)Session["excel_data"]; // Head Table //string[] ar = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "กลางภาค", "ปลายภาค" }; //Table tb1 = new Table(); //tb1.Attributes.Add("class", "table table-bordered table-striped table-hover smart-form"); //tb1.Attributes.Add("id", "dt_exam"); //TableHeaderRow tRowHead = new TableHeaderRow(); //tRowHead.TableSection = TableRowSection.TableHeader; //tRowHead.Attributes.Add("style", "border:solid thin;height:30px;background-color:#e5e2e2"); //for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++) //{ // // Create a new cell and add it to the row. // TableHeaderCell cellHead = new TableHeaderCell(); // cellHead.Text = ar[cellCtr - 1]; // tRowHead.Cells.Add(cellHead); //} //tb1.Rows.Add(tRowHead); string table_struct = ""; table_struct += "<table>"; table_struct += "<tr><td colspan='17' style='font-family:Tahoma;font-size:large;text-align:center;vertical-align:middle;height:1cm;border:none;' >"; table_struct += "ตารางสอบ ภาคการศึกษาที่ " + excelData[0].Semester + "/" + excelData[0].AcademicYear; table_struct += "</td></tr>"; table_struct += "<tr><td colspan='17' style='font-family:Tahoma;font-size:large;text-align:center;vertical-align:middle;height:1cm;border:none;' >"; table_struct += ddlFACULTY.SelectedItem.Text; table_struct += "</td></tr>"; table_struct += "<tr><td colspan='17' style='font-family:Tahoma;font-size:large;text-align:center;vertical-align:middle;height:1cm;border:none;' >"; table_struct += ddlCURRICULUM.SelectedItem.Text; table_struct += "</td></tr>"; table_struct += "<tr><td colspan='17' style='font-family:Tahoma;font-size:large;text-align:center;vertical-align:middle;height:1cm;border:none;' > </td></tr>"; table_struct += "</table>"; table_struct += "<table>"; table_struct += "<thead>"; table_struct += "<tr style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;border:solid thin;height:1cm' ><th colspan='2'>รหัสวิชา</th><th colspan='5'>ชื่อวิชา</th><th colspan='2'>หน่วยกิต</th><th colspan='4'>กลางภาค</th><th colspan='4'>ปลายภาค</th></tr>"; table_struct += "</thead>"; table_struct += "<tbody>"; foreach (AvailableCourseData exam_data in excelData) { course_data = courseObj.getCourse(exam_data.Course_Code); string credit = course_data.Credit + "(" + course_data.Theory + "-" + course_data.Practice + "-" + course_data.Self_Study + ")"; table_data = new ExamTable().getExamTable(exam_data.AcademicYear, exam_data.Semester, exam_data.Course_Code, exam_data.Faculty_Code, exam_data.Department_Code, exam_data.Curr_Code, degree_char); string mid_exam_time = ""; string final_exam_time = ""; if (table_data.Course_Code != null) { mid_exam_time = new utility().getThaiBirthDay(table_data.ExamMid_Day) + " เวลา:" + table_data.ExamMid_StartTime + "-" + table_data.ExamMid_EndTime; final_exam_time = new utility().getThaiBirthDay(table_data.ExamFinal_Day) + " เวลา:" + table_data.ExamFinal_StartTime + "-" + table_data.ExamFinal_EndTime; } table_struct += "<tr>"; table_struct += "<td colspan='2' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:1cm;border:solid thin;' >" + exam_data.Course_Code + "</td>"; table_struct += "<td colspan='5' style='font-family:Tahoma;font-size:medium;text-align:left;vertical-align:middle;width: 100px;height:1cm;border:solid thin;' >" + course_data.Course_Engname + "</td>"; table_struct += "<td colspan='2' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:1cm;border:solid thin;' >" + credit + "</td>"; table_struct += "<td colspan='4' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:1cm;border:solid thin;' >" + mid_exam_time + "</td>"; table_struct += "<td colspan='4' style='font-family:Tahoma;font-size:medium;text-align:center;vertical-align:middle;width: 100px;height:1cm;border:solid thin;' >" + final_exam_time + "</td>"; //TableRow tRowBody = new TableRow(); //tRowBody.TableSection = TableRowSection.TableBody; //tRowBody.Attributes.Add("style", "text-align:center;border:solid thin;height:30px;"); //TableCell cellCourse_Code = new TableCell(); //cellCourse_Code.Text = exam_data.Course_Code; //tRowBody.Cells.Add(cellCourse_Code); //TableCell cellCourse_Name = new TableCell(); //cellCourse_Name.Text = course_data.Course_Engname; //tRowBody.Cells.Add(cellCourse_Name); //TableCell cellCredit = new TableCell(); //cellCredit.Text = credit; //tRowBody.Cells.Add(cellCredit); //TableCell cellMidTerm = new TableCell(); //cellMidTerm.Text = mid_exam_time; //tRowBody.Cells.Add(cellMidTerm); //TableCell cellFinal = new TableCell(); //cellFinal.Text = final_exam_time; //tRowBody.Cells.Add(cellFinal); //tb1.Rows.Add(tRowBody); } table_struct += "</tbody>"; table_struct += "</table>"; //TableRow row = new TableRow(); //TableCell cell = new TableCell(); //cell.Controls.Add(tb1); //row.Cells.Add(cell); //tblExam.Rows.Add(row); //Export to Excel string fileName = "ตารางสอบ " + new Curriculum().getCurriculum(ddlCURRICULUM.SelectedValue).Curr_ThaiName; utility utname = new utility(); Response.ClearContent(); Response.AddHeader("content-disposition", "attachment;filename=" + fileName + ".xls"); Response.ContentType = "application/vnd.ms-excel"; Response.ContentEncoding = System.Text.Encoding.Unicode; Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble()); Response.Cache.SetCacheability(HttpCacheability.NoCache); this.EnableViewState = false; //StringWriter sw = new StringWriter(); //HtmlTextWriter hw = new HtmlTextWriter(sw); //panelListAvailableCourse.RenderControl(hw); Response.Write(AddExcelStyling()); string style = @"<style> .textmode {mso-number-format:'\@'} </style>"; Response.Write(style); Response.Write(table_struct); Response.Flush(); Response.End(); //End Export to Excel }
protected void btnSEARCH_Click(object sender, EventArgs e) { divShow.Visible = true; try { uint chknum; 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") && (rbt1.Checked == true)) { MsgValidate("โปรดระบุ หลักสูตร"); } else if ((ddlServiceCURRICULUM.SelectedValue == "0") && (rbt2.Checked == true)) { MsgValidate("โปรดระบุ หลักสูตรบริการ"); } else { if (rbt1.Checked == true) { lblSemesterYear.Text = ddlSEMESTER.SelectedValue + "/" + academic_year; lblFaculty.Text = ddlFACULTY.SelectedItem.Text; if (ddlCURRICULUM.SelectedValue != "0") { lblcurri.Text = ddlCURRICULUM.SelectedItem.Text; } else { lblcurri.Text = ""; } degree_char = new Curriculum().getCurriculum(ddlCURRICULUM.SelectedValue).Degree_Char; examData = new AvailableCourse().getExamAvailableCourse(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, ddlFACULTY.SelectedValue, "", ddlCURRICULUM.SelectedValue, degree_char); } else if (rbt2.Checked == true) { lblSemesterYear.Text = ddlSEMESTER.SelectedValue + "/" + academic_year; lblFaculty.Text = "วิชาบริการศึกษา"; if (ddlServiceCURRICULUM.SelectedValue != "0") { lblcurri.Text = ddlServiceCURRICULUM.SelectedItem.Text; } else { lblcurri.Text = ""; } degree_char = new Curriculum().getCurriculum(ddlCURRICULUM.SelectedValue).Degree_Char; //examData = new AvailableCourse().getExamAvailableCourse(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, "xx","", ddlServiceCURRICULUM.SelectedValue, degree_char); examData = new AvailableCourse().getExamAvailableServiceCourse(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, ddlServiceCURRICULUM.SelectedValue, degree_char); } Session["excel_data"] = examData; // Head Table string[] ar = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "กลางภาค", "ปลายภาค" }; Table tb1 = new Table(); tb1.Attributes.Add("class", "table table-bordered table-striped table-hover smart-form"); tb1.Attributes.Add("id", "dt_exam"); TableHeaderRow tRowHead = new TableHeaderRow(); tRowHead.TableSection = TableRowSection.TableHeader; for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++) { // Create a new cell and add it to the row. TableHeaderCell cellHead = new TableHeaderCell(); cellHead.Text = ar[cellCtr - 1]; tRowHead.Cells.Add(cellHead); } tb1.Rows.Add(tRowHead); foreach (AvailableCourseData exam_data in examData) { course_data = courseObj.getCourse(exam_data.Course_Code); string credit = course_data.Credit + "(" + course_data.Theory + "-" + course_data.Practice + "-" + course_data.Self_Study + ")"; // table_data = new ExamTable().getExamTable(exam_data.AcademicYear, exam_data.Semester, exam_data.Course_Code, degree_char); table_data = new ExamTable().getExamTable(exam_data.AcademicYear, exam_data.Semester, exam_data.Course_Code, exam_data.Faculty_Code, exam_data.Department_Code, exam_data.Curr_Code, degree_char); string mid_exam_time = ""; string final_exam_time = ""; if (table_data.Course_Code != null) { mid_exam_time = table_data.ExamMid_Day + " เวลา:" + table_data.ExamMid_StartTime + "-" + table_data.ExamMid_EndTime; final_exam_time = table_data.ExamFinal_Day + " เวลา:" + table_data.ExamFinal_StartTime + "-" + table_data.ExamFinal_EndTime; } TableRow tRowBody = new TableRow(); tRowBody.TableSection = TableRowSection.TableBody; TableCell cellCourse_Code = new TableCell(); cellCourse_Code.Text = exam_data.Course_Code; tRowBody.Cells.Add(cellCourse_Code); TableCell cellCourse_Name = new TableCell(); cellCourse_Name.Text = course_data.Course_Engname; tRowBody.Cells.Add(cellCourse_Name); TableCell cellCredit = new TableCell(); cellCredit.Text = credit; tRowBody.Cells.Add(cellCredit); TableCell cellMidTerm = new TableCell(); cellMidTerm.Text = mid_exam_time; tRowBody.Cells.Add(cellMidTerm); TableCell cellFinal = new TableCell(); cellFinal.Text = final_exam_time; tRowBody.Cells.Add(cellFinal); tb1.Rows.Add(tRowBody); //if (course_data.Practice != 0) //{ // p_examData = new TeachingTable().getOneSubTeachingTable(exam_data.AcademicYear, exam_data.Semester, exam_data.Course_Code, exam_data.Sec_No, degree_char); // foreach (TeachingTableData p_exam_data in p_examData) // { // table_data = new ExamTable().getExamTable(exam_data.AcademicYear, exam_data.Semester, exam_data.Course_Code, p_exam_data.Sec_No, p_exam_data.SubSec_No, degree_char); // mid_exam_time = ""; // final_exam_time = ""; // if (table_data.Course_Code != null) // { // mid_exam_time = table_data.ExamMid_Day + " เวลา:" + table_data.ExamMid_StartTime + "-" + table_data.ExamMid_EndTime; // final_exam_time = table_data.ExamFinal_Day + " เวลา:" + table_data.ExamFinal_StartTime + "-" + table_data.ExamFinal_EndTime; // } // tRowBody = new TableRow(); // tRowBody.TableSection = TableRowSection.TableBody; // TableCell cellCourse_Code_P = new TableCell(); // cellCourse_Code_P.Text = exam_data.Course_Code; // tRowBody.Cells.Add(cellCourse_Code_P); // TableCell cellCourse_Name_P = new TableCell(); // cellCourse_Name_P.Text = course_data.Course_Engname; // tRowBody.Cells.Add(cellCourse_Name_P); // TableCell cellCredit_P = new TableCell(); // cellCredit_P.Text = credit; // tRowBody.Cells.Add(cellCredit_P); // TableCell cellSection_P = new TableCell(); // cellSection_P.Text = "L." + p_exam_data.SubSec_No.ToString(); // tRowBody.Cells.Add(cellSection_P); // TableCell cellMidTerm_P = new TableCell(); // cellMidTerm_P.Text = mid_exam_time; // tRowBody.Cells.Add(cellMidTerm_P); // TableCell cellFinal_P = new TableCell(); // cellFinal_P.Text = final_exam_time; // tRowBody.Cells.Add(cellFinal_P); // tb1.Rows.Add(tRowBody); // } //} } TableRow row = new TableRow(); TableCell cell = new TableCell(); cell.Controls.Add(tb1); row.Cells.Add(cell); tblExam.Rows.Add(row); } } catch { divShow.Visible = false; divFail.Visible = true; } }