示例#1
0
    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))
            {
                /*=============================*/
                Institute_Code = Request.QueryString["Institute_Code"];

                if (!Page.IsPostBack)
                {
                    preInstituteData = preInstituteObj.getPreInstitute(Institute_Code);


                    txtINSTITUTE_CODE.Text     = preInstituteData.Institute_Code;
                    txtINSTITUTE_THAINAME.Text = preInstituteData.Institute_Thainame;
                    txtINSTITUTE_ENGNAME.Text  = preInstituteData.Institute_Engname;

                    provinceData = provinceObj.getProvince();
                    foreach (ProvinceData data in provinceData)
                    {
                        ddlINSTITUTE_PROVINCE.Items.Insert(ddlINSTITUTE_PROVINCE.Items.Count, new ListItem(data.Province_ThaiName, data.Province_Code));
                    }
                    if (preInstituteData.Institute_Province_Code != "")
                    {
                        ddlINSTITUTE_PROVINCE.Items.FindByValue(preInstituteData.Institute_Province_Code).Selected = true;
                    }
                }
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
示例#2
0
    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)
                {
                    preInstituteData = preInstituteObj.getPreInstitute();

                    // Head Table
                    string[] ar = { "รหัสสถานศึกษา", "ชื่อสถานศึกษา (Thai)", "ชื่อสถานศึกษา (English)", "จังหวัด", "แก้ไข", "ลบ" };
                    //Table tb1 = new Table();
                    tblPreInstitute.Attributes.Add("class", "table table-bordered table-striped table-hover");
                    tblPreInstitute.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 > 4)
                        {
                            cellHead.Width = 100;
                        }

                        tRowHead.Cells.Add(cellHead);
                    }

                    tblPreInstitute.Rows.Add(tRowHead);

                    foreach (PreInstituteData data in preInstituteData)
                    {
                        TableRow tRowBody = new TableRow();
                        tRowBody.TableSection = TableRowSection.TableBody;

                        TableCell cellInstitute_Code = new TableCell();
                        cellInstitute_Code.Text     = data.Institute_Code;
                        cellInstitute_Code.CssClass = "text-center";
                        tRowBody.Cells.Add(cellInstitute_Code);

                        TableCell cellInstitute_Thainame = new TableCell();
                        cellInstitute_Thainame.Text = data.Institute_Thainame;
                        tRowBody.Cells.Add(cellInstitute_Thainame);

                        TableCell cellInstitute_Engname = new TableCell();
                        cellInstitute_Engname.Text = data.Institute_Engname;
                        tRowBody.Cells.Add(cellInstitute_Engname);

                        TableCell cellInstitute_Province_Code = new TableCell();
                        cellInstitute_Province_Code.Text = new Province().getProvince(data.Institute_Province_Code).Province_ThaiName;
                        tRowBody.Cells.Add(cellInstitute_Province_Code);

                        TableCell cellEdit = new TableCell();
                        string    urlEdit  = "edit_Grad_Institute.aspx?Institute_Code=" + data.Institute_Code;
                        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";
                        tRowBody.Cells.Add(cellEdit);

                        TableCell cellDel = new TableCell();
                        //string urlDel = "#";
                        string    urlDel = "delete_Grad_Institute.aspx?Institute_Code=" + data.Institute_Code;
                        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";
                        tRowBody.Cells.Add(cellDel);

                        tblPreInstitute.Rows.Add(tRowBody);
                    }
                }    //end !Page.IsPostBack
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }