コード例 #1
0
 protected void lbuRefresh_Click(object sender, EventArgs e)
 {
     ClearData();
     ClassBudget b = new ClassBudget();
     DataTable dt = b.GetBudget("");
     GridView1.DataSource = dt;
     GridView1.DataBind();
     SetViewState(dt);
 }
コード例 #2
0
 protected void lbuSearch_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtSearchBudgetName.Text))
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true);
         return;
     }
     else
     {
         ClassBudget b = new ClassBudget();
         DataTable dt = b.GetBudget(txtSearchBudgetName.Text);
         GridView1.DataSource = dt;
         GridView1.DataBind();
         SetViewState(dt);
     }
 }
コード例 #3
0
        protected void lbuSubmit_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtInsertBudgetName.Text))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ ชื่อประเภทเงินจ้าง')", true);
                return;
            }
            ClassBudget b = new ClassBudget();
            b.BUDGET_NAME = txtInsertBudgetName.Text;

            if (b.CheckUseBudgetName())
            {
                b.InsertBudget();
                BindData();
                ClearData();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ข้อมูลที่จะเพิ่ม มีอยู่ในระบบแล้ว !')", true);
            }
        }
コード例 #4
0
        protected void modDeleteCommand(Object sender, GridViewDeleteEventArgs e)
        {
            int id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
            ClassBudget b = new ClassBudget();
            b.BUDGET_ID = id;
            b.DeleteBudget();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true);

            GridView1.EditIndex = -1;
            BindData1();
        }
コード例 #5
0
 void BindData1()
 {
     ClassBudget b = new ClassBudget();
     DataTable dt = b.GetBudget(txtSearchBudgetName.Text);
     GridView1.DataSource = dt;
     GridView1.DataBind();
     SetViewState(dt);
 }
コード例 #6
0
 void BindData()
 {
     ClassBudget b = new ClassBudget();
     DataTable dt = b.GetBudget("");
     GridView1.DataSource = dt;
     GridView1.DataBind();
     SetViewState(dt);
 }
コード例 #7
0
        protected void modUpdateCommand(Object sender, GridViewUpdateEventArgs e)
        {
            Label lblBudgetIDEdit = (Label)GridView1.Rows[e.RowIndex].FindControl("lblBudgetIDEdit");
            TextBox txtBudgetNameEdit = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtBudgetNameEdit");

            ClassBudget b = new ClassBudget(Convert.ToInt32(lblBudgetIDEdit.Text)
                , txtBudgetNameEdit.Text);

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