public string insertCashData(CashData insertData, string degree_char) { string response2 = ""; string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Insert Into CASH_DATA(ACADEMIC_YEAR,SEMESTER,PAYMENT_ID,STUDENT_ID,NATION_ID,PASSPORT_ID,STUDENT_NAME,AMOUNT,DUE_DATE,PAYMENT_DATE,PAYMENT_TIME,RECEIVE_BY,STATUS) Values('" + insertData.AcademicYear + "','" + insertData.Semester + "','" + insertData.Payment_ID + "','" + insertData.Student_ID + "','" + insertData.Nation_ID + "','" + insertData.Passport_ID + "','" + insertData.Student_Name + "'," + insertData.Amount + ",'" + insertData.DueDate + "','" + insertData.Payment_Date + "','" + insertData.Payment_Time + "','" + insertData.Receive_by + "','" + insertData.Status + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { // อัพเดทสถานะใบ Payment response2 = new Student_Payment().updatePayment(insertData.Payment_ID, insertData.Payment_Date, new Status_Variable().PaymentComplete, degree_char); // ======== response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); } return(response); }
public string deleteMajor(string Major_Code) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Delete From MAJOR Where MAJOR_CODE ='" + Major_Code + "'"; oracleObj.DeleteCommand = sql; try { if (oracleObj.Delete() > 0) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); HttpContext.Current.Session["response"] = "Unit Test:System Config: " + response; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(response); }
public List <MajorData> getMajorwithDepartment(string department_code) { List <MajorData> Major_data = new List <MajorData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string response = ""; string sql = "Select * From MAJOR Where DEPARTMENT_CODE = '" + department_code + "' And MAJOR_STATUS='0001' Order By MAJOR_CODE"; try { oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { MajorData major = new MajorData(); major.Major_Code = rowData["MAJOR_CODE"].ToString(); major.Major_Thai = rowData["MAJOR_THAINAME"].ToString(); major.Major_Eng = rowData["MAJOR_ENGNAME"].ToString(); major.Major_ShortName = rowData["MAJOR_SHORTNAME"].ToString(); major.Major_DepartmentCode = rowData["DEPARTMENT_CODE"].ToString(); major.Major_Code_StudentID = rowData["MAJOR_CODE_STUDENTID"].ToString(); major.Major_Status = rowData["MAJOR_STATUS"].ToString(); Major_data.Add(major); } } catch (Exception e) { response = e.Message.ToString(); HttpContext.Current.Session["response"] = "Unit Test:Major: " + response; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(Major_data); }
public string genProjectCode(string project_year, string project_semester) { string new_project_code = project_year + project_semester; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Select Max(TO_NUMBER(PROJECT_CODE)) AS MAX_CODE From PROJECT Where PROJECT_CODE Like '" + new_project_code + "%'"; oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); string max_code = allData[0]["MAX_CODE"].ToString(); if (max_code == "") { new_project_code += "00001"; } else { int int_runNumber = Convert.ToInt32(max_code.Substring(5)); int_runNumber++; if (int_runNumber <= 99999) { new_project_code += int_runNumber.ToString("00000"); } else { new_project_code = null; } } return(new_project_code); }
public MajorData getMajor(string Major_Code) { string response = ""; MajorData Major_data = new MajorData(); ConnectDB db = new ConnectDB(); try { SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = "Select * From MAJOR Where MAJOR_CODE='" + Major_Code + "'"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { Major_data.Major_Code = rowData["MAJOR_CODE"].ToString(); Major_data.Major_Thai = rowData["MAJOR_THAINAME"].ToString(); Major_data.Major_Eng = rowData["MAJOR_ENGNAME"].ToString(); Major_data.Major_ShortName = rowData["MAJOR_SHORTNAME"].ToString(); Major_data.Major_DepartmentCode = rowData["DEPARTMENT_CODE"].ToString(); Major_data.Major_Status = rowData["MAJOR_STATUS"].ToString(); Major_data.Major_Code_StudentID = rowData["MAJOR_CODE_STUDENTID"].ToString(); } } catch (Exception e) { response = e.Message.ToString(); HttpContext.Current.Session["response"] = "Unit Test:System Config: " + response; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(Major_data); }
// V 1.0.0 public string deleteSubCredit2(string academic_year, string semester, string course_code, int sec_no, int subsec_no, string teach_day, string teach_start, string teach_end, string degree_char) { string response = ""; try { string TableName = getTableName(degree_char); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Delete 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 + " And TEACHING_DAY = '" + teach_day + "' And TEACHING_START_TIME = '" + teach_start + "' And TEACHING_END_TIME = '" + teach_end + "'"; oracleObj.DeleteCommand = sql; try { if (oracleObj.Delete() > 0) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); } } catch { HttpContext.Current.Session["response"] = "Unit Test:SubCredit:deleteSubCredit" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(response); }
// ยังไม่ได้ใช้งาน public string insertSummerProject(ProjectData dataInsert) { string response = ""; int i = 0; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); ProjectData field = dataInsert; string sql = "Insert Into PROJECT_SUMMER(PROJECT_CODE,THEORY_FEE,PRACTICE_FEE,THESIS_PROJ_FEE,PACKET_FEE,NEW_REGIS_FEE,CARD_FEE,STUDY_FACILITY_FEE,IT_FEE,HEALTH_FEE,LIBRARY_FEE,PROPERTIES_FEE,ACCIDENT_FEE,ACADEMIC_FEE,STUDENT_STATUS_FEE,MAINTAINING_FEE,MORAL_FEE,ACTIVITY_FEE,CHARGE,QE_FEE) VALUES('" + field.Project_Code + "'," + field.Project_Theory_Fee + "," + field.Project_Practice_Fee + "," + field.Project_ThesisProject_Fee + "," + field.Project_Packet_Fee + "," + field.Project_NewRegister_Fee + "," + field.Project_Card_Fee + "," + field.Project_StudyFacility_Fee + "," + field.Project_IT_Fee + "," + field.Project_Health_Fee + "," + field.Project_Library_Fee + "," + field.Project_Properties_Fee + "," + field.Project_Accident_Fee + "," + field.Project_Academic_Fee + "," + field.Project_StudentStatus_Fee + "," + field.Project_Maintaining_Fee + "," + field.Project_Moral_Fee + "," + field.Project_Activity_Fee + "," + field.Project_Charge + "," + field.Project_QE_Fee + ")"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); } i++; return(response); }
public string insertOtherOffice(OtherOfficeData dataInsert) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = ""; sql = "Insert Into OTHER_OFFICE(OTHEROFFICE_CODE, OTHEROFFICE_THAINAME, OTHEROFFICE_ENGNAME, OTHEROFFICE_SHORTNAME, OTHEROFFICE_STATUS) Values('" + dataInsert.OtherOffice_Code + "','" + dataInsert.OtherOffice_ThaiName + "','" + dataInsert.OtherOffice_EngName + "','" + dataInsert.OtherOffice_ShortName + "','" + dataInsert.OtherOffice_Status + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); } return(response); }
/// <summary> /// Table GRAD_INSTITUTE /// </summary> /// <returns></returns> public List <PreInstituteData> getPreInstitute() { List <PreInstituteData> data = new List <PreInstituteData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = "Select * From GRAD_INSTITUTE Order By INSTITUTE_CODE"; //oracleObj.SelectCommand = "SELECT * FROM GRAD_INSTITUTE WHERE ROWNUM <=100"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { PreInstituteData users = new PreInstituteData(); users.Institute_Code = rowData["INSTITUTE_CODE"].ToString(); users.Institute_Thainame = rowData["INSTITUTE_THAINAME"].ToString(); users.Institute_Engname = rowData["INSTITUTE_ENGNAME"].ToString(); users.Institute_Province_Code = rowData["INSTITUTE_PROVINCE_CODE"].ToString(); data.Add(users); } return(data); }
public string updateConfig(SystemConfigData config_data) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Update SYSTEM_CONFIG Set ACADEMIC_YEAR='" + config_data.AcademicYear + "',SEMESTER='" + config_data.Semester + "' "; try { oracleObj.UpdateCommand = sql; if (oracleObj.Update() == 1) { response = "OK"; } } catch { HttpContext.Current.Session["response"] = "Unit Test:SystemConfig:updateConfig" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(response); }
// Update By Amornsak public List <OtherOfficeData> getOtherOffice(List <string> otheroffice_code) { List <OtherOfficeData> data = new List <OtherOfficeData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); foreach (string code in otheroffice_code) { oracleObj.SelectCommand = "Select * From OTHER_OFFICE Where OTHEROFFICE_CODE='" + code + "' And OTHEROFFICE_STATUS='0001'"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { OtherOfficeData Office = new OtherOfficeData(); Office.OtherOffice_Code = rowData["OTHEROFFICE_CODE"].ToString(); Office.OtherOffice_ThaiName = rowData["OTHEROFFICE_THAINAME"].ToString(); Office.OtherOffice_EngName = rowData["OTHEROFFICE_ENGNAME"].ToString(); Office.OtherOffice_ShortName = rowData["OTHEROFFICE_SHORTNAME"].ToString(); Office.OtherOffice_Status = rowData["OTHEROFFICE_STATUS"].ToString(); data.Add(Office); } } return(data); }
public SystemConfigData getConfig() { SystemConfigData config_data = new SystemConfigData(); string sql = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); sql = "Select * From SYSTEM_CONFIG"; try { oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { config_data.AcademicYear = rowData["ACADEMIC_YEAR"].ToString(); config_data.Semester = rowData["SEMESTER"].ToString(); } } catch { HttpContext.Current.Session["response"] = "Unit Test:SystemConfig:getConfig" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(config_data); }
/// <summary> /// แก้ไขข้อมูลจากตาราง ENGLISH_DB /// </summary> /// <param name="updateData">EnglishDb Object</param> /// <returns>OK</returns> public string updateEnglishDb(EnglishDbData updateData) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Update ENGLISH_DB Set ENGLSIH_DB_NAME = '" + updateData.EnglishDbName + "' Where ENGLISH_DB_ID = '" + updateData.EnglishDbId + "'"; oracleObj.UpdateCommand = sql; try { if (oracleObj.Update() == 1) { response = "OK"; } } catch (Exception e) { string exception = e.Message; HttpContext.Current.Session["response"] = "updateEnglishDb: " + exception; HttpContext.Current.Response.Redirect("../err_response.aspx"); } return(response); }
/// <summary> /// ลบข้อมูลจากตาราง ENGLISH_DB /// </summary> /// <param name="EnglishDbId">รหัสมาตรฐานภาษาอังกฤษ</param> /// <returns>OK</returns> public string deleteEnglishDb(string EnglishDbId) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Delete From ENGLISH_DB Where ENGLISH_DB_ID ='" + EnglishDbId + "'"; oracleObj.DeleteCommand = sql; try { if (oracleObj.Delete() > 0) { response = "OK"; } } catch (Exception e) { string exception = e.Message; HttpContext.Current.Session["response"] = "deleteEnglishDb: " + exception; HttpContext.Current.Response.Redirect("../err_response.aspx"); } return(response); }
public string[] updateSubCredit(List <SubCreditData> update_Data, string degree_char) { string[] response = new string[update_Data.Count]; string TableName = getTableName(degree_char); int i = 0; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = ""; try { foreach (SubCreditData update in update_Data) { deleteSubCredit(update.AcademicYear, update.Semester, update.Course_Code, update.Sec_No, update.SubSec_No, update.Teaching_Day, update.Teaching_Start_Time, update.Teaching_End_Time, degree_char); } insertSubCredit(update_Data, degree_char); //if (deleteSubCredit(update.AcademicYear, update.Semester, update.Course_Code, update.Sec_No, update.SubSec_No, update.Teaching_Day, update.Teaching_Start_Time, update.Teaching_End_Time, degree_char) == "OK") // { // insertSubCredit(update, degree_char); // } //else // { // insertSubCredit(update, degree_char); // } } catch { HttpContext.Current.Session["response"] = "Unit Test:SubCredit:updateSubCredit" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(response); }
public List <UsersInfo> getUsersList(string UserId) { List <UsersInfo> userData = new List <UsersInfo>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = "Select * From USERS_INFO Where USER_ID='" + UserId + "'"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { UsersInfo users_data = new UsersInfo(); users_data.USERS_INFO_USER_ID = rowData["USER_ID"].ToString(); users_data.USERS_INFO_NATIONAL_ID = rowData["NATIONAL_ID"].ToString(); users_data.USERS_INFO_OFFICIAL_ID = rowData["OFFICIAL_ID"].ToString(); users_data.USERS_INFO_TITLE_THAINAME = rowData["TITLE_THAINAME"].ToString(); users_data.USERS_INFO_FIRST_THAINAME = rowData["FIRST_THAINAME"].ToString(); users_data.USERS_INFO_FAMILY_THAINAME = rowData["FAMILY_THAINAME"].ToString(); users_data.USERS_INFO_TITLE_ENGNAME = rowData["TITLE_ENGNAME"].ToString(); users_data.USERS_INFO_FIRST_ENGNAME = rowData["FIRST_ENGNAME"].ToString(); users_data.USERS_INFO_FAMILY_ENGNAME = rowData["FAMILY_ENGNAME"].ToString(); users_data.USERS_INFO_FACULTY_ID = rowData["FACULTY_ID"].ToString(); users_data.USERS_INFO_DEPARTMENT_ID = rowData["DEPARTMENT_ID"].ToString(); users_data.USERS_INFO_INTERNAL_PHONE = rowData["INTERNAL_PHONE"].ToString(); users_data.USERS_INFO_EXTERNAL_PHONE = rowData["EXTERNAL_PHONE"].ToString(); users_data.OTHEROFFICE_CODE = rowData["OTHEROFFICE_CODE"].ToString(); users_data.STATUS = rowData["STATUS"].ToString(); users_data.PASSWORD = rowData["PASSWORD"].ToString(); userData.Add(users_data); } return(userData); }
public SubCreditData getSubCredit(string academic_year, string semester, string course_code, int sec_no, int subsec_no, string lecturer_code, string teach_date, string teach_start_time, string teach_end_time, string degree_char) { SubCreditData subcredit = new SubCreditData(); string TableName = getTableName(degree_char); string sql = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); try { 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 + " And LECTURER_ID = '" + lecturer_code + "' AND TEACHING_DAY='" + teach_date + "' AND TEACHING_START_TIME='" + teach_start_time + "' AND TEACHING_END_TIME='" + teach_end_time + "' "; oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { subcredit.AcademicYear = rowData["ACADEMIC_YEAR"].ToString(); subcredit.Semester = rowData["SEMESTER"].ToString(); subcredit.Course_Code = rowData["COURSE_CODE"].ToString(); subcredit.Sec_No = Convert.ToInt16(rowData["SEC_NO"].ToString()); subcredit.SubSec_No = Convert.ToInt16(rowData["SUBSEC_NO"].ToString()); subcredit.Lecturer = rowData["LECTURER_ID"].ToString(); subcredit.SubCredit = float.Parse(rowData["SUB_CREDIT"].ToString()); } } catch { HttpContext.Current.Session["response"] = "Unit Test:SubCredit:getSubCredit" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(subcredit); }
public string updateHourRefer(HourReferData updateData) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Update HOUR_REFER_CONFIG Set HOUR_REF=" + updateData.HourRefer + " Where DEGREE_CHAR='" + updateData.Degree_Char + "' AND COURSE_TYPE='" + updateData.CourseType + "'"; oracleObj.UpdateCommand = sql; try { if (oracleObj.Update() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); HttpContext.Current.Session["response"] = "Unit Test:HourRefer:updateHourRefer" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return response; }
public string insertSubCredit(SubCreditData insertData, string degree_char) { string response = ""; try { string TableName = getTableName(degree_char); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Insert Into " + TableName + "(ACADEMIC_YEAR,SEMESTER,COURSE_CODE,SEC_NO,SUBSEC_NO,LECTURER_ID,SUB_CREDIT,TEACHING_DAY,TEACHING_START_TIME,TEACHING_END_TIME) Values('" + insertData.AcademicYear + "','" + insertData.Semester + "','" + insertData.Course_Code + "'," + insertData.Sec_No + "," + insertData.SubSec_No + ",'" + insertData.Lecturer + "'," + insertData.SubCredit + ",'" + insertData.Teaching_Day + "','" + insertData.Teaching_Start_Time + "','" + insertData.Teaching_End_Time + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString() + " "; } } catch { HttpContext.Current.Session["response"] = "Unit Test:SubCredit:insertSubCredit" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(response); }
public string deleteHourRefer(string degree_char, string course_type) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Delete From HOUR_REFER_CONFIG Where DEGREE_CHAR='" + degree_char + "' AND COURSE_TYPE='" + course_type + "'"; oracleObj.DeleteCommand = sql; try { if (oracleObj.Delete() > 0) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); HttpContext.Current.Session["response"] = "Unit Test:HourRefer:deleteHourRefer" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return response; }
// ไม่ใช้งาน public string updateSummerProject(ProjectData dataUpdate) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); ProjectData field = dataUpdate; string sql = "Update PROJECT_SUMMER SET THEORY_FEE=" + field.Project_Theory_Fee + ",PRACTICE_FEE=" + field.Project_Practice_Fee + ",THESIS_PROJ_FEE=" + field.Project_ThesisProject_Fee + ",PACKET_FEE=" + field.Project_Packet_Fee + ",NEW_REGIS_FEE=" + field.Project_NewRegister_Fee + ",CARD_FEE=" + field.Project_Card_Fee + ",STUDY_FACILITY_FEE=" + field.Project_StudyFacility_Fee + ",IT_FEE=" + field.Project_IT_Fee + ",HEALTH_FEE=" + field.Project_Health_Fee + ",LIBRARY_FEE=" + field.Project_Library_Fee + ",PROPERTIES_FEE=" + field.Project_Properties_Fee + ",ACCIDENT_FEE=" + field.Project_Accident_Fee + ",ACADEMIC_FEE=" + field.Project_Academic_Fee + ",STUDENT_STATUS_FEE=" + field.Project_StudentStatus_Fee + ",MAINTAINING_FEE=" + field.Project_Maintaining_Fee + ",MORAL_FEE=" + field.Project_Moral_Fee + ",ACTIVITY_FEE=" + field.Project_Activity_Fee + ",CHARGE=" + field.Project_Charge + ",QE_FEE=" + field.Project_QE_Fee + " Where PROJECT_CODE='" + field.Project_Code + "'"; oracleObj.UpdateCommand = sql; try { if (oracleObj.Update() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); } return(response); }
public HourReferData getHourRefer(string degree_char, string course_type) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); HourReferData hourrefer_data = new HourReferData(); string sql = "Select * From HOUR_REFER_CONFIG Where DEGREE_CHAR='" + degree_char + "' and COURSE_TYPE='" + course_type + "'"; try { oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { hourrefer_data.Degree_Char = rowData["DEGREE_CHAR"].ToString(); hourrefer_data.CourseType = rowData["COURSE_TYPE"].ToString(); hourrefer_data.HourRefer = float.Parse(rowData["HOUR_REF"].ToString()); } } catch (Exception e) { response = e.Message.ToString(); HttpContext.Current.Session["response"] = "Unit Test:HourRefer:getHourRefer " + response; HttpContext.Current.Response.Redirect("err_response.aspx"); } return hourrefer_data; }
public string insertMajor(MajorData dataInsert) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = ""; sql = "Insert Into MAJOR(MAJOR_CODE, MAJOR_THAINAME, MAJOR_ENGNAME, MAJOR_SHORTNAME, DEPARTMENT_CODE, MAJOR_CODE_STUDENTID, MAJOR_STATUS) Values('" + dataInsert.Major_Code + "','" + dataInsert.Major_Thai + "','" + dataInsert.Major_Eng + "','" + dataInsert.Major_ShortName + "','" + dataInsert.Major_DepartmentCode + "','" + dataInsert.Major_Code_StudentID + "','" + dataInsert.Major_Status + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); HttpContext.Current.Session["response"] = "Unit Test:System Config: " + response; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(response); }
public string insertHourRefer(HourReferData dataInsert) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = ""; sql = "Insert Into HOUR_REFER_CONFIG(DEGREE_CHAR, COURSE_TYPE, HOUR_REF) Values('" + dataInsert.Degree_Char + "','" + dataInsert.CourseType + "'," + dataInsert.HourRefer + ")"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); HttpContext.Current.Session["response"] = "Unit Test:HourRefer:insertHourRefer" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return response; }
public string updateMajor(MajorData updateData) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Update MAJOR Set MAJOR_THAINAME = '" + updateData.Major_Thai + "', MAJOR_ENGNAME='" + updateData.Major_Eng + "', MAJOR_SHORTNAME='" + updateData.Major_ShortName + "', DEPARTMENT_CODE='" + updateData.Major_DepartmentCode + "', MAJOR_CODE_STUDENTID='" + updateData.Major_Code_StudentID + "', MAJOR_STATUS='" + updateData.Major_Status + "' Where MAJOR_CODE='" + updateData.Major_Code + "'"; oracleObj.UpdateCommand = sql; try { if (oracleObj.Update() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); HttpContext.Current.Session["response"] = "Unit Test:System Config: " + response; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(response); }
//Pongsarun 26/9/2015: use for config system public string insertDivision(DivisionData dataInsert) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = ""; sql = "Insert Into DIVISION(DIVISION_CODE, DIVISION_THAINAME, DIVISION_ENGNAME, DIVISION_SHORTNAME, OFFICE_CODE, DIVISION_STATUS, DIVISION_CODE_STUDENTID) Values('" + dataInsert.Division_Code + "','" + dataInsert.Division_Thai + "','" + dataInsert.Division_Eng + "','" + dataInsert.Division_ShortName + "','" + dataInsert.Division_OfficeCode + "','" + dataInsert.Division_Status + "','" + dataInsert.Division_CodeStudent + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); } return(response); }
//Pongsarun 26/2/2016: use for config system public List <MajorData> getMajorManual(string sql) { List <MajorData> Major_data = new List <MajorData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { MajorData major = new MajorData(); major.Major_Code = rowData["MAJOR_CODE"].ToString(); major.Major_Thai = rowData["MAJOR_THAINAME"].ToString(); major.Major_Eng = rowData["MAJOR_ENGNAME"].ToString(); major.Major_ShortName = rowData["MAJOR_SHORTNAME"].ToString(); major.Major_DepartmentCode = rowData["DEPARTMENT_CODE"].ToString(); major.Major_Code_StudentID = rowData["MAJOR_CODE_STUDENTID"].ToString(); major.Major_Status = rowData["MAJOR_STATUS"].ToString(); Major_data.Add(major); } return(Major_data); }
public List <DivisionData> getDivisionCommand(string sqlCommand) { List <DivisionData> Division_data = new List <DivisionData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = sqlCommand; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { DivisionData Division = new DivisionData(); Division.Division_Code = rowData["DIVISION_CODE"].ToString(); Division.Division_Thai = rowData["DIVISION_THAINAME"].ToString(); Division.Division_Eng = rowData["DIVISION_ENGNAME"].ToString(); Division.Division_ShortName = rowData["DIVISION_SHORTNAME"].ToString(); Division.Division_OfficeCode = rowData["OFFICE_CODE"].ToString(); Division.Division_Status = rowData["DIVISION_STATUS"].ToString(); Division.Division_CodeStudent = rowData["DIVISION_CODE_STUDENTID"].ToString(); Division_data.Add(Division); } return(Division_data); }
/// <summary> /// Table USERS_GROUP /// </summary> /// <param name="dataInsert"></param> /// <returns></returns> public string insertUserGroup(UserGroupData dataInsert) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = ""; sql = "Insert Into USERS_GROUP (USERS_GROUP_ID, USERS_GROUP_NAME, USERS_GROUP_STATUS) Values ('" + dataInsert.Users_Group_Id + "','" + dataInsert.Users_Group_Name + "','" + dataInsert.Users_Group_Status + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); } return(response); }
public string cancelExtendStudent(string academic_year, string semester, string course_code, int sec_num, int subsec_num, string student_id, string lecturer_code) { string response = ""; string sql = ""; try { ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); sql = "Update EXTEND_AVAILABLE_STUDENT SET CANCEL_STATUS = '1', LECTURER_CANCEL='" + lecturer_code + "' Where ACADEMIC_YEAR = '" + academic_year + "' AND SEMESTER = '" + semester + "' AND COURSE_CODE = '" + course_code + "' AND SEC_NO = " + sec_num + " AND SUBSEC_NO = " + subsec_num + " AND STUDENT_ID = '" + student_id + "' AND CANCEL_STATUS='0' "; oracleObj.UpdateCommand = sql; if (oracleObj.Update() == 1) { response = "OK"; } else { // response = sql; } } catch (Exception err) { HttpContext.Current.Session["response"] = "Unit Test:ExtendAvailableStudent:insertExtendStudent" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(response); }