Esempio n. 1
0
        protected void btnSubmitTimeContact_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtInsertTimeContactID.Text))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ รหัสระยะเวลาจ้าง')", true);
                return;
            }
            if (string.IsNullOrEmpty(txtInsertTimeContactName.Text))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ ชื่อระยะเวลาจ้าง')", true);
                return;
            }
            ClassTimeContact tc = new ClassTimeContact();

            tc.TIME_CONTACT_ID   = Convert.ToInt32(txtInsertTimeContactID.Text);
            tc.TIME_CONTACT_NAME = txtInsertTimeContactName.Text;

            if (tc.CheckUseTimeContactID())
            {
                tc.InsertTimeContact();
                BindData();
                ClearData();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('มีรหัสระยะเวลาจ้าง อยู่ในระบบแล้ว !')", true);
            }
        }
Esempio n. 2
0
        void BindData1()
        {
            ClassTimeContact tc = new ClassTimeContact();
            DataTable        dt = tc.GetTimeContact(txtSearchTimeContactID.Text, txtSearchTimeContactName.Text);

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Esempio n. 3
0
        void BindData()
        {
            ClassTimeContact tc = new ClassTimeContact();
            DataTable        dt = tc.GetTimeContact("", "");

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Esempio n. 4
0
        protected void btnSearchRefresh_Click(object sender, EventArgs e)
        {
            ClearData();
            ClassTimeContact tc = new ClassTimeContact();
            DataTable        dt = tc.GetTimeContact("", "");

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Esempio n. 5
0
        protected void modDeleteCommand(Object sender, GridViewDeleteEventArgs e)
        {
            int id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
            ClassTimeContact tc = new ClassTimeContact();

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

            GridView1.EditIndex = -1;
            BindData1();
        }
Esempio n. 6
0
        protected void modUpdateCommand(Object sender, GridViewUpdateEventArgs e)
        {
            TextBox txtTimeContactIDEdit   = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtTimeContactIDEdit");
            TextBox txtTimeContactNameEdit = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtTimeContactNameEdit");

            ClassTimeContact tc = new ClassTimeContact(Convert.ToInt32(txtTimeContactIDEdit.Text)
                                                       , txtTimeContactNameEdit.Text);

            tc.UpdateTimeContact();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true);
            GridView1.EditIndex = -1;
            BindData1();
        }
Esempio n. 7
0
 protected void btnSearchTimeContact_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtSearchTimeContactID.Text) && string.IsNullOrEmpty(txtSearchTimeContactName.Text))
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true);
         return;
     }
     else
     {
         ClassTimeContact tc = new ClassTimeContact();
         DataTable        dt = tc.GetTimeContactSearch(txtSearchTimeContactID.Text, txtSearchTimeContactName.Text);
         GridView1.DataSource = dt;
         GridView1.DataBind();
         SetViewState(dt);
     }
 }