public List <FacultyData> getFaculty(List <string> Faculty_Code) { List <FacultyData> Faculty_data = new List <FacultyData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); foreach (string fac in Faculty_Code) { oracleObj.SelectCommand = "Select * From FACULTY Where FACULTY_CODE='" + fac + "' "; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { FacultyData Faculty = new FacultyData(); Faculty.Faculty_Code = rowData["FACULTY_CODE"].ToString(); Faculty.Faculty_Thai = rowData["FACULTY_THAINAME"].ToString(); Faculty.Faculty_Eng = rowData["FACULTY_ENGNAME"].ToString(); Faculty.Faculty_ShortName = rowData["FACULTY_SHORTNAME"].ToString(); Faculty.Faculty_CampusCode = rowData["CAMPUS_CODE"].ToString(); Faculty.Faculty_Status = rowData["FACULTY_STATUS"].ToString(); Faculty_data.Add(Faculty); } } return(Faculty_data); }
public FacultyDto GetFacultyById(int facultyId) { FacultyData facultyData = new FacultyData(); FacultyDto facultyDto = facultyData.SelectFacultyById(facultyId); return(facultyDto); }
protected void btnSAVE_Click(object sender, EventArgs e) { //string sql = "Select * From FACULTY Where FACULTY_CODE='" + txtFacultyCode.Text + "'"; //List<FacultyData> facultyChk = new Faculty().getFacultyManual(sql); //if (facultyChk.Count > 0) //{ // Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('รหัสคณะซ้ำ!');", true); //} //else { FacultyData faculty = new FacultyData(); //faculty.Faculty_Code = txtFacultyCode.Text; faculty.Faculty_Code = getFacultyMaxID("FACULTY_CODE", "FACULTY"); faculty.Faculty_Thai = txtFacultyNameThai.Text; faculty.Faculty_Eng = txtFacultyNameEng.Text; faculty.Faculty_ShortName = txtFacultyShortName.Text; faculty.Faculty_CampusCode = ddlCampus.SelectedValue; faculty.Faculty_Status = ddlFacultyStatus.SelectedValue; string result = new Faculty().insertFaculty(faculty); Response.Redirect("list_Faculty.aspx"); } }
protected void btnSAVE_Click(object sender, EventArgs e) { FacultyData facultySave = new FacultyData(); facultySave.Faculty_CampusCode = ddlCampus.SelectedValue; facultySave.Faculty_Code = txtFacultyCode.Text; facultySave.Faculty_Thai = txtFacultyNameThai.Text; facultySave.Faculty_Eng = txtFacultyNameEng.Text; facultySave.Faculty_ShortName = txtFacultyShortName.Text; facultySave.Faculty_Status = ddlFacultyStatus.SelectedValue; try { String result = new Faculty().updateFaculty(facultySave); if (result.Equals("OK")) { //update DEPARTMENT Table string sql = "UPDATE DEPARTMENT SET DEPARTMENT_STATUS = '" + ddlFacultyStatus.SelectedValue + "' WHERE FACULTY_CODE = '" + txtFacultyCode.Text + "'"; string updateDepartment = new Department().updateDepartmentManual(sql); Response.Redirect("list_Faculty.aspx"); } } catch { Response.Redirect("list_Faculty.aspx"); } }
//Pongsarun 26/9/2015: use for config system public string insertFaculty(FacultyData dataInsert) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = ""; sql = "Insert Into FACULTY(FACULTY_CODE, FACULTY_THAINAME, FACULTY_ENGNAME, FACULTY_SHORTNAME, CAMPUS_CODE, FACULTY_STATUS) Values('" + dataInsert.Faculty_Code + "','" + dataInsert.Faculty_Thai + "','" + dataInsert.Faculty_Eng + "','" + dataInsert.Faculty_ShortName + "','" + dataInsert.Faculty_CampusCode + "','" + dataInsert.Faculty_Status + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); } return(response); }
protected void ddlDepartment_SelectedIndexChanged(object sender, EventArgs e) { if (autro_obj.CheckGroupUser(login_data, group_var.admin_department)) { ddlFaculty.Enabled = false; ddlFaculty.Items.Clear(); FacultyData faculty_data = new FacultyData(); faculty_data = new Faculty().getFaculty(ddlDepartment.SelectedValue.Substring(0, 2)); ddlFaculty.Items.Insert(ddlFaculty.Items.Count, new ListItem(faculty_data.Faculty_Thai, faculty_data.Faculty_Code)); } }
public long CreateFaculty(FacultyDto facultyDto) { Person personBL = new Person(); long newId = personBL.GetNextCode((int)EnumCommonClass.PersonType.Faculty); facultyDto.FacultyId = newId; facultyDto.Person.PersonId = newId; FacultyData facultyData = new FacultyData(); if (facultyData.InsertFaculty(facultyDto) > -1) { return(newId); } return(-1); }
public string updateFaculty(FacultyData updateData) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "UPDATE FACULTY SET FACULTY_THAINAME = '" + updateData.Faculty_Thai + "', FACULTY_ENGNAME = '" + updateData.Faculty_Eng + "', FACULTY_SHORTNAME = '" + updateData.Faculty_ShortName + "', CAMPUS_CODE = '" + updateData.Faculty_CampusCode + "', FACULTY_STATUS = '" + updateData.Faculty_Status + "' WHERE FACULTY_CODE = '" + updateData.Faculty_Code + "'"; oracleObj.UpdateCommand = sql; try { if (oracleObj.Update() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString() + " "; } return(response); }
public int EditFaculty(FacultyDto facultyDto) { FacultyData facultyData = new FacultyData(); return(facultyData.UpdateFaculty(facultyDto)); }
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.admin_university) || autro_obj.CheckGroupUser(login_data, group_var.admin_faculty) || autro_obj.CheckGroupUser(login_data, group_var.admin_department) || autro_obj.CheckGroupUser(login_data, group_var.admin_otherOffice)) { /*=============================*/ if (!Page.IsPostBack) { if (autro_obj.CheckGroupUser(login_data, group_var.admin_university) || autro_obj.CheckGroupUser(login_data, group_var.admin_faculty)) { rowAdd.Visible = true; } else { rowAdd.Visible = false; } if (autro_obj.CheckGroupUser(login_data, group_var.admin_university)) { divFaculty.Visible = false; divOffice.Visible = false; } else if (autro_obj.CheckGroupUser(login_data, group_var.admin_faculty)) { divFaculty.Visible = true; divOffice.Visible = false; } else if (autro_obj.CheckGroupUser(login_data, group_var.admin_department)) { divFaculty.Visible = true; divOffice.Visible = false; } else if (autro_obj.CheckGroupUser(login_data, group_var.admin_otherOffice)) { divFaculty.Visible = false; divOffice.Visible = true; } // admin มหาวิทยาลัย if (autro_obj.CheckGroupUser(login_data, group_var.admin_university) || autro_obj.CheckGroupUser(login_data, group_var.admin_faculty)) { // เลือกสังกัด ddlDivision.Enabled = true; // คณะ ddlFaculty.Items.Clear(); facultyData = facultyObj.getFaculty(); ddlFaculty.Items.Insert(0, new ListItem("--- เลือกคณะ ---", "00")); foreach (FacultyData data in facultyData) { ddlFaculty.Items.Insert(ddlFaculty.Items.Count, new ListItem(data.Faculty_Thai, data.Faculty_Code)); } } // admin คณะ if (autro_obj.CheckGroupUser(login_data, group_var.admin_faculty)) { // เลือกสังกัด ddlDivision.Enabled = false; ddlDivision.Items.Clear(); ddlDivision.Items.Insert(ddlDivision.Items.Count, new ListItem("คณะ/วิทยาลัย", "1")); List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.admin_faculty); // คณะ ddlFaculty.Items.Clear(); facultyData = facultyObj.getFaculty(faculty_authorized); ddlFaculty.Items.Insert(0, new ListItem("--- เลือกคณะ ---", "00")); foreach (FacultyData data in facultyData) { ddlFaculty.Items.Insert(ddlFaculty.Items.Count, new ListItem(data.Faculty_Thai, data.Faculty_Code)); } } // admin ภาควิชา if (autro_obj.CheckGroupUser(login_data, group_var.admin_department)) { // เลือกสังกัด ddlDivision.Enabled = false; ddlDivision.Items.Clear(); ddlDivision.Items.Insert(ddlDivision.Items.Count, new ListItem("คณะ/วิทยาลัย", "1")); List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.admin_department); // ภาควิชา ddlDepartment.Items.Clear(); departmentData = new Department().getDepartment(department_authorized); foreach (DepartmentData data in departmentData) { ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } // คณะ ddlFaculty.Enabled = false; FacultyData faculty_data = new FacultyData(); faculty_data = new Faculty().getFaculty(ddlDepartment.SelectedValue.Substring(0, 2)); ddlFaculty.Items.Insert(ddlFaculty.Items.Count, new ListItem(faculty_data.Faculty_Thai, faculty_data.Faculty_Code)); } // admin สำนักงาน if (autro_obj.CheckGroupUser(login_data, group_var.admin_otherOffice)) { // เลือกสังกัด ddlDivision.Enabled = false; ddlDivision.Items.Clear(); ddlDivision.Items.Insert(ddlDivision.Items.Count, new ListItem("สำนักงาน", "2")); //สำนักงาน List <string> otheroffice_authorized = autro_obj.getOtherOffice_Authorized(login_data, group_var.admin_otherOffice); otherOfficeData = otherOfficeObj.getOtherOffice(otheroffice_authorized); ddlOffice.Items.Clear(); ddlOffice.Items.Insert(0, new ListItem("--- เลือกสำนักงาน ---", "0000")); foreach (OtherOfficeData data in otherOfficeData) { ddlOffice.Items.Insert(ddlOffice.Items.Count, new ListItem(data.OtherOffice_ThaiName, data.OtherOffice_Code)); } } } //end !Page.IsPostBack /*=============================*/ } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }
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)) { // ======== Process =========== if (!Page.IsPostBack) { prefix = new Prefix().getPrefix(); foreach (PrefixData row in prefix) { ddlTITLE_THAINAME.Items.Insert(ddlTITLE_THAINAME.Items.Count, new ListItem(row.Prefix_Thai, row.Prefix_Code)); ddlTITLE_ENGNAME.Items.Insert(ddlTITLE_ENGNAME.Items.Count, new ListItem(row.Prefix_Eng, row.Prefix_Code)); } academicPosition = new AcademicPosition().getAcademicPosition(); foreach (AcademicPosition row in academicPosition) { ddlACADEMIC_POSITION.Items.Insert(ddlACADEMIC_POSITION.Items.Count, new ListItem(row.AcademicPositionThName, row.AcademicPositionCode)); } province = new TQF.Province().getProvince(); foreach (TQF.Province row in province) { ddlBirthProvince.Items.Insert(ddlBirthProvince.Items.Count, new ListItem(row.ProvinceThai, row.ProvinceCode)); ddlHomeProvince.Items.Insert(ddlHomeProvince.Items.Count, new ListItem(row.ProvinceThai, row.ProvinceCode)); ddlOfficeProvince.Items.Insert(ddlOfficeProvince.Items.Count, new ListItem(row.ProvinceThai, row.ProvinceCode)); } lecturerType = new LecturerType().getLecturerType(); foreach (LecturerType row in lecturerType) { ddlLECTURER_CAT.Items.Insert(ddlLECTURER_CAT.Items.Count, new ListItem(row.LecturerTypeName, row.LecturerTypeCode)); } List <LecturerType> lectuere_type_Data = new List <LecturerType>(); lectuere_type_Data = new LecturerType().getLecturerType2(); foreach (LecturerType row in lectuere_type_Data) { ddlLectuereType.Items.Insert(ddlLectuereType.Items.Count, new ListItem(row.LecturerTypeName, row.LecturerTypeCode)); } List <BoardPosData> position_Data = new List <BoardPosData>(); position_Data = new BoardPos().getBoardPos(); foreach (BoardPosData row in position_Data) { ddlLectuerePosition.Items.Insert(ddlLectuerePosition.Items.Count, new ListItem(row.Position_Thai, row.Position_Code)); } country = new Country().getCountry(); foreach (CountryData row in country) { ddlCountry.Items.Insert(ddlCountry.Items.Count, new ListItem(row.Country_ThaiName, row.Country_Code)); ddlEthnicity.Items.Insert(ddlEthnicity.Items.Count, new ListItem(row.Country_ThaiName, row.Country_Code)); ddlNationality.Items.Insert(ddlNationality.Items.Count, new ListItem(row.Country_ThaiName, row.Country_Code)); } ddlCountry.Items.FindByValue("066").Selected = true; ddlEthnicity.Items.FindByValue("066").Selected = true; ddlNationality.Items.FindByValue("066").Selected = true; occupation = new Occupation().getOccupation(); foreach (OccupationData row in occupation) { ddlOccupation.Items.Insert(ddlOccupation.Items.Count, new ListItem(row.Occupation_Thai, row.Occupation_Code)); } marital = new Marital().getMarital(); foreach (MaritalData row in marital) { ddlMarital.Items.Insert(ddlMarital.Items.Count, new ListItem(row.Marital_Thai, row.Marital_Code)); } religion = new Religion().getReligion(); foreach (ReligionData row in religion) { ddlReligion.Items.Insert(ddlReligion.Items.Count, new ListItem(row.Religion_ThaiName, row.Religion_Code)); } bank = new BankCode().getBankCode(); foreach (BankCodeData row in bank) { ddlBank.Items.Insert(ddlBank.Items.Count, new ListItem(row.Bank_ThaiName, row.Bank_Code)); } try { ddlBank.Items.FindByValue("002").Selected = true; } catch { } //วิชาการคณะ if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty)) { List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty); // คณะ facultyData = new Faculty().getFaculty(faculty_authorized); foreach (FacultyData data in facultyData) { ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(data.Faculty_Thai, data.Faculty_Code)); } departmentData = new Department().getDepartmentWithFaculty(ddlFACULTY.SelectedValue); ddlDEPARTMENT.Items.Clear(); ddlDEPARTMENT.Items.Insert(ddlDEPARTMENT.Items.Count, new ListItem("-- เลือก --", "0000")); foreach (DepartmentData data in departmentData) { ddlDEPARTMENT.Items.Insert(ddlDEPARTMENT.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } } //วิชาการภาค else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { ddlFACULTY.Enabled = false; ddlFACULTY.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC"); List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department); // ภาควิชา departmentData = new Department().getDepartment(department_authorized); ddlDEPARTMENT.Items.Clear(); ddlDEPARTMENT.Items.Insert(ddlDEPARTMENT.Items.Count, new ListItem("-- เลือก --", "0000")); foreach (DepartmentData data in departmentData) { ddlDEPARTMENT.Items.Insert(ddlDEPARTMENT.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } // คณะ faculty_data = new Faculty().getFaculty(ddlDEPARTMENT.SelectedValue.Substring(0, 2)); ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(faculty_data.Faculty_Thai, faculty_data.Faculty_Code)); } } // End if (!Page.IsPostBack) //============================= } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("../err_response.aspx"); } } }
protected void ddlDepartment_SelectedIndexChanged(object sender, EventArgs e) { string faculty_code = ddlFACULTY.SelectedValue; //วิชาการภาค if (autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { ddlFACULTY.Enabled = false; ddlFACULTY.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC"); List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department); // คณะ faculty_data = new Faculty().getFaculty(ddlDepartment.SelectedValue.Substring(0, 2)); ddlFACULTY.Items.Clear(); ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(faculty_data.Faculty_Thai, faculty_data.Faculty_Code)); } //อาจารย์ if (autro_obj.CheckGroupUser(login_data, group_var.lecturer)) { LectuereInformationData lecturer_data = new Lecturer().getLecturer(login_data.Nation_ID); ddlADVISOR.Items.Clear(); ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem(lecturer_data.Lecturer_ShortName + " " + lecturer_data.First_ThaiName + " " + lecturer_data.Family_ThaiName, lecturer_data.Lecturer_ID)); } else { // อาจารย์ LecturerData = new Lecturer().getLecturerbyDepartment(ddlDepartment.SelectedValue); ddlADVISOR.Items.Clear(); if (LecturerData.Count.Equals(0)) { ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem("--- ไม่พบข้อมูลอาจารย์ ---", "00")); } else { foreach (LectuereInformationData data in LecturerData) { ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID)); } } } // หลักสูตร string Curr_LevelCode = ""; if (ddlDEGREE.SelectedValue == "U") { Curr_LevelCode = "01"; } else if (ddlDEGREE.SelectedValue == "B") { Curr_LevelCode = "02"; } else if (ddlDEGREE.SelectedValue == "P") { Curr_LevelCode = "05"; } else if (ddlDEGREE.SelectedValue == "M") { Curr_LevelCode = "03"; } else if (ddlDEGREE.SelectedValue == "D") { Curr_LevelCode = "04"; } else if (ddlDEGREE.SelectedValue == "x") { Curr_LevelCode = "xx"; } string curr_sql = ""; if (Curr_LevelCode != "xx") { curr_sql = "Select * From CURRICULUM Where FACULTYCODE='" + faculty_code + "' AND DEPARTMENTCODE = '" + ddlDepartment.SelectedValue + "' AND LEVELCODE='" + Curr_LevelCode + "' AND CURRCODE!='999999999'"; } else { curr_sql = "Select * From CURRICULUM Where FACULTYCODE='" + faculty_code + "' AND DEPARTMENTCODE = '" + ddlDepartment.SelectedValue + "' AND CURRCODE!='999999999'"; } currData = new Curriculum().getManualCurriculum(curr_sql); ddlCURRICULUM.Items.Clear(); if (currData.Count.Equals(0)) { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem("--- ไม่พบข้อมูลหลักสูตร ---", "0")); } else { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem("--- แสดงทุกหลักสูตร ---", "x")); foreach (CurriculumGeneralData data in currData) { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem(data.Curr_Code + " " + data.Curr_ThaiName + " (" + data.Curr_Year + ")", data.Curr_Year + data.Curr_Code)); } } }
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.lecturer) || autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { // ======== Process =========== if (!Page.IsPostBack) { divShow.Visible = false; divFail.Visible = false; // ระดับการศึกษา degreeLevel = new Degree().getDegreeChar(); ddlDEGREE.Items.Insert(ddlDEGREE.Items.Count, new ListItem("ทุกระดับการศึกษา", "x")); foreach (DegreeData data in degreeLevel) { ddlDEGREE.Items.Insert(ddlDEGREE.Items.Count, new ListItem(data.Degree_Thai, data.Degree_Char)); } //อาจารย์ if (autro_obj.CheckGroupUser(login_data, group_var.lecturer)) { // คณะ facultyData = new Faculty().getFaculty(); ddlFACULTY.Items.Clear(); foreach (FacultyData data in facultyData) { ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(data.Faculty_Thai, data.Faculty_Code)); } departmentData = new Department().getDepartmentWithFaculty(ddlFACULTY.SelectedValue); ddlDepartment.Items.Clear(); foreach (DepartmentData data in departmentData) { ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } LectuereInformationData lecturer_data = new Lecturer().getLecturer(login_data.Nation_ID); ddlADVISOR.Items.Clear(); ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem(lecturer_data.Lecturer_ShortName + " " + lecturer_data.First_ThaiName + " " + lecturer_data.Family_ThaiName, lecturer_data.Lecturer_ID)); } //วิชาการคณะ else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty)) { List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty); // คณะ facultyData = new Faculty().getFaculty(faculty_authorized); foreach (FacultyData data in facultyData) { ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(data.Faculty_Thai, data.Faculty_Code)); } departmentData = new Department().getDepartmentWithFaculty(ddlFACULTY.SelectedValue); ddlDepartment.Items.Clear(); foreach (DepartmentData data in departmentData) { ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } // อาจารย์ LecturerData = new Lecturer().getLecturerbyDepartment(ddlDepartment.SelectedValue); ddlADVISOR.Items.Clear(); if (LecturerData.Count.Equals(0)) { ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem("--- ไม่พบข้อมูลอาจารย์ ---", "00")); } else { foreach (LectuereInformationData data in LecturerData) { ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID)); } } } //วิชาการภาค else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { ddlFACULTY.Enabled = false; ddlFACULTY.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC"); List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department); // ภาควิชา departmentData = new Department().getDepartment(department_authorized); foreach (DepartmentData data in departmentData) { ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } // คณะ faculty_data = new Faculty().getFaculty(ddlDepartment.SelectedValue.Substring(0, 2)); ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(faculty_data.Faculty_Thai, faculty_data.Faculty_Code)); // อาจารย์ LecturerData = new Lecturer().getLecturerbyDepartment(ddlDepartment.SelectedValue); ddlADVISOR.Items.Clear(); if (LecturerData.Count.Equals(0)) { ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem("--- ไม่พบข้อมูลอาจารย์ ---", "00")); } else { foreach (LectuereInformationData data in LecturerData) { ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID)); } } } // หลักสูตร string faculty_code = ddlFACULTY.SelectedValue; string Curr_LevelCode = ""; if (ddlDEGREE.SelectedValue == "U") { Curr_LevelCode = "01"; } else if (ddlDEGREE.SelectedValue == "B") { Curr_LevelCode = "02"; } else if (ddlDEGREE.SelectedValue == "P") { Curr_LevelCode = "05"; } else if (ddlDEGREE.SelectedValue == "M") { Curr_LevelCode = "03"; } else if (ddlDEGREE.SelectedValue == "D") { Curr_LevelCode = "04"; } else if (ddlDEGREE.SelectedValue == "x") { Curr_LevelCode = "xx"; } string curr_sql = ""; if (Curr_LevelCode != "xx") { curr_sql = "Select * From CURRICULUM Where FACULTYCODE='" + faculty_code + "' AND DEPARTMENTCODE = '" + ddlDepartment.SelectedValue + "' AND LEVELCODE='" + Curr_LevelCode + "' AND CURRCODE!='999999999'"; } else { curr_sql = "Select * From CURRICULUM Where FACULTYCODE='" + faculty_code + "' AND DEPARTMENTCODE = '" + ddlDepartment.SelectedValue + "' AND CURRCODE!='999999999'"; } currData = new Curriculum().getManualCurriculum(curr_sql); ddlCURRICULUM.Items.Clear(); if (currData.Count.Equals(0)) { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem("--- ไม่พบข้อมูลหลักสูตร ---", "0")); } else { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem("--- แสดงทุกหลักสูตร ---", "x")); foreach (CurriculumGeneralData data in currData) { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem(data.Curr_Code + " " + data.Curr_ThaiName + " (" + data.Curr_Year + ")", data.Curr_Year + data.Curr_Code)); } } } // ============================ } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }
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.admin_university) || autro_obj.CheckGroupUser(login_data, group_var.admin_faculty) || autro_obj.CheckGroupUser(login_data, group_var.admin_department) || autro_obj.CheckGroupUser(login_data, group_var.admin_otherOffice)) { /*=============================*/ userId = Request.QueryString["Uid"]; flag = Request.QueryString["flag"]; token = Request.QueryString["token"]; bool haverole = false; //if (autro_obj.CheckGroupUser(login_data, group_var.admin_university)) // { // haverole = true; // } if (autro_obj.CheckGroupUser(login_data, group_var.admin_faculty)) { List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.admin_faculty); foreach (string fac in faculty_authorized) { if (fac == token.Substring(0, 2)) { haverole = true; break; } } } //else if (autro_obj.CheckGroupUser(login_data, group_var.admin_department)) // { // List<string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.admin_department); // foreach(string dep in department_authorized) // { // if(dep == token) // { // haverole = true; // break; // } // } // } //else if (autro_obj.CheckGroupUser(login_data, group_var.admin_otherOffice)) // { // List<string> otheroffice_authorized = autro_obj.getOtherOffice_Authorized(login_data, group_var.admin_otherOffice); // foreach(string office in otheroffice_authorized) // { // if (office == token) // { // haverole = true; // break; // } // } // } else { haverole = false; } if (haverole == true) { userData = userObj.getUsers(userId); lblUserId.Text = userData.USERS_INFO_USER_ID; lblName.Text = new Prefix().getPrefix(userData.USERS_INFO_TITLE_THAINAME).Prefix_Thai; lblName.Text += userData.USERS_INFO_FIRST_THAINAME + " " + userData.USERS_INFO_FAMILY_THAINAME; if (userData.USERS_INFO_DEPARTMENT_ID == "0000") { lblDepartment.Text = "-"; } else { Department departmentObj = new Department(); lblDepartment.Text = departmentObj.getDepartment(userData.USERS_INFO_DEPARTMENT_ID).Department_Thai; } if (userData.USERS_INFO_FACULTY_ID == "00") { OtherOfficeData otherOffice = new OtherOffice().getOtherOffice(userData.OTHEROFFICE_CODE); lblFaculty.Text = otherOffice.OtherOffice_ThaiName; } else { Faculty facultyObj2 = new Faculty(); lblFaculty.Text = facultyObj2.getFaculty(userData.USERS_INFO_FACULTY_ID).Faculty_Thai; } // Head Table string[] ar = { "ระดับสิทธิ์", "ภาควิชา", "คณะ/วิทยาลัย/สำนักงาน", "ลบ" }; //Table tb1 = new Table(); tblUsers.Attributes.Add("class", "table table-bordered table-striped table-hover"); tblUsers.Attributes.Add("id", "dt_basic"); TableHeaderRow tRowHead = new TableHeaderRow(); tRowHead.TableSection = TableRowSection.TableHeader; for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++) { TableHeaderCell cellHead = new TableHeaderCell(); cellHead.Text = ar[cellCtr - 1]; if (cellCtr == 1) { cellHead.Width = 250; } else if (cellCtr == 4) { cellHead.Width = 80; } tRowHead.Cells.Add(cellHead); } tblUsers.Rows.Add(tRowHead); TableBody("Faculty", userId); TableBody("Department", userId); TableBody("Office", userId); if (!Page.IsPostBack) { //ซ่อน ddl สังกัดไว้ตอน page load if (flag == "1" || flag == "2") { ddlDivision.Items.FindByValue("1").Selected = true; //ddlFaculty.Items.FindByValue(token).Selected = true; // คณะ //List<string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.admin_faculty); ddlFaculty.Items.Clear(); FacultyData fac_data = new FacultyData(); fac_data = facultyObj.getFaculty(token.Substring(0, 2)); ddlFaculty.Items.Insert(ddlFaculty.Items.Count, new ListItem(fac_data.Faculty_Thai, fac_data.Faculty_Code)); //โหลดภาควิชา List <DepartmentData> departmentData = new List <DepartmentData>(); departmentData = new Department().getDepartmentWithFaculty(fac_data.Faculty_Code); ddlDepartment.Items.Clear(); ddlDepartment.Items.Insert(0, new ListItem("-- ไม่ได้สังกัดภาควิชา --", "0000")); foreach (DepartmentData data in departmentData) { ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } //โหลดระดับสิทธิ์ระดับคณะ userGroupData = userGroup.getUserGroup(); ddlGroup.Items.Clear(); foreach (UserGroupData data in userGroupData) { if (data.Users_Group_Id == "0300" || data.Users_Group_Id == "1101") { ddlGroup.Items.Insert(ddlGroup.Items.Count, new ListItem(data.Users_Group_Name, data.Users_Group_Id)); } } divOffice.Visible = false; } //if (flag == "2") // { // //โหลดภาควิชา // Department department = new Department(); // List<DepartmentData> departmentData = new List<DepartmentData>(); // //departmentData = department.getDepartmentWithFaculty(ddlFaculty.SelectedValue); // departmentData = department.getDepartment(); // ddlDepartment.Items.Clear(); // ddlDepartment.Items.Insert(0, new ListItem("-- ไม่ได้สังกัดภาควิชา --", "0000")); // foreach (DepartmentData data in departmentData) // { // ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); // } // string fac = new Department().getDepartment(token).Department_FacultyCode; // ddlDivision.Items.FindByValue("1").Selected = true; // ddlFaculty.Items.FindByValue(fac).Selected = true; // ddlDepartment.Items.FindByValue(token).Selected = true; // //โหลดระดับสิทธิ์ระดับภาควิชา // userGroupData = userGroup.getUserGroup(); // ddlGroup.Items.Clear(); // foreach (UserGroupData data in userGroupData) // { // if (data.Users_Group_Id == "0400" || data.Users_Group_Id == "1102" || data.Users_Group_Id == "0800") // { // ddlGroup.Items.Insert(ddlGroup.Items.Count, new ListItem(data.Users_Group_Name, data.Users_Group_Id)); // } // } // divOffice.Visible = false; // } if (flag == "3") { /////รหัสสิทธิ์ Users_Group_Id //0300 วิชาการคณะ //0200 เจ้าหน้าที่ทะเบียน สถิติ บณฑิต //0100 ผู้บริหารงานทะเบียน สถิติ บัณฑิต //0400 วิชาการภาค //0500 งานการเงิน //0800 อาจารย์ที่ปรึกษา/ผู้สอน //5000 งานธนาคาร //1103 ผู้ดูแลหน่วยงาน //0900 งานหลักสูตร //0700 งานทุนนักศึกษา //1000 ผู้บริหารมหาวิทยาลัย //1101 ผู้ดูแลระบบคณะ //1102 ผู้ดูแลลระบบภาควิชา //1100 ผู้ดูแลระบบหลัก //0600 งานกองแผนงาน divFaculty.Visible = false; ddlDivision.Items.FindByValue("2").Selected = true; ddlOffice.Items.FindByValue(token).Selected = true; //0500 กองแผนงาน if (ddlOffice.SelectedValue == "0500") { //โหลดระดับสิทธิ์ระดับสำนักงาน userGroupData = userGroup.getUserGroup(); ddlGroup.Items.Clear(); foreach (UserGroupData data in userGroupData) { if (data.Users_Group_Id == "0600" || data.Users_Group_Id == "1103") { ddlGroup.Items.Insert(ddlGroup.Items.Count, new ListItem(data.Users_Group_Name, data.Users_Group_Id)); } } } //2200 สำนักคอมพิวเตอร์และเทคโนโลยีสารสนเทศ if (ddlOffice.SelectedValue == "2200") { //โหลดระดับสิทธิ์ระดับสำนักงาน userGroupData = userGroup.getUserGroup(); ddlGroup.Items.Clear(); foreach (UserGroupData data in userGroupData) { if (data.Users_Group_Id == "1100" || data.Users_Group_Id == "1000" || data.Users_Group_Id == "5000") { ddlGroup.Items.Insert(ddlGroup.Items.Count, new ListItem(data.Users_Group_Name, data.Users_Group_Id)); } } } //0601 กองบริการการศึกษา if (ddlOffice.SelectedValue == "0601") { //โหลดระดับสิทธิ์ระดับสำนักงาน userGroupData = userGroup.getUserGroup(); ddlGroup.Items.Clear(); foreach (UserGroupData data in userGroupData) { if (data.Users_Group_Id == "0900" || data.Users_Group_Id == "0100" || data.Users_Group_Id == "0200" || data.Users_Group_Id == "1103") { ddlGroup.Items.Insert(ddlGroup.Items.Count, new ListItem(data.Users_Group_Name, data.Users_Group_Id)); } } } //1001 กองคลัง if (ddlOffice.SelectedValue == "1001") { //โหลดระดับสิทธิ์ระดับสำนักงาน userGroupData = userGroup.getUserGroup(); ddlGroup.Items.Clear(); foreach (UserGroupData data in userGroupData) { if (data.Users_Group_Id == "0500" || data.Users_Group_Id == "1103") { ddlGroup.Items.Insert(ddlGroup.Items.Count, new ListItem(data.Users_Group_Name, data.Users_Group_Id)); } } } //5001 ธนาคารกรุงเทพ if (ddlOffice.SelectedValue == "5001") { //โหลดระดับสิทธิ์ระดับสำนักงาน userGroupData = userGroup.getUserGroup(); ddlGroup.Items.Clear(); foreach (UserGroupData data in userGroupData) { if (data.Users_Group_Id == "5000") { ddlGroup.Items.Insert(ddlGroup.Items.Count, new ListItem(data.Users_Group_Name, data.Users_Group_Id)); } } } //0700 กองกิจการนักศึกษา if (ddlOffice.SelectedValue == "0700") { //โหลดระดับสิทธิ์ระดับสำนักงาน userGroupData = userGroup.getUserGroup(); ddlGroup.Items.Clear(); foreach (UserGroupData data in userGroupData) { if (data.Users_Group_Id == "0700" || data.Users_Group_Id == "1103") { ddlGroup.Items.Insert(ddlGroup.Items.Count, new ListItem(data.Users_Group_Name, data.Users_Group_Id)); } } } } } } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } /*=============================*/ } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }
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)) { // ======== Process =========== config_data = new SystemConfig().getConfig(); degree_char = ddlDEGREE.SelectedValue; if (!Page.IsPostBack) { divShow.Visible = false; divFail.Visible = false; txtACADEMIC_YEAR.Text = config_data.AcademicYear; AcademicYear = config_data.AcademicYear; ddlSEMESTER.Items.FindByValue(config_data.Semester).Selected = true; // ระดับการศึกษา degreeLevel = new Degree().getDegreeChar(); foreach (DegreeData data in degreeLevel) { ddlDEGREE.Items.Insert(ddlDEGREE.Items.Count, new ListItem(data.Degree_Thai, data.Degree_Char)); } //วิชาการคณะ if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty)) { List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty); // คณะ facultyData = new Faculty().getFaculty(faculty_authorized); foreach (FacultyData data in facultyData) { ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(data.Faculty_Thai, data.Faculty_Code)); } departmentData = new Department().getDepartmentWithFaculty(ddlFACULTY.SelectedValue); ddlDepartment.Items.Clear(); foreach (DepartmentData data in departmentData) { ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } } //วิชาการภาค else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { ddlFACULTY.Enabled = false; ddlFACULTY.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC"); List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department); // ภาควิชา departmentData = new Department().getDepartment(department_authorized); foreach (DepartmentData data in departmentData) { ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } // คณะ faculty_data = new Faculty().getFaculty(ddlDepartment.SelectedValue.Substring(0, 2)); ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(faculty_data.Faculty_Thai, faculty_data.Faculty_Code)); } // อาจารย์ LecturerData = new Lecturer().getLecturerbyDepartment(ddlDepartment.SelectedValue); ddlLecturer.Items.Clear(); if (LecturerData.Count.Equals(0)) { ddlLecturer.Items.Insert(ddlLecturer.Items.Count, new ListItem("--- ไม่พบข้อมูลอาจารย์ ---", "00")); } else { foreach (LectuereInformationData data in LecturerData) { ddlLecturer.Items.Insert(ddlLecturer.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID)); } } // หลักสูตร string Curr_LevelCode = ""; if (ddlDEGREE.SelectedValue == "U") { Curr_LevelCode = "01"; } else if (ddlDEGREE.SelectedValue == "B") { Curr_LevelCode = "02"; } else if (ddlDEGREE.SelectedValue == "P") { Curr_LevelCode = "05"; } else if (ddlDEGREE.SelectedValue == "M") { Curr_LevelCode = "03"; } else if (ddlDEGREE.SelectedValue == "D") { Curr_LevelCode = "04"; } string faculty_code = ddlFACULTY.SelectedValue; string curr_sql = "Select * From CURRICULUM Where FACULTYCODE='" + faculty_code + "' AND DEPARTMENTCODE = '" + ddlDepartment.SelectedValue + "' AND LEVELCODE='" + Curr_LevelCode + "' AND CURRCODE!='999999999'"; currData = new Curriculum().getManualCurriculum(curr_sql); ddlCURRICULUM.Items.Clear(); if (currData.Count.Equals(0)) { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem("--- เลือกหลักสูตร ---", "0")); } else { foreach (CurriculumGeneralData data in currData) { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem(data.Curr_Code + " " + data.Curr_ThaiName + " (" + data.Curr_Year + ")", data.Curr_Year + data.Curr_Code)); } } //กลุ่ม stdgroupData = new StdGroup().getStdGroup(); ddlStdGruop.Items.Clear(); ddlStdGruop.Items.Insert(ddlStdGruop.Items.Count, new ListItem("--- เลือกรอบ ---", "0")); foreach (StdGroupData data in stdgroupData) { ddlStdGruop.Items.Insert(ddlStdGruop.Items.Count, new ListItem(data.StdGroup_Thai, data.StdGroup_Code)); } // ประเภทนักศึกษา stdcatData = new StdCategory().getStdCategory(); ddlStdCategory.Items.Clear(); ddlStdCategory.Items.Insert(ddlStdCategory.Items.Count, new ListItem("--- เลือกประเภทนักศึกษา ---", "0")); foreach (StdCategoryData data in stdcatData) { ddlStdCategory.Items.Insert(ddlStdCategory.Items.Count, new ListItem(data.StdCategory_Thai, data.StdCategory_Code)); } // รอบ secData = new Section().getSection(); ddlSection.Items.Clear(); ddlSection.Items.Insert(ddlSection.Items.Count, new ListItem("--- เลือกรอบ ---", "0")); foreach (SectionData data in secData) { ddlSection.Items.Insert(ddlSection.Items.Count, new ListItem(data.Section_Thai, data.Section_Code)); } } AcademicYear = txtACADEMIC_YEAR.Text; // ========================== } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }
public FacultyViewModel() { _facultyData = new FacultyData(); }
public FacultyBusiness() { facultyData = new FacultyData(); }
protected void ddlDepartment_SelectedIndexChanged(object sender, EventArgs e) { string Curr_LevelCode = ""; if (ddlDEGREE.SelectedValue == "U") { Curr_LevelCode = "01"; } else if (ddlDEGREE.SelectedValue == "B") { Curr_LevelCode = "02"; } else if (ddlDEGREE.SelectedValue == "P") { Curr_LevelCode = "05"; } else if (ddlDEGREE.SelectedValue == "M") { Curr_LevelCode = "03"; } else if (ddlDEGREE.SelectedValue == "D") { Curr_LevelCode = "04"; } //วิชาการคณะ if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty)) { string faculty_code = ddlFACULTY.SelectedValue; string department_code = ddlDepartment.SelectedValue; string curr_sql = "Select * From CURRICULUM Where FACULTYCODE='" + faculty_code + "' AND DEPARTMENTCODE='" + department_code + "' AND CURRCODE!='999999999' AND LEVELCODE='" + Curr_LevelCode + "' AND APPROVESTATUS='Y' "; currData = new Curriculum().getManualCurriculum(curr_sql); ddlCURRICULUM.Items.Clear(); if (currData.Count.Equals(0)) { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem("--- เลือกหลักสูตร ---", "0")); } else { foreach (CurriculumGeneralData data in currData) { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem(data.Curr_Code + " " + data.Curr_ThaiName + " (" + data.Curr_Year + ")", data.Curr_Year + data.Curr_Code)); } } } //วิชาการภาค else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { ddlFACULTY.Enabled = false; string department_code = ddlDepartment.SelectedValue; faculty_data = new Faculty().getFaculty(department_code.Substring(0, 2)); ddlFACULTY.Items.Clear(); ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(faculty_data.Faculty_Thai, faculty_data.Faculty_Code)); string faculty_code = ddlFACULTY.SelectedValue; string curr_sql = "Select * From CURRICULUM Where FACULTYCODE='" + faculty_code + "' AND DEPARTMENTCODE='" + department_code + "' AND CURRCODE!='999999999' AND LEVELCODE='" + Curr_LevelCode + "' AND APPROVESTATUS='Y'"; currData = new Curriculum().getManualCurriculum(curr_sql); ddlCURRICULUM.Items.Clear(); if (currData.Count.Equals(0)) { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem("--- เลือกหลักสูตร ---", "0")); } else { foreach (CurriculumGeneralData data in currData) { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem(data.Curr_Code + " " + data.Curr_ThaiName + " (" + data.Curr_Year + ")", data.Curr_Year + data.Curr_Code)); } } } }
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)) { divFail.Visible = false; if (rbt1.Checked == true) { ddlServiceCURRICULUM.Enabled = false; ddlServiceCURRICULUM.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC"); ddlFACULTY.Enabled = true; ddlDepartment.Enabled = true; ddlCURRICULUM.Enabled = true; ddlFACULTY.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF"); ddlDepartment.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF"); ddlCURRICULUM.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF"); } else if (rbt2.Checked == true) { ddlFACULTY.Enabled = false; ddlDepartment.Enabled = false; ddlCURRICULUM.Enabled = false; ddlFACULTY.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC"); ddlDepartment.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC"); ddlCURRICULUM.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC"); ddlServiceCURRICULUM.Enabled = true; ddlServiceCURRICULUM.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF"); } if (!Page.IsPostBack) { Session.Remove("save_data"); Session.Remove("save_student"); Session.Remove("save_teaching"); Session.Remove("save_p_teaching"); Session.Remove("save_lecturer"); Session.Remove("selected_course"); Session.Remove("selected_t_course"); Session.Remove("Sec"); Session.Remove("number_student"); Session.Remove("service_course"); config_data = new TeachExamConfig().getTeachExamConfig(); txtACADEMIC_YEAR.Text = config_data.AcademicYear; academic_year = config_data.AcademicYear; ddlSEMESTER.Items.FindByValue(config_data.Semester).Selected = true; string faculty_code = ""; string department_code = ""; // ระดับการศึกษา degreeLevel = new Degree().getDegreeChar(); foreach (DegreeData data in degreeLevel) { ddlDEGREE.Items.Insert(ddlDEGREE.Items.Count, new ListItem(data.Degree_Thai, data.Degree_Char)); } string Curr_LevelCode = ""; if (ddlDEGREE.SelectedValue == "U") { Curr_LevelCode = "01"; } else if (ddlDEGREE.SelectedValue == "B") { Curr_LevelCode = "02"; } else if (ddlDEGREE.SelectedValue == "M") { Curr_LevelCode = "03"; } else if (ddlDEGREE.SelectedValue == "P") { Curr_LevelCode = "05"; } else if (ddlDEGREE.SelectedValue == "D") { Curr_LevelCode = "04"; } // ตรวจสอบกำหนดการ config_data1 = new TeachExamConfig().getTeachExamConfig(); int diffDate = -1; if (config_data1.Date_Stop != null) { diffDate = utlObj.getDiffDate(config_data1.Date_Stop, utlObj.getToday()); } //วิชาการคณะ if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty)) { List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty); facultyData = new Faculty().getFaculty(faculty_authorized); foreach (FacultyData data in facultyData) { ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(data.Faculty_Thai, data.Faculty_Code)); } faculty_code = ddlFACULTY.SelectedValue; departmentData = new Department().getDepartmentWithFaculty(faculty_code); foreach (DepartmentData data in departmentData) { int diffExtDate = -1; config_data2 = new TeachExamConfig().getExtendTeachExamConfig(data.Department_Code); if (config_data2.Date_Stop != null) { diffExtDate = utlObj.getDiffDate(config_data2.Date_Stop, utlObj.getToday()); } if (diffDate >= 0) { ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } else if (diffExtDate >= 0) { ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } else { ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem("<เกินกำหนด> " + data.Department_Thai, data.Department_Code.Substring(0, 2) + "xx")); //ddlDepartment.Items[ddlDepartment.Items.Count - 1].Attributes.Add("style", "color:red;"); } } department_code = ddlDepartment.SelectedValue; string curr_sql = "Select * From CURRICULUM Where FACULTYCODE='" + faculty_code + "' AND DEPARTMENTCODE='" + department_code + "' AND CURRCODE!='999999999' AND LEVELCODE='" + Curr_LevelCode + "' AND APPROVESTATUS='Y'"; currData = new Curriculum().getManualCurriculum(curr_sql); ddlCURRICULUM.Items.Clear(); if (currData.Count.Equals(0)) { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem("--- เลือกหลักสูตร ---", "0")); } else { foreach (CurriculumGeneralData data in currData) { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem(data.Curr_Code + " " + data.Curr_ThaiName + " (" + data.Curr_Year + ")", data.Curr_Year + data.Curr_Code)); } } } //วิชาการภาค else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { ddlFACULTY.Enabled = false; List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department); // ตรวจสอบกำหนดการ // config_data1 = new TeachExamConfig().getTeachExamConfig(); departmentData = new Department().getDepartment(department_authorized); foreach (DepartmentData data in departmentData) { int diffExtDate = -1; config_data2 = new TeachExamConfig().getExtendTeachExamConfig(data.Department_Code); if (config_data2.Date_Stop != null) { diffExtDate = utlObj.getDiffDate(config_data2.Date_Stop, utlObj.getToday()); } if (diffDate >= 0) { ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } else if (diffExtDate >= 0) { ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } else { ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem("<เกินกำหนด> " + data.Department_Thai, data.Department_Code.Substring(0, 2) + "xx")); //ddlDepartment.Items[ddlDepartment.Items.Count - 1].Attributes.Add("style", "color:red;"); } } department_code = ddlDepartment.SelectedValue; faculty_data = new Faculty().getFaculty(department_code.Substring(0, 2)); ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(faculty_data.Faculty_Thai, faculty_data.Faculty_Code)); faculty_code = ddlFACULTY.SelectedValue; string curr_sql = "Select * From CURRICULUM Where FACULTYCODE='" + faculty_code + "' AND DEPARTMENTCODE='" + department_code + "' AND CURRCODE!='999999999' AND LEVELCODE='" + Curr_LevelCode + "' AND APPROVESTATUS='Y'"; currData = new Curriculum().getManualCurriculum(curr_sql); ddlCURRICULUM.Items.Clear(); if (currData.Count.Equals(0)) { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem("--- เลือกหลักสูตร ---", "0")); } else { foreach (CurriculumGeneralData data in currData) { ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem(data.Curr_Code + " " + data.Curr_ThaiName, data.Curr_Year + data.Curr_Code)); } } } // วิชาบริการ string curr_sql2 = "Select * From CURRICULUM Where CURRCODE='999999999' AND LEVELCODE='" + Curr_LevelCode + "' AND APPROVESTATUS='Y'"; currData2 = new Curriculum().getManualCurriculum(curr_sql2); ddlServiceCURRICULUM.Items.Clear(); if (currData2.Count.Equals(0)) { ddlServiceCURRICULUM.Items.Insert(ddlServiceCURRICULUM.Items.Count, new ListItem("--- เลือกหลักสูตร ---", "0")); } else { foreach (CurriculumGeneralData data in currData2) { ddlServiceCURRICULUM.Items.Insert(ddlServiceCURRICULUM.Items.Count, new ListItem(data.Curr_ThaiName + " ( ปีหลักสูตร " + data.Curr_Year + " )", data.Curr_Year + data.Curr_Code)); } } } academic_year = txtACADEMIC_YEAR.Text; } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }
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)) { //========== Process ============ if (!Page.IsPostBack) { divSuccess.Visible = false; fail.Visible = false; try { roomtypeData = new RoomType().getRoomType(); foreach (RoomTypeData roomtype_data in roomtypeData) { ddlROOM_TYPE_CODE.Items.Insert(ddlROOM_TYPE_CODE.Items.Count, new ListItem(roomtype_data.RoomType_ThaiName, roomtype_data.RoomType_Code)); } ddlAFFIATION_CODE.Items.Insert(ddlAFFIATION_CODE.Items.Count, new ListItem("======= เลือกสังกัด =======", "0")); affiliationData = new Affiliation().getAffiliation(); foreach (AffiliationData affiliation in affiliationData) { ddlAFFIATION_CODE.Items.Insert(ddlAFFIATION_CODE.Items.Count, new ListItem(affiliation.Affiliation_Thai, affiliation.Affiliation_Code)); } campusData = new Campus().getCampus(); foreach (CampusData campus in campusData) { ddlCampus.Items.Insert(ddlCampus.Items.Count, new ListItem(campus.Campus_Thai, campus.Campus_Code)); } buildingData = new Building().getBuildingWithCampus(ddlCampus.SelectedValue); ddlBUILDING_CODE.Items.Insert(ddlBUILDING_CODE.Items.Count, new ListItem("======= เลือกอาคาร =======", "0")); foreach (BuildingData building in buildingData) { ddlBUILDING_CODE.Items.Insert(ddlBUILDING_CODE.Items.Count, new ListItem(building.Building_ThaiName, building.Building_Code)); } statusData = new Status().getSystemStatus(); foreach (StatusData status_data in statusData) { ddlROOM_STATUS.Items.Insert(ddlROOM_STATUS.Items.Count, new ListItem(status_data.Status_Thai, status_data.Status_Code)); } //วิชาการคณะ if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty)) { List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty); // คณะ facultyData = new Faculty().getFaculty(faculty_authorized); foreach (FacultyData data in facultyData) { ddlFACULTY_CODE.Items.Insert(ddlFACULTY_CODE.Items.Count, new ListItem(data.Faculty_Thai, data.Faculty_Code)); } //ภาควิชา departmentData = new Department().getDepartmentWithFaculty(ddlFACULTY_CODE.SelectedValue); ddlDEPARTMENT_CODE.Items.Clear(); foreach (DepartmentData department_data in departmentData) { ddlDEPARTMENT_CODE.Items.Insert(ddlDEPARTMENT_CODE.Items.Count, new ListItem(department_data.Department_Thai, department_data.Department_Code)); } } //วิชาการภาค else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { ddlFACULTY_CODE.Enabled = false; ddlFACULTY_CODE.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC"); List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department); // ภาควิชา departmentData = new Department().getDepartment(department_authorized); foreach (DepartmentData data in departmentData) { ddlDEPARTMENT_CODE.Items.Insert(ddlDEPARTMENT_CODE.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } // คณะ FacultyData faculty_data = new FacultyData(); faculty_data = new Faculty().getFaculty(ddlDEPARTMENT_CODE.SelectedValue.Substring(0, 2)); ddlFACULTY_CODE.Items.Insert(ddlFACULTY_CODE.Items.Count, new ListItem(faculty_data.Faculty_Thai, faculty_data.Faculty_Code)); } } catch { MsgValidate("ไม่สามารถดำเนินการได้ กรุณาทำใหม่อีกครั้ง"); } } //=============================== } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }