/// <summary> /// เพิ่มข้อมูลลงตาราง CURRFORMAT /// </summary> /// <param name="dataInsert">CurrFormat Object</param> /// <returns>Success</returns> public string insertCurrFormat(CurrFormat dataInsert) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); string sql = "Insert into CURRFORMAT (CURRFORMATCODE, LEVELCODE, CURRFORMATNAME) values ('" + dataInsert.CurrFormatCode + "','" + dataInsert.LevelCode + "','" + dataInsert.CurrFormatName + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "Success"; } } catch (Exception e) { string exception = e.Message; HttpContext.Current.Session["response"] = "insertCurrFormat: " + exception; HttpContext.Current.Response.Redirect("../err_response.aspx"); } return(response); }
/// <summary> /// แก้ไขข้อมูลจากตาราง CURRFORMAT /// </summary> /// <param name="updateData">CurrFormat Object</param> /// <returns>Success</returns> public string updateCurrFormat(CurrFormat updateData) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); string sql = "Update CURRFORMAT Set LEVELCODE = '" + updateData.LevelCode + "', CURRFORMATNAME = '" + updateData.CurrFormatName + "' Where CURRFORMATCODE = '" + updateData.CurrFormatCode + "'"; oracleObj.UpdateCommand = sql; try { if (oracleObj.Update() == 1) { response = "Success"; } } catch (Exception e) { string exception = e.Message; HttpContext.Current.Session["response"] = "updateCurrFormat: " + exception; HttpContext.Current.Response.Redirect("../err_response.aspx"); } return(response); }
protected void btnOK_Click(object sender, EventArgs e) { string currFormatDelete = new CurrFormat().deleteCurrFormat(code); if (currFormatDelete == "Success") { Response.Redirect("listSTUDY_PLAN.aspx"); } }
protected void btnSAVE_Click(object sender, EventArgs e) { CurrFormat currFormatData = new CurrFormat(); currFormatData.CurrFormatCode = code; currFormatData.LevelCode = ddlDegree.SelectedValue; currFormatData.CurrFormatName = txtCURRFORMAT.Text; string currFormatUpdate = new CurrFormat().updateCurrFormat(currFormatData); if (currFormatUpdate == "Success") { Response.Redirect("listSTUDY_PLAN.aspx"); } }
protected void btnSAVE_Click(object sender, EventArgs e) { CurrFormat currFormatData = new CurrFormat(); currFormatData.CurrFormatCode = new TQF.TQFUtility().getMaxID("CURRFORMATCODE", "CURRFORMAT"); currFormatData.LevelCode = ddlDegree.SelectedValue; currFormatData.CurrFormatName = txtCURRFORMAT.Text; string currFormatInsert = new CurrFormat().insertCurrFormat(currFormatData); if (currFormatInsert == "Success") { Response.Redirect("listSTUDY_PLAN.aspx"); } }
protected void ddlCURRFORMAT_SelectedIndexChanged(object sender, EventArgs e) { string currFormatLevel = new CurrFormat().getCurrFormat(ddlCURRFORMAT.SelectedValue).LevelCode; List <CurrType> currType = new CurrType().getCurrType(); ddlCURRTYPE.Items.Clear(); ddlCURRTYPE.Items.Insert(ddlCURRTYPE.Items.Count, new ListItem("--- เลือกลักษณะโครงสร้างหลักสูตร ---", "0000")); foreach (CurrType row in currType) { if (row.LevelCode == currFormatLevel) { ddlCURRTYPE.Items.Insert(ddlCURRTYPE.Items.Count, new ListItem(row.CurrTypeName, row.CurrTypeCode)); } } }
/// <summary> /// เรียกดูข้อมูลจากตาราง CURRFORMAT /// </summary> /// <param name="CurrFormatCode">รหัสรูปแบบหลักสูตร</param> /// <returns>ข้อมูลจากตาราง CURRFORMAT</returns> public CurrFormat getCurrFormat(string CurrFormatCode) { CurrFormat CurrFormatData = new CurrFormat(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = "Select * From CURRFORMAT Where CURRFORMATCODE='" + CurrFormatCode + "'"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { CurrFormatData.CurrFormatCode = rowData["CURRFORMATCODE"].ToString(); CurrFormatData.LevelCode = rowData["LEVELCODE"].ToString(); CurrFormatData.CurrFormatName = rowData["CURRFORMATNAME"].ToString(); } return(CurrFormatData); }
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_department) || autro_obj.CheckGroupUser(login_data, group_var.officer_faculty)) { // ======== Process =========== code = Request.QueryString["token"]; CurrFormat currFormatData = new CurrFormat().getCurrFormat(code); if (!Page.IsPostBack) { List <TQF.Levels> level = new TQF.Levels().getLevels(); foreach (TQF.Levels row in level) { ddlDegree.Items.Insert(ddlDegree.Items.Count, new ListItem(row.LevelName, row.LevelCode)); } ddlDegree.Items.FindByValue(currFormatData.LevelCode).Selected = true; txtCURRFORMAT.Text = currFormatData.CurrFormatName; } //============================= } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }
/// <summary> /// เรียกดูข้อมูลจากตาราง CURRFORMAT /// </summary> /// <returns>ข้อมูลจากตาราง CURRFORMAT</returns> public List <CurrFormat> getCurrFormat() { List <CurrFormat> CurrFormatData = new List <CurrFormat>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = "Select * From CURRFORMAT Order By CURRFORMATCODE"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { CurrFormat CurrFormatRow = new CurrFormat(); CurrFormatRow.CurrFormatCode = rowData["CURRFORMATCODE"].ToString(); CurrFormatRow.LevelCode = rowData["LEVELCODE"].ToString(); CurrFormatRow.CurrFormatName = rowData["CURRFORMATNAME"].ToString(); CurrFormatData.Add(CurrFormatRow); } return(CurrFormatData); }
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_department) || autro_obj.CheckGroupUser(login_data, group_var.officer_faculty)) { // ======== Process =========== // Head Table string[] ar = { "รูปแบบหลักสูตร", "ระดับการศึกษา", "แก้ไข", "ลบ" }; tblStudyPlan.Attributes.Add("class", "table table-bordered table-striped table-hover"); tblStudyPlan.Attributes.Add("id", "dt_basic"); TableHeaderRow tRowHead = new TableHeaderRow(); tRowHead.TableSection = TableRowSection.TableHeader; for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++) { // Create a new cell and add it to the row. TableHeaderCell cellHead = new TableHeaderCell(); cellHead.Text = ar[cellCtr - 1]; tRowHead.Cells.Add(cellHead); } tblStudyPlan.Rows.Add(tRowHead); List <CurrFormat> currFormat = new List <CurrFormat>(); currFormat = new CurrFormat().getCurrFormat(); foreach (CurrFormat data in currFormat) { TableRow tRowBody = new TableRow(); tRowBody.TableSection = TableRowSection.TableBody; TableCell cellCurrFormatName = new TableCell(); cellCurrFormatName.Text = data.CurrFormatName; //cellCurrFormatName.Width = 200; tRowBody.Cells.Add(cellCurrFormatName); TableCell cellLevelCode = new TableCell(); cellLevelCode.Text = new Levels().getLevels(data.LevelCode).LevelName; cellLevelCode.Width = 200; tRowBody.Cells.Add(cellLevelCode); TableCell cellEdit = new TableCell(); string urlEdit = "editSTUDY_PLAN.aspx?token=" + data.CurrFormatCode; HyperLink hypEdit = new HyperLink(); hypEdit.Attributes.Add("data-target", "#editModal"); hypEdit.Attributes.Add("data-toggle", "modal"); hypEdit.Text = "<h4><i class='fa fa-edit'></i></h4>"; hypEdit.NavigateUrl = urlEdit; hypEdit.ToolTip = "Edit"; cellEdit.Controls.Add(hypEdit); cellEdit.CssClass = "text-center"; cellEdit.Width = 100; tRowBody.Cells.Add(cellEdit); TableCell cellDel = new TableCell(); string urlDel = "deleteSTUDY_PLAN.aspx?token=" + data.CurrFormatCode; HyperLink hypDel = new HyperLink(); hypDel.Attributes.Add("data-target", "#deleteModal"); hypDel.Attributes.Add("data-toggle", "modal"); hypDel.Text = "<h4><i class='fa fa-trash-o'></i></h4>"; hypDel.NavigateUrl = urlDel; hypDel.ToolTip = "Delete"; cellDel.Controls.Add(hypDel); cellDel.CssClass = "text-center"; cellDel.Width = 100; tRowBody.Cells.Add(cellDel); tblStudyPlan.Rows.Add(tRowBody); } //============================= } 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 =========== //ทดสอบ ชั่วคราว ลบออกเมื่อใช้งานจริง //Session["CurrCode"] = "707012555"; //Session["YearVersion"] = "2555"; //Session["NumTQF1"] = "001"; if (Session["CurrCode"] == null || Session["YearVersion"] == null || Session["NumTQF1"] == null) { Response.Redirect("listCURR.aspx"); } else { CurrCode = Session["CurrCode"].ToString(); YearVersion = Session["YearVersion"].ToString(); NumTQF1 = Session["NumTQF1"].ToString(); } TQF.Curriculum currTitle = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion); lblHeader1.Text = currTitle.CurrCode + " หลักสูตร" + currTitle.CurrThName; lblHeader2.Text = currTitle.CurrEnName; string currStatus; if (currTitle.CurrStatus == "1") { currStatus = "หลักสูตรใหม่"; lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")"; } if (currTitle.CurrStatus == "2") { currStatus = "หลักปรับปรุง"; lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")"; } if (!Page.IsPostBack) { List <CurrFormat> currFormat = new CurrFormat().getCurrFormat(); ddlCURRFORMAT.Items.Clear(); ddlCURRFORMAT.Items.Insert(ddlCURRFORMAT.Items.Count, new ListItem("--- เลือกรูปแบบหลักสูตร ---", "0000")); foreach (CurrFormat row in currFormat) { ddlCURRFORMAT.Items.Insert(ddlCURRFORMAT.Items.Count, new ListItem(row.CurrFormatName, row.CurrFormatCode)); } //List<CurrType> currType = new CurrType().getCurrType(); ddlCURRTYPE.Items.Clear(); ddlCURRTYPE.Items.Insert(ddlCURRTYPE.Items.Count, new ListItem("--- เลือกลักษณะโครงสร้างหลักสูตร ---", "0000")); //foreach (CurrType row in currType) //{ // ddlCURRTYPE.Items.Insert(ddlCURRTYPE.Items.Count, new ListItem(row.CurrTypeName, row.CurrTypeCode)); //} string sql = "Select * From MAJOR Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "'"; List <TQF.Major> major = new TQF.Major().getMajorManual(sql); if (major.Count == 0) { ddlMAJOR.Items.Clear(); ddlMAJOR.Items.Insert(ddlMAJOR.Items.Count, new ListItem("--- ไม่มีแขนงวิชา/กลุ่มวิชา ---", "0000")); } else { ddlMAJOR.Items.Clear(); ddlMAJOR.Items.Insert(ddlMAJOR.Items.Count, new ListItem("--- เลือกแขนงวิชา/กลุ่มวิชา ---", "0000")); foreach (TQF.Major row in major) { ddlMAJOR.Items.Insert(ddlMAJOR.Items.Count, new ListItem(row.MajorThName, row.MajorCode)); } } //List<CurrDisplay> currDisplay = new CurrDisplay().getCurrDisplay(); //ddlCURRDISPLAY.Items.Clear(); //ddlCURRDISPLAY.Items.Insert(ddlCURRDISPLAY.Items.Count, new ListItem("--- เลือกรุปแบบการแสดงผล ---", "00")); //foreach (CurrDisplay row in currDisplay) //{ // ddlCURRDISPLAY.Items.Insert(ddlCURRDISPLAY.Items.Count, new ListItem(row.CurrDisplayName, row.CurrDisplayCode)); //} } tableHeader(tblCurriculum3); tableBody(tblCurriculum3); //============================= } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }