public string insertExtendStudent(ExtendAvailableStudentData available_student) { string response = ""; string sql = ""; try { ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); sql = "Insert Into EXTEND_AVAILABLE_STUDENT(ACADEMIC_YEAR,SEMESTER,COURSE_CODE,COURSE_TYPE,SEC_NO,SUBSEC_NO,STUDENT_ID,LECTURER_ADD,LECTURER_CANCEL) Values('" + available_student.AcademicYear + "','" + available_student.Semester + "','" + available_student.Course_Code + "','" + available_student.Course_Type + "'," + available_student.Sec_No + "," + available_student.SubSec_No + ",'" + available_student.Student_ID + "','" + available_student.LECTURER_ADD + "','" + available_student.LECTURER_CANCEL + "' )"; oracleObj.InsertCommand = sql; if (oracleObj.Insert() == 1) { response = "OK"; } } catch (Exception err) { HttpContext.Current.Session["response"] = "Unit Test:ExtendAvailableStudent:insertExtendStudent" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(response); }
protected void btnSAVE_Click(object sender, EventArgs e) { string result = ""; if ((Session["save_student_data"] != null) && (Session["Extend_Data"] != null)) { LecturerTableData insert_extend_data = new LecturerTableData(); Student insert_studentData = new Student(); ExtendAvailableStudentData insert_extendStudentData = new ExtendAvailableStudentData(); insert_extend_data = (LecturerTableData)Session["Extend_Data"]; insert_studentData = (Student)Session["save_student_data"]; insert_extendStudentData.AcademicYear = insert_extend_data.AcademicYear; insert_extendStudentData.Semester = insert_extend_data.Semester; insert_extendStudentData.Course_Code = insert_extend_data.Course_Code; insert_extendStudentData.Course_Type = insert_extend_data.Course_Type; insert_extendStudentData.Sec_No = insert_extend_data.Sec_No; insert_extendStudentData.SubSec_No = insert_extend_data.SubSec_No; insert_extendStudentData.Student_ID = insert_studentData.Student_ID; insert_extendStudentData.LECTURER_ADD = insert_extend_data.Lecturer; insert_extendStudentData.LECTURER_CANCEL = "-"; result = new ExtendAvailableStudent().insertExtendStudent(insert_extendStudentData); if (result == "OK") { divSuccess.Visible = true; } } }
public List <ExtendAvailableStudentData> getExtendStudent(string academic_year, string semester, string student_id) { List <ExtendAvailableStudentData> studentData = new List <ExtendAvailableStudentData>(); string sql = ""; try { ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); sql = "Select * from EXTEND_AVAILABLE_STUDENT Where ACADEMIC_YEAR='" + academic_year + "' AND SEMESTER='" + semester + "' AND STUDENT_ID='" + student_id + "' AND CANCEL_STATUS = '0' "; oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { ExtendAvailableStudentData student_data = new ExtendAvailableStudentData(); student_data.AcademicYear = rowData["ACADEMIC_YEAR"].ToString(); student_data.Semester = rowData["SEMESTER"].ToString(); student_data.Course_Code = rowData["COURSE_CODE"].ToString(); student_data.Course_Type = rowData["COURSE_TYPE"].ToString(); student_data.Sec_No = Convert.ToInt16(rowData["SEC_NO"].ToString()); student_data.SubSec_No = Convert.ToInt16(rowData["SUBSEC_NO"].ToString()); student_data.Student_ID = rowData["STUDENT_ID"].ToString(); student_data.Cancel_Status = rowData["CANCEL_STATUS"].ToString(); student_data.LECTURER_ADD = rowData["LECTURER_ADD"].ToString(); student_data.LECTURER_CANCEL = rowData["LECTURER_CANCEL"].ToString(); studentData.Add(student_data); } } catch (Exception err) { HttpContext.Current.Session["response"] = "Unit Test:ExtendAvailableStudent:getExtendStudent" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(studentData); }