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)) { /*=============================*/ code = Request.QueryString["token"]; if (!Page.IsPostBack) { data = obj.getStdGroup(code); txtGROUP_CODE.Text = data.StdGroup_Code; txtGROUP_THAINAME.Text = data.StdGroup_Thai; txtGROUP_ENGNAME.Text = data.StdGroup_Eng; } /*=============================*/ } 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)) { /*=============================*/ if (!Page.IsPostBack) { //โหลดสำนักงาน Data = Obj.getStdGroup(); // Head Table string[] ar = { "รหัสกลุ่มผู้รียน", "ชื่อกลุ่มผู้เรียน (Thai)", "ชื่อกลุ่มผู้เรียน (English)", "แก้ไข", "ลบ" }; //Table tb1 = new Table(); tblGroup.Attributes.Add("class", "table table-bordered table-striped table-hover"); tblGroup.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]; if (cellCtr == 1 || cellCtr > 3) { cellHead.Width = 100; } tRowHead.Cells.Add(cellHead); } tblGroup.Rows.Add(tRowHead); foreach (StdGroupData data in Data) { TableRow tRowBody = new TableRow(); tRowBody.TableSection = TableRowSection.TableBody; TableCell cellCode = new TableCell(); cellCode.Text = data.StdGroup_Code; tRowBody.Cells.Add(cellCode); TableCell cellThai = new TableCell(); cellThai.Text = data.StdGroup_Thai; tRowBody.Cells.Add(cellThai); TableCell cellEng = new TableCell(); cellEng.Text = data.StdGroup_Eng; tRowBody.Cells.Add(cellEng); TableCell cellEdit = new TableCell(); string urlEdit = "edit_Student_Group.aspx?token=" + data.StdGroup_Code; HyperLink hypEdit = new HyperLink(); hypEdit.Attributes.Add("data-target", "#editStudent_Group"); 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"; tRowBody.Cells.Add(cellEdit); TableCell cellDel = new TableCell(); //string urlDel = "#"; string urlDel = "delete_Student_Group.aspx?token=" + data.StdGroup_Code; HyperLink hypDel = new HyperLink(); hypDel.Attributes.Add("data-target", "#deleteStudent_Group"); 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"; tRowBody.Cells.Add(cellDel); tblGroup.Rows.Add(tRowBody); } } //end !Page.IsPostBack /*=============================*/ } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }