Ejemplo n.º 1
0
        protected void btnSubmitPositionWork_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtInsertPositionWorkID.Text))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ รหัสตำแหน่งในสายงาน')", true);
                return;
            }
            if (string.IsNullOrEmpty(txtInsertPositionWorkName.Text))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ ชื่อตำแหน่งในสายงาน')", true);
                return;
            }
            ClassPositionWork pw = new ClassPositionWork();

            pw.POSITION_WORK_ID   = txtInsertPositionWorkID.Text;
            pw.POSITION_WORK_NAME = txtInsertPositionWorkName.Text;

            if (pw.CheckUsePositionWorkID())
            {
                pw.InsertPositionWork();
                BindData();
                ClearData();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('มีรหัสตำแหน่งในสายงานนี้ อยู่ในระบบแล้ว !')", true);
            }
        }
Ejemplo n.º 2
0
        void BindData1()
        {
            ClassPositionWork pw = new ClassPositionWork();
            DataTable         dt = pw.GetPositionWorkSearch(txtSearchPositionWorkID.Text, txtSearchPositionWorkName.Text);

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Ejemplo n.º 3
0
        void BindData()
        {
            ClassPositionWork pw = new ClassPositionWork();
            DataTable         dt = pw.GetPositionWork("", "");

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Ejemplo n.º 4
0
        protected void btnSearchRefresh_Click(object sender, EventArgs e)
        {
            ClearData();
            ClassPositionWork pw = new ClassPositionWork();
            DataTable         dt = pw.GetPositionWork("", "");

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Ejemplo n.º 5
0
        protected void modUpdateCommand(Object sender, GridViewUpdateEventArgs e)
        {
            TextBox txtPositionWorkIDEdit   = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtPositionWorkIDEdit");
            TextBox txtPositionWorkNameEdit = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtPositionWorkNameEdit");

            ClassPositionWork pw = new ClassPositionWork(txtPositionWorkIDEdit.Text, txtPositionWorkNameEdit.Text);

            pw.UpdatePositionWork();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true);
            GridView1.EditIndex = -1;
            BindData1();
        }
Ejemplo n.º 6
0
        protected void modDeleteCommand(Object sender, GridViewDeleteEventArgs e)
        {
            string            id = GridView1.DataKeys[e.RowIndex].Value.ToString();
            ClassPositionWork pw = new ClassPositionWork();

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

            GridView1.EditIndex = -1;
            BindData1();
        }
Ejemplo n.º 7
0
 protected void btnSearchPositionWork_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtSearchPositionWorkID.Text) && string.IsNullOrEmpty(txtSearchPositionWorkName.Text))
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true);
         return;
     }
     else
     {
         ClassPositionWork pw = new ClassPositionWork();
         DataTable         dt = pw.GetPositionWorkSearch(txtSearchPositionWorkID.Text, txtSearchPositionWorkName.Text);
         GridView1.DataSource = dt;
         GridView1.DataBind();
         SetViewState(dt);
     }
 }