Exemple #1
0
        void BindData1()
        {
            ClassInsigRecord2 n  = new ClassInsigRecord2();
            DataTable         dt = n.GetInsigRecord2(txtSearchInsig2CITIZENID.Text, "", "", "", "", "", "", "", "", "", "", "");

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Exemple #2
0
        void BindData()
        {
            ClassInsigRecord2 n  = new ClassInsigRecord2();
            DataTable         dt = n.GetInsigRecord2("", "", "", "", "", "", "", "", "", "", "", "");

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Exemple #3
0
        protected void btnSearchRefresh_Click(object sender, EventArgs e)
        {
            ClearData();
            ClassInsigRecord2 n  = new ClassInsigRecord2();
            DataTable         dt = n.GetInsigRecord2("", "", "", "", "", "", "", "", "", "", "", "");

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);
        }
Exemple #4
0
        protected void btnSearchInsig2_Click(object sender, EventArgs e)
        {
            ClassInsigRecord2 n  = new ClassInsigRecord2();
            DataTable         dt = n.GetInsigRecord2(txtSearchInsig2CITIZENID.Text, "", "", "", "", "", "", "", "", "", "", "");

            GridView1.DataSource = dt;
            GridView1.DataBind();
            SetViewState(dt);

            ClassInsigRecord2 P = new ClassInsigRecord2();

            if (string.IsNullOrEmpty(txtSearchInsig2CITIZENID.Text))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ บัตรประชาชนในการค้นหา')", true);
                return;
            }
            if (txtSearchInsig2CITIZENID.Text.Length <= 12)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ บัตรประชาชนให้ครบ 13 หลัก')", true);
                return;
            }
            else
            {
                using (OracleConnection conn = Util.OC())
                {
                    using (OracleCommand cmd = new OracleCommand("select PERSON_NAME,PERSON_LASTNAME,TO_CHAR(INWORK_DATE,'dd MON yyyy','NLS_DATE_LANGUAGE = THAI') from tb_person where citizen_id = '" + txtSearchInsig2CITIZENID.Text + "'", conn))

                    {
                        using (OracleDataReader reader = cmd.ExecuteReader())
                        {
                            if (reader.HasRows)
                            {
                                while (reader.Read())
                                {
                                    txtSearchNAME.Text        = reader.IsDBNull(0) ? "" : reader.GetString(0);
                                    txtSearchLASTNAME.Text    = reader.IsDBNull(1) ? "" : reader.GetString(1);
                                    txtSearchDATE_INWORK.Text = reader.IsDBNull(2) ? "" : reader.GetString(2);
                                }
                            }
                            else
                            {
                                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ไม่พบรหัสบัตรประชาชนดังกล่าว')", true);
                                return;
                            }
                        }
                    }
                }
            }
        }
Exemple #5
0
        protected void modUpdateCommand(Object sender, GridViewUpdateEventArgs e)
        {
            if (string.IsNullOrEmpty(txtSearchInsig2CITIZENID.Text))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ บัตรประชาชนในการ Update')", true);
                return;
            }
            if (txtSearchInsig2CITIZENID.Text.Length <= 12)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ บัตรประชาชนให้ครบ 13 หลัก')", true);
                return;
            }

            Label    lblID         = (Label)GridView1.Rows[e.RowIndex].FindControl("lblID");
            Label    lblCITIZEN_ID = (Label)GridView1.Rows[e.RowIndex].FindControl("lblCITIZEN_ID");
            TextBox  lbl0          = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txt0");
            TextBox  txt1          = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txt1");
            TextBox  txt2          = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txt2");
            TextBox  txt3          = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txt3");
            TextBox  txt4          = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txt4");
            TextBox  txt5          = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txt5");
            TextBox  txt6          = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txt6");
            TextBox  lbl7          = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txt7");
            TextBox  txt8          = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txt8");
            TextBox  txt9          = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txt9");
            TextBox  txt10         = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txt10");
            DateTime DDATE         = DateTime.Parse(lbl0.Text);
            DateTime GAZETTE_DATE  = DateTime.Parse(lbl7.Text);

            ClassInsigRecord2 n = new ClassInsigRecord2(Convert.ToInt32(lblID.Text)
                                                        , lblCITIZEN_ID.Text
                                                        , DDATE
                                                        , txt1.Text
                                                        , txt2.Text
                                                        , txt3.Text
                                                        , txt4.Text
                                                        , txt5.Text
                                                        , txt6.Text
                                                        , GAZETTE_DATE
                                                        , txt8.Text
                                                        , txt9.Text
                                                        , txt10.Text);

            if (n.CheckHaveCitizenID())
            {
                n.UpdateInsigRecord2();
                ClearData();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true);
                GridView1.EditIndex = -1;

                DataTable dt = n.GetInsigRecord2(txtSearchInsig2CITIZENID.Text, "", "", "", "", "", "", "", "", "", "", "");
                GridView1.DataSource = dt;
                //GridView1.DataBind();

                SetViewState(dt);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ไม่มีรหัสประจำตัวประชาชนดังกล่าวที่จะอัพเดทข้อมูล !')", true);
            }
        }