Пример #1
0
        protected void btnSubmitBudget_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtInsertBudgetID.Text))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ รหัสประเภทเงินจ้าง')", true);
                return;
            }
            if (string.IsNullOrEmpty(txtInsertBudgetName.Text))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ ชื่อประเภทเงินจ้าง')", true);
                return;
            }
            ClassBudget b = new ClassBudget();

            b.BUDGET_ID   = Convert.ToInt32(txtInsertBudgetID.Text);
            b.BUDGET_NAME = txtInsertBudgetName.Text;

            if (b.CheckUseBudgetID())
            {
                b.InsertBudget();
                BindData();
                ClearData();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('มีรหัสประเภทเงินจ้างนี้ อยู่ในระบบแล้ว !')", true);
            }
        }
Пример #2
0
        void BindData1()
        {
            ClassBudget b  = new ClassBudget();
            DataTable   dt = b.GetBudgetSearch(txtSearchBudgetID.Text, txtSearchBudgetName.Text);

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Пример #3
0
        void BindData()
        {
            ClassBudget b  = new ClassBudget();
            DataTable   dt = b.GetBudget("", "");

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Пример #4
0
        protected void btnSearchRefresh_Click(object sender, EventArgs e)
        {
            ClearData();
            ClassBudget b  = new ClassBudget();
            DataTable   dt = b.GetBudget("", "");

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Пример #5
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();
        }
Пример #6
0
        protected void modUpdateCommand(Object sender, GridViewUpdateEventArgs e)
        {
            TextBox txtBudgetIDEdit   = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtBudgetIDEdit");
            TextBox txtBudgetNameEdit = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtBudgetNameEdit");

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

            b.UpdateBudget();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true);
            GridView1.EditIndex = -1;
            BindData1();
        }
Пример #7
0
 protected void btnSearchBudgetName_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtSearchBudgetID.Text) && string.IsNullOrEmpty(txtSearchBudgetName.Text))
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true);
         return;
     }
     else
     {
         ClassBudget b  = new ClassBudget();
         DataTable   dt = b.GetBudgetSearch(txtSearchBudgetID.Text, txtSearchBudgetName.Text);
         GridView1.DataSource = dt;
         GridView1.DataBind();
         SetViewState(dt);
     }
 }