Esempio n. 1
0
        protected void btnSubmitGradLev_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtInsertGradLevID.Text))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ รหัสระดับการศึกษาที่จบการศึกษาสูงสุด')", true);
                return;
            }
            if (string.IsNullOrEmpty(txtInsertGradLevName.Text))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ ชื่อระดับการศึกษาที่จบการศึกษาสูงสุด')", true);
                return;
            }
            ClassGradLev gl = new ClassGradLev();

            gl.GRAD_LEV_ID   = txtInsertGradLevID.Text;
            gl.GRAD_LEV_NAME = txtInsertGradLevName.Text;

            if (gl.CheckUseGradLevID())
            {
                gl.InsertGradLev();
                BindData();
                ClearData();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('มีรหัสระดับการศึกษาที่จบการศึกษาสูงสุดนี้ อยู่ในระบบแล้ว !')", true);
            }
        }
Esempio n. 2
0
        void BindData1()
        {
            ClassGradLev gl = new ClassGradLev();
            DataTable    dt = gl.GetGradLevSearch(txtSearchGradLevID.Text, txtSearchGradLevName.Text);

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Esempio n. 3
0
        void BindData()
        {
            ClassGradLev gl = new ClassGradLev();
            DataTable    dt = gl.GetGradLev("", "");

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Esempio n. 4
0
        protected void btnSearchRefresh_Click(object sender, EventArgs e)
        {
            ClearData();
            ClassGradLev gl = new ClassGradLev();
            DataTable    dt = gl.GetGradLev("", "");

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Esempio n. 5
0
        protected void modDeleteCommand(Object sender, GridViewDeleteEventArgs e)
        {
            string       id = GridView1.DataKeys[e.RowIndex].Value.ToString();
            ClassGradLev gl = new ClassGradLev();

            gl.GRAD_LEV_ID = id;
            gl.DeleteGradLev();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true);

            GridView1.EditIndex = -1;
            BindData1();
        }
Esempio n. 6
0
        protected void modUpdateCommand(Object sender, GridViewUpdateEventArgs e)
        {
            TextBox txtGradLevIDEdit   = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtGradLevIDEdit");
            TextBox txtGradLevNameEdit = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtGradLevNameEdit");

            ClassGradLev gl = new ClassGradLev(txtGradLevIDEdit.Text
                                               , txtGradLevNameEdit.Text);

            gl.UpdateGradLev();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true);
            GridView1.EditIndex = -1;
            BindData1();
        }
Esempio n. 7
0
 protected void btnSearchGradLev_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtSearchGradLevID.Text) && string.IsNullOrEmpty(txtSearchGradLevName.Text))
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true);
         return;
     }
     else
     {
         ClassGradLev gl = new ClassGradLev();
         DataTable    dt = gl.GetGradLevSearch(txtSearchGradLevID.Text, txtSearchGradLevName.Text);
         GridView1.DataSource = dt;
         GridView1.DataBind();
         SetViewState(dt);
     }
 }