Exemplo n.º 1
0
 protected void lbuRefresh_Click(object sender, EventArgs e)
 {
     ClearData();
     ClassStaff s = new ClassStaff();
     DataTable dt = s.GetStaff("");
     GridView1.DataSource = dt;
     GridView1.DataBind();
     SetViewState(dt);
 }
Exemplo n.º 2
0
 protected void lbuSearch_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtSearchStaffName.Text))
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true);
         return;
     }
     else
     {
         ClassStaff s = new ClassStaff();
         DataTable dt = s.GetStaff(txtSearchStaffName.Text);
         GridView1.DataSource = dt;
         GridView1.DataBind();
         SetViewState(dt);
     }
 }
Exemplo n.º 3
0
        protected void lbuSubmit_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtInsertStaffName.Text))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ ชื่อตำแหน่งประเภท')", true);
                return;
            }
            ClassStaff s = new ClassStaff();
            s.ST_NAME = txtInsertStaffName.Text;

            if (s.CheckUseStaffName())
            {
                s.InsertStaff();
                BindData();
                ClearData();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ข้อมูลที่จะเพิ่ม มีอยู่ในระบบแล้ว !')", true);
            }
        }
Exemplo n.º 4
0
        protected void modDeleteCommand(Object sender, GridViewDeleteEventArgs e)
        {
            int id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
            ClassStaff s = new ClassStaff();
            s.ST_ID = id;
            s.DeleteStaff();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true);

            GridView1.EditIndex = -1;
            BindData1();
        }
Exemplo n.º 5
0
 void BindData1()
 {
     ClassStaff s = new ClassStaff();
     DataTable dt = s.GetStaff(txtSearchStaffName.Text);
     GridView1.DataSource = dt;
     GridView1.DataBind();
     SetViewState(dt);
 }
Exemplo n.º 6
0
 void BindData()
 {
     ClassStaff s = new ClassStaff();
     DataTable dt = s.GetStaff("");
     GridView1.DataSource = dt;
     GridView1.DataBind();
     SetViewState(dt);
 }
Exemplo n.º 7
0
        protected void modUpdateCommand(Object sender, GridViewUpdateEventArgs e)
        {
            Label lblStaffIDEdit = (Label)GridView1.Rows[e.RowIndex].FindControl("lblStaffIDEdit");
            TextBox txtStaffNameEdit = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtStaffNameEdit");

            ClassStaff s = new ClassStaff(Convert.ToInt32(lblStaffIDEdit.Text)
                , txtStaffNameEdit.Text);

            if (s.CheckUseStaffName())
            {
                s.UpdateStaff();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true);
                GridView1.EditIndex = -1;
                BindData1();
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ข้อมูลที่จะอัพเดท มีอยู่ในระบบแล้ว !')", true);
            }
        }