//V 1.0.0 public string insert_HisRegistration(HisRegistrationData dataInsert, string degree_char) { string tableName = getHisRegistrationTable(degree_char); string response = ""; int i = 0; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Insert Into " + tableName + "(DATE_TIME,ACADEMIC_YEAR,SEMESTER,STUDENT_ID,NATION_ID,PASSPORT_ID,REG_TYPE,COURSE_CODE,COURSE_TYPE,SEC,SUBSEC,CREDIT,FEE,PAYMENT_ID,OLD_SEC,OLD_SUBSEC) Values('" + dataInsert.date_time + "','" + dataInsert.academic_year + "','" + dataInsert.semester + "','" + dataInsert.student_id + "','" + dataInsert.nation_id + "','" + dataInsert.passport_id + "','" + dataInsert.reg_type + "','" + dataInsert.course_code + "','" + dataInsert.course_type + "'," + dataInsert.sec + "," + dataInsert.subsec + "," + dataInsert.credit + "," + dataInsert.fee + ",'" + dataInsert.payment_id + "'," + dataInsert.old_sec + "," + dataInsert.old_subsec + ")"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); } return(response); }
// V 1.0.0 public List <HisRegistrationData> get_HisRegistration2(string academic_year, string semester, string student_id, string degree_char) { string tableName = getHisRegistrationTable(degree_char); List <HisRegistrationData> HisData = new List <HisRegistrationData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); // oracleObj.SelectCommand = "Select * From " + tableName + " Where ACADEMIC_YEAR='" + academic_year + "' And SEMESTER='" + semester + "' And STUDENT_ID='" + student_id + "' And DATE_TIME='" + datetime + "' And REG_TYPE='" + regtype + "' Order By COURSE_CODE,SEC,SUBSEC"; // oracleObj.SelectCommand = "Select ACADEMIC_YEAR,SEMESTER,DATE_TIME,REG_TYPE,STUDENT_ID,Payment_ID From " + tableName + " Where STUDENT_ID='" + student_id + "' And ACADEMIC_YEAR='" + academic_year + "' AND SEMESTER='" + semester + "' Group By ACADEMIC_YEAR,SEMESTER,DATE_TIME,REG_TYPE,STUDENT_ID,Payment_ID Order By DATE_TIME"; //oracleObj.SelectCommand = "Select ACADEMIC_YEAR,SEMESTER,DATE_TIME,REG_TYPE,STUDENT_ID From " + tableName + " Where STUDENT_ID='" + student_id + "' And ACADEMIC_YEAR='" + academic_year + "' AND SEMESTER='" + semester + "' Group By ACADEMIC_YEAR,SEMESTER,DATE_TIME,REG_TYPE,STUDENT_ID Order By DATE_TIME"; oracleObj.SelectCommand = "Select ACADEMIC_YEAR,SEMESTER,DATE_TIME,REG_TYPE,STUDENT_ID From " + tableName + " Where STUDENT_ID='" + student_id + "' And ACADEMIC_YEAR='" + academic_year + "' AND SEMESTER='" + semester + "' Group By ACADEMIC_YEAR,SEMESTER,DATE_TIME,REG_TYPE,STUDENT_ID Order By to_date(DATE_TIME,'MM-DD-YYYY HH:MI:SS AM') ASC"; DataView allData2 = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData2 in allData2) { HisRegistrationData his_data = new HisRegistrationData(); his_data.date_time = rowData2["DATE_TIME"].ToString(); his_data.academic_year = rowData2["ACADEMIC_YEAR"].ToString(); his_data.semester = rowData2["SEMESTER"].ToString(); his_data.reg_type = rowData2["REG_TYPE"].ToString(); his_data.student_id = rowData2["STUDENT_ID"].ToString(); //his_data.nation_id = rowData2["NATION_ID"].ToString(); //his_data.passport_id = rowData2["PASSPORT_ID"].ToString(); //his_data.course_type = rowData2["COURSE_TYPE"].ToString(); //his_data.sec = Convert.ToInt16(rowData2["SEC"].ToString()); //his_data.subsec = Convert.ToInt16(rowData2["SUBSEC"].ToString()); //his_data.credit = Convert.ToInt16(rowData2["CREDIT"].ToString()); //his_data.fee = Convert.ToInt16(rowData2["FEE"].ToString()); //his_data.course_code = rowData2["COURSE_CODE"].ToString(); //his_data.payment_id = rowData2["PAYMENT_ID"].ToString(); HisData.Add(his_data); } return(HisData); }
public List <HisRegistrationData> get_HisRegistrationByPayment(string payment_id, string reg_type, string reg_datetime, string degree_char) { string tableName = getHisRegistrationTable(degree_char); List <HisRegistrationData> HisData = new List <HisRegistrationData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = "Select * From " + tableName + " Where PAYMENT_ID='" + payment_id + "' AND REG_TYPE='" + reg_type + "' AND DATE_TIME='" + reg_datetime + "'"; DataView allData2 = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData2 in allData2) { HisRegistrationData his_data = new HisRegistrationData(); his_data.date_time = rowData2["DATE_TIME"].ToString(); his_data.academic_year = rowData2["ACADEMIC_YEAR"].ToString(); his_data.semester = rowData2["SEMESTER"].ToString(); his_data.reg_type = rowData2["REG_TYPE"].ToString(); his_data.student_id = rowData2["STUDENT_ID"].ToString(); his_data.nation_id = rowData2["NATION_ID"].ToString(); his_data.passport_id = rowData2["PASSPORT_ID"].ToString(); his_data.course_type = rowData2["COURSE_TYPE"].ToString(); his_data.sec = Convert.ToInt16(rowData2["SEC"].ToString()); his_data.subsec = Convert.ToInt16(rowData2["SUBSEC"].ToString()); his_data.old_sec = Convert.ToInt16(rowData2["OLD_SEC"].ToString()); his_data.old_subsec = Convert.ToInt16(rowData2["OLD_SUBSEC"].ToString()); his_data.credit = Convert.ToInt16(rowData2["CREDIT"].ToString()); his_data.fee = Convert.ToInt16(rowData2["FEE"].ToString()); his_data.course_code = rowData2["COURSE_CODE"].ToString(); his_data.payment_id = rowData2["PAYMENT_ID"].ToString(); HisData.Add(his_data); } return(HisData); }
// V. 1.0.0 public string[] insertRegistration(List <RegistrationData> DataInsert, string degree_char) { // ฟิวส์ PAYMENT_ID จะต้องเพิ่มภายหลังจากเพิ่มข้อมูลในตาราง Payment string TableName = getTableName(degree_char); string[] response = new string[DataInsert.Count]; int i = 0; UserLoginData loginData = new UserLoginData(); loginData = (UserLoginData)HttpContext.Current.Session["login_data"]; LogData log_data = new LogData(); log_data.ModuleCode = new LogData().Module_Registration; log_data.Username = loginData.User_ID; log_data.Message = ""; ConnectDB db = new ConnectDB(); foreach (RegistrationData dataInsert in DataInsert) { log_data.Message += "Insert Qualified_Student_Registration With:" + dataInsert.Academic_Year + "','" + dataInsert.Semester + "','" + dataInsert.Course_Code + "','" + dataInsert.Student_ID + "','" + dataInsert.Nation_ID + "','" + dataInsert.Passport_ID + "','" + dataInsert.First_Thainame + "','" + dataInsert.Family_Thainame + "','" + dataInsert.First_Engname + "','" + dataInsert.Family_Engname + "','" + dataInsert.Faculty_Code + "','" + dataInsert.Department_Code + "','" + dataInsert.Major_Code + "','" + dataInsert.Spec_Field_Code + "','" + dataInsert.Reg_Type + "'," + dataInsert.Credit + "," + dataInsert.Sec_No + ",'" + dataInsert.Sec_Comment + "'," + dataInsert.Theory_Fee + "," + dataInsert.Practice_Fee + "," + dataInsert.Thesis_Project_Fee + ",'" + dataInsert.Registration_Date + "','" + dataInsert.Status + "','" + dataInsert.Curr_Code + "','" + dataInsert.Project_Code + "','" + dataInsert.Course_Type + "'" + "," + dataInsert.SubSec_No + ",'" + dataInsert.Payment_ID + "'," + dataInsert.Trainee_Fee + Environment.NewLine; SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.InsertCommand = "Insert Into " + TableName + "(ACADEMIC_YEAR,SEMESTER,COURSE_CODE,STUDENT_ID,NATION_ID,PASSPORT_ID,FIRST_THAINAME,FAMILY_THAINAME,FIRST_ENGNAME,FAMILY_ENGNAME,FACULITY_CODE,DEPARTMENT_CODE,MAJOR_CODE,SPEC_FIELD_CODE,REG_TYPE,CREDIT,SEC_NO,SEC_COMMENT,THEORY_FEE,PRACTICE_FEE,THESIS_PROJ_FEE,REGISTRATION_DATE,REG_STATUS,CURR_CODE,PROJECT_CODE,COURSE_TYPE,SUBSEC_NO,PAYMENT_ID,TRAINEE_FEE) Values('" + dataInsert.Academic_Year + "','" + dataInsert.Semester + "','" + dataInsert.Course_Code + "','" + dataInsert.Student_ID + "','" + dataInsert.Nation_ID + "','" + dataInsert.Passport_ID + "','" + dataInsert.First_Thainame + "','" + dataInsert.Family_Thainame + "','" + dataInsert.First_Engname + "','" + dataInsert.Family_Engname + "','" + dataInsert.Faculty_Code + "','" + dataInsert.Department_Code + "','" + dataInsert.Major_Code + "','" + dataInsert.Spec_Field_Code + "','" + dataInsert.Reg_Type + "'," + dataInsert.Credit + "," + dataInsert.Sec_No + ",'" + dataInsert.Sec_Comment + "'," + dataInsert.Theory_Fee + "," + dataInsert.Practice_Fee + "," + dataInsert.Thesis_Project_Fee + ",'" + dataInsert.Registration_Date + "','" + dataInsert.Status + "','" + dataInsert.Curr_Code + "','" + dataInsert.Project_Code + "','" + dataInsert.Course_Type + "'" + "," + dataInsert.SubSec_No + ",'" + dataInsert.Payment_ID + "'," + dataInsert.Trainee_Fee + " )"; try { if (oracleObj.Insert() == 1) { log_data.StatusCode = log_data.LogStatus_SUCCESS; response[i] = "OK"; HisRegistrationData his_data = new HisRegistrationData(); his_data.date_time = DateTime.Now.ToString(); his_data.academic_year = dataInsert.Academic_Year; his_data.semester = dataInsert.Semester; his_data.student_id = dataInsert.Student_ID; his_data.nation_id = dataInsert.Nation_ID; his_data.passport_id = dataInsert.Passport_ID; his_data.reg_type = dataInsert.Reg_Type; his_data.course_code = dataInsert.Course_Code; his_data.course_type = dataInsert.Course_Type; his_data.sec = dataInsert.Sec_No; his_data.subsec = dataInsert.SubSec_No; his_data.payment_id = dataInsert.Payment_ID; his_data.credit = dataInsert.Credit; if (dataInsert.Course_Type == "1") { his_data.fee = dataInsert.Theory_Fee; } else if (dataInsert.Course_Type == "2") { his_data.fee = dataInsert.Practice_Fee; } else if (dataInsert.Course_Type == "4" || dataInsert.Course_Type == "5" || dataInsert.Course_Type == "7") { his_data.fee = dataInsert.Thesis_Project_Fee; } else { his_data.fee = dataInsert.Thesis_Project_Fee; } new HistoryUpdate().insert_HisRegistration(his_data, degree_char); } else { log_data.StatusCode = log_data.LogStatus_FAILED; } } catch (Exception e) { response[i] = e.Message.ToString(); log_data.StatusCode = log_data.LogStatus_ERROR; log_data.Message += " [" + e.ToString() + "]"; } i++; } new Log().WriteLog(log_data); return(response); }
// V. 1.0.0 public List <ResponseRegisData> addRegistration(List <RegistrationData> DataInsert, string degree_char) { string TableName = getTableName(degree_char); List <ResponseRegisData> Response_Data = new List <ResponseRegisData>(); ConnectDB db = new ConnectDB(); foreach (RegistrationData dataInsert in DataInsert) { int RegistedStudent = 0; int numStudent = 0; int TotalRegisStudent = 0; ResponseRegisData response = new ResponseRegisData(); RegistrationData checkRegis = new RegistrationData(); checkRegis = getRegistration(dataInsert.Student_ID, dataInsert.Course_Code, dataInsert.Course_Type, degree_char); response.Student_ID = dataInsert.Student_ID; response.Student_ThaiName = dataInsert.First_Thainame + " " + dataInsert.Family_Thainame; response.Student_EngName = dataInsert.First_Engname + " " + dataInsert.Family_Engname; response.Course_Code = dataInsert.Course_Code; response.Course_Type = dataInsert.Course_Type; response.Sec_No = dataInsert.Sec_No; response.SubSec_No = dataInsert.SubSec_No; // ตรวจสอบการลงทะเบียนซ้ำซ้อน if (checkRegis.Course_Code != dataInsert.Course_Code) { TotalRegisStudent = dataInsert.TotalStdRegis; RegistedStudent = new Qualified_Student_Registration().getNumStudent(dataInsert.Academic_Year, dataInsert.Semester, dataInsert.Course_Code, dataInsert.Sec_No, dataInsert.SubSec_No, degree_char); // ตรวจสอบการลงทะเบียนเกินจำนวนที่เปิดรับ if (RegistedStudent < TotalRegisStudent) { SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.InsertCommand = "Insert Into " + TableName + "(ACADEMIC_YEAR,SEMESTER,COURSE_CODE,STUDENT_ID,NATION_ID,PASSPORT_ID,FIRST_THAINAME,FAMILY_THAINAME,FIRST_ENGNAME,FAMILY_ENGNAME,FACULITY_CODE,DEPARTMENT_CODE,MAJOR_CODE,SPEC_FIELD_CODE,REG_TYPE,CREDIT,SEC_NO,SEC_COMMENT,THEORY_FEE,PRACTICE_FEE,THESIS_PROJ_FEE,REGISTRATION_DATE,REG_STATUS,CURR_CODE,PROJECT_CODE,COURSE_TYPE,SUBSEC_NO,PAYMENT_ID) Values('" + dataInsert.Academic_Year + "','" + dataInsert.Semester + "','" + dataInsert.Course_Code + "','" + dataInsert.Student_ID + "','" + dataInsert.Nation_ID + "','" + dataInsert.Passport_ID + "','" + dataInsert.First_Thainame + "','" + dataInsert.Family_Thainame + "','" + dataInsert.First_Engname + "','" + dataInsert.Family_Engname + "','" + dataInsert.Faculty_Code + "','" + dataInsert.Department_Code + "','" + dataInsert.Major_Code + "','" + dataInsert.Spec_Field_Code + "','" + dataInsert.Reg_Type + "'," + dataInsert.Credit + "," + dataInsert.Sec_No + ",'" + dataInsert.Sec_Comment + "'," + dataInsert.Theory_Fee + "," + dataInsert.Practice_Fee + "," + dataInsert.Thesis_Project_Fee + ",'" + dataInsert.Registration_Date + "','" + dataInsert.Status + "','" + dataInsert.Curr_Code + "','" + dataInsert.Project_Code + "','" + dataInsert.Course_Type + "'" + "," + dataInsert.SubSec_No + ",'" + dataInsert.Payment_ID + "' )"; try { if (oracleObj.Insert() == 1) { response.Resgis_Status = "OK"; HisRegistrationData his_data = new HisRegistrationData(); his_data.date_time = DateTime.Now.ToString(); his_data.academic_year = dataInsert.Academic_Year; his_data.semester = dataInsert.Semester; his_data.student_id = dataInsert.Student_ID; his_data.nation_id = dataInsert.Nation_ID; his_data.passport_id = dataInsert.Passport_ID; his_data.reg_type = dataInsert.Reg_Type; his_data.course_code = dataInsert.Course_Code; his_data.course_type = dataInsert.Course_Type; his_data.sec = dataInsert.Sec_No; his_data.subsec = dataInsert.SubSec_No; his_data.payment_id = dataInsert.Payment_ID; his_data.credit = dataInsert.Credit; if (dataInsert.Course_Type == "1") { his_data.fee = dataInsert.Theory_Fee; } else if (dataInsert.Course_Type == "2") { his_data.fee = dataInsert.Practice_Fee; } else if (dataInsert.Course_Type == "4" || dataInsert.Course_Type == "5" || dataInsert.Course_Type == "7") { his_data.fee = dataInsert.Thesis_Project_Fee; } else { his_data.fee = 0; } new HistoryUpdate().insert_HisRegistration(his_data, degree_char); } } catch (Exception e) { response.Resgis_Status = e.Message.ToString(); } } else { response.Resgis_Status = "ตอนเรียนนี้ มีผู้เรียนครบตามจำนวนแล้ว"; } } // เคยลงทะเบียนแล้ว else { response.Resgis_Status = "ตรวจสอบพบการลงทะเบียนวิชานี้แล้ว"; } Response_Data.Add(response); } return(Response_Data); }
// V 1.0.0 public List <HisRegistrationData> get_HisRegistration(string academic_year, string semester, string student_id, string degree_char) { string tableName = getHisRegistrationTable(degree_char); List <HisRegistrationData> HisData = new List <HisRegistrationData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = "Select DATE_TIME,REG_TYPE From " + tableName + " Where ACADEMIC_YEAR='" + academic_year + "' And SEMESTER='" + semester + "' And STUDENT_ID='" + student_id + "' Group By DATE_TIME, REG_TYPE Order By to_date(DATE_TIME,'DD-MM-YYYY HH:MI:SS AM') ASC"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { HisRegistrationData his_data = new HisRegistrationData(); string datetime = rowData["DATE_TIME"].ToString(); string regtype = rowData["REG_TYPE"].ToString(); his_data.date_time = datetime; his_data.reg_type = regtype; oracleObj.SelectCommand = "Select * From " + tableName + " Where ACADEMIC_YEAR='" + academic_year + "' And SEMESTER='" + semester + "' And STUDENT_ID='" + student_id + "' And DATE_TIME='" + datetime + "' And REG_TYPE='" + regtype + "' Order By COURSE_CODE,SEC,SUBSEC"; DataView allData2 = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData2 in allData2) { his_data.academic_year = rowData2["ACADEMIC_YEAR"].ToString(); his_data.semester = rowData2["SEMESTER"].ToString(); his_data.student_id = rowData2["STUDENT_ID"].ToString(); his_data.nation_id = rowData2["NATION_ID"].ToString(); his_data.passport_id = rowData2["PASSPORT_ID"].ToString(); his_data.course_type = rowData2["COURSE_TYPE"].ToString(); his_data.sec = Convert.ToInt16(rowData2["SEC"].ToString()); his_data.subsec = Convert.ToInt16(rowData2["SUBSEC"].ToString()); his_data.old_sec = Convert.ToInt16(rowData2["OLD_SEC"].ToString()); his_data.old_subsec = Convert.ToInt16(rowData2["OLD_SUBSEC"].ToString()); his_data.credit = Convert.ToInt16(rowData2["CREDIT"].ToString()); his_data.fee = Convert.ToInt16(rowData2["FEE"].ToString()); string course_type = ""; if (his_data.course_type == "1") { course_type = "S."; } else if (his_data.course_type == "2") { course_type = "L."; } else if (his_data.course_type == "4") { course_type = "T."; } else if (his_data.course_type == "5") { course_type = "M."; } else if (his_data.course_type == "6") { course_type = "SP."; } else if (his_data.course_type == "7") { course_type = "D."; } if (his_data.subsec != 0) { course_type = course_type + his_data.subsec; } else { course_type = course_type + his_data.sec; } his_data.course_code += ", " + rowData2["COURSE_CODE"].ToString() + "(" + course_type + ")"; his_data.payment_id = rowData2["PAYMENT_ID"].ToString(); } his_data.course_code = his_data.course_code.Substring(2); HisData.Add(his_data); } return(HisData); }