Пример #1
0
        protected void btnSubmitTitle_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtInsertTitleID.Text))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ รหัสคำนำหน้านาม')", true);
                return;
            }
            if (string.IsNullOrEmpty(txtInsertTitleName.Text))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ ชื่อคำนำหน้านาม')", true);
                return;
            }
            ClassTitleName t = new ClassTitleName();

            t.TITLE_ID      = Convert.ToInt32(txtInsertTitleID.Text);
            t.TITLE_NAME_TH = txtInsertTitleName.Text;

            if (t.CheckUseTitleID())
            {
                t.InsertTitleName();
                BindData();
                ClearData();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('มีรหัสคำนำหน้านามนี้ อยู่ในระบบแล้ว !')", true);
            }
        }
Пример #2
0
        void BindData1()
        {
            ClassTitleName t  = new ClassTitleName();
            DataTable      dt = t.GetTitleNameSearch(txtSearchTitleID.Text, txtSearchTitleName.Text);

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

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

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Пример #5
0
        protected void modUpdateCommand(Object sender, GridViewUpdateEventArgs e)
        {
            TextBox txtTitleIDEDIT   = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtTitleIDEDIT");
            TextBox txtTitleNameEDIT = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtTitleNameEDIT");

            ClassTitleName t = new ClassTitleName(Convert.ToInt32(txtTitleIDEDIT.Text), txtTitleNameEDIT.Text);

            t.UpdateTitleName();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true);
            GridView1.EditIndex = -1;
            BindData1();
        }
Пример #6
0
        protected void modDeleteCommand(Object sender, GridViewDeleteEventArgs e)
        {
            int            id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
            ClassTitleName t  = new ClassTitleName();

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

            GridView1.EditIndex = -1;
            BindData1();
        }
Пример #7
0
 protected void btnSearchTitle_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtSearchTitleID.Text) && string.IsNullOrEmpty(txtSearchTitleName.Text))
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true);
         return;
     }
     else
     {
         ClassTitleName t  = new ClassTitleName();
         DataTable      dt = t.GetTitleNameSearch(txtSearchTitleID.Text, txtSearchTitleName.Text);
         GridView1.DataSource = dt;
         GridView1.DataBind();
         SetViewState(dt);
     }
 }