// V 1.0.0 public VerificationRegisData getReceiveCredit(string student_id, string course_code, string degree_char) { string TableName = getTableName(degree_char); VerificationRegisData verification_data = new VerificationRegisData(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = "Select * From " + TableName + " Where Student_ID = '" + student_id + "' And COURSE_CODE='" + course_code + "' Order By ACADEMIC_YEAR, SEMESTER"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); if (allData.Count > 0) { verification_data.AcademicYear = allData[0]["ACADEMIC_YEAR"].ToString(); verification_data.Semester = allData[0]["SEMESTER"].ToString(); verification_data.Student_ID = allData[0]["STUDENT_ID"].ToString(); verification_data.Course_Code = allData[0]["COURSE_CODE"].ToString(); verification_data.Course_Type = allData[0]["COURSE_TYPE"].ToString(); verification_data.Receive_Credit = Convert.ToInt16(allData[0]["RECEIVE_CREDIT"].ToString()); verification_data.Receive_Grade = allData[0]["RECEIVE_GRADE"].ToString(); } return(verification_data); }
// V 1.0.0 public List <VerificationRegisData> getVerificationRegis(string student_id, string degree_char) { string TableName = getTableName(degree_char); List <VerificationRegisData> verificationData = new List <VerificationRegisData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = "Select * From " + TableName + " Where Student_ID = '" + student_id + "' Order By ACADEMIC_YEAR, SEMESTER"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { VerificationRegisData verification_data = new VerificationRegisData(); verification_data.AcademicYear = rowData["ACADEMIC_YEAR"].ToString(); verification_data.Semester = rowData["SEMESTER"].ToString(); verification_data.Student_ID = rowData["STUDENT_ID"].ToString(); verification_data.Course_Code = rowData["COURSE_CODE"].ToString(); verification_data.Course_Type = rowData["COURSE_TYPE"].ToString(); verification_data.Receive_Credit = Convert.ToInt16(rowData["RECEIVE_CREDIT"].ToString()); verification_data.Receive_Grade = rowData["RECEIVE_GRADE"].ToString(); verificationData.Add(verification_data); } return(verificationData); }
public string insertVerificationRegis(VerificationRegisData dataInsert, string degree_char) { string TableName = getTableName(degree_char); string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = ""; sql = "Insert Into " + TableName + "(ACADEMIC_YEAR, SEMESTER, STUDENT_ID, COURSE_CODE, COURSE_TYPE, RECEIVE_CREDIT, RECEIVE_GRADE) Values('" + dataInsert.AcademicYear + "','" + dataInsert.Semester + "','" + dataInsert.Student_ID + "','" + dataInsert.Course_Code + "','" + dataInsert.Course_Type + "','" + dataInsert.Receive_Credit + "','" + dataInsert.Receive_Grade + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); } return(response); }
/// <summary> /// Update เฉพาะ RECEIVE_CREDIT, RECEIVE_GRADE /// ส่วนที่เหลืออื่นๆ ให้เป็นค่าเดิม /// </summary> /// <param name="updateData"></param> /// <param name="degree_char"></param> /// <returns></returns> public string updateVerificationRegis(VerificationRegisData updateData, string degree_char) { string TableName = getTableName(degree_char); string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Update " + TableName + " Set RECEIVE_CREDIT='" + updateData.Receive_Credit + "', RECEIVE_GRADE='" + updateData.Receive_Grade + "' Where ACADEMIC_YEAR='" + updateData.AcademicYear + "' And SEMESTER='" + updateData.Semester + "' And STUDENT_ID='" + updateData.Student_ID + "' And COURSE_CODE='" + updateData.Course_Code + "'"; oracleObj.UpdateCommand = sql; try { if (oracleObj.Update() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString() + " "; } return(response); }
/// <summary> /// ใส่ Table name มาจาก string sql ด้วย /// </summary> /// <param name="sql"></param> /// <returns></returns> public List <VerificationRegisData> getVerificationRegisManual(string sql) { List <VerificationRegisData> verificationData = new List <VerificationRegisData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { VerificationRegisData verification_data = new VerificationRegisData(); verification_data.AcademicYear = rowData["ACADEMIC_YEAR"].ToString(); verification_data.Semester = rowData["SEMESTER"].ToString(); verification_data.Student_ID = rowData["STUDENT_ID"].ToString(); verification_data.Course_Code = rowData["COURSE_CODE"].ToString(); verification_data.Course_Type = rowData["COURSE_TYPE"].ToString(); verification_data.Receive_Credit = Convert.ToInt16(rowData["RECEIVE_CREDIT"].ToString()); verification_data.Receive_Grade = rowData["RECEIVE_GRADE"].ToString(); verificationData.Add(verification_data); } return(verificationData); }