void BindData1()
        {
            PS_STUDY PStudy = new PS_STUDY();
            DataTable dt1 = PStudy.SELECT_PS_STUDY(labelCitizenID.Text, "", "", "", "", "", "", "", "", "");
            GridViewStudy.DataSource = dt1;
            GridViewStudy.DataBind();
            SetViewState(dt1);

            PS_PROFESSIONAL_LICENSE PLicense = new PS_PROFESSIONAL_LICENSE();
            DataTable dt2 = PLicense.SELECT_PS_PROFESSIONAL_LICENSE(labelCitizenID.Text, "", "", "", "");
            GridViewLicense.DataSource = dt2;
            GridViewLicense.DataBind();
            SetViewState(dt2);

            PS_TRAINING PTraining = new PS_TRAINING();
            DataTable dt3 = PTraining.SELECT_PS_TRAINING(labelCitizenID.Text, "", "", "", "", "", "");
            GridViewTraining.DataSource = dt3;
            GridViewTraining.DataBind();
            SetViewState(dt3);

            PS_DISCIPLINARY_AND_AMNESTY PDAA = new PS_DISCIPLINARY_AND_AMNESTY();
            DataTable dt4 = PDAA.SELECT_PS_DISCIPLINARY_AND_AMNESTY(labelCitizenID.Text, "", "", "");
            GridViewDAA.DataSource = dt4;
            GridViewDAA.DataBind();
            SetViewState(dt4);

            PS_POSITION_AND_SALARY PPAS = new PS_POSITION_AND_SALARY();
            DataTable dt5 = PPAS.SELECT_PS_POSITION_AND_SALARY(labelCitizenID.Text, "", "", "", "", "", "", "", "");
            GridViewPAS.DataSource = dt5;
            GridViewPAS.DataBind();
            SetViewState(dt5);

            TB_PDH_GOVER PDHgover = new TB_PDH_GOVER();
            DataTable dt6 = PDHgover.SELECT_POSI_GOVER_ONLY(labelCitizenID.Text, "", "");
            GridviewPDHgover.DataSource = dt6;
            GridviewPDHgover.DataBind();
            SetViewState(dt6);

            TB_PDH_EMP PDHemp = new TB_PDH_EMP();
            DataTable dt7 = PDHemp.SELECT_POSI_EMP_ONLY(labelCitizenID.Text, "", "");
            GridviewPDHemp.DataSource = dt7;
            GridviewPDHemp.DataBind();
            SetViewState(dt7);
        }
 void BindData()
 {
     //GridViewStudy
     PS_STUDY PStudy = new PS_STUDY();
     DataTable dt1 = PStudy.SELECT_PS_STUDY(p, "", "", "", "", "", "", "", "", "");
     GridViewStudy.DataSource = dt1;
     GridViewStudy.DataBind();
     SetViewState(dt1);
     //GridViewLicense
     PS_PROFESSIONAL_LICENSE PLicense = new PS_PROFESSIONAL_LICENSE();
     DataTable dt2 = PLicense.SELECT_PS_PROFESSIONAL_LICENSE(p, "", "", "", "");
     GridViewLicense.DataSource = dt2;
     GridViewLicense.DataBind();
     SetViewState(dt2);
     //GridViewTraining
     PS_TRAINING PTraining = new PS_TRAINING();
     DataTable dt3 = PTraining.SELECT_PS_TRAINING(p, "", "", "", "", "", "");
     GridViewTraining.DataSource = dt3;
     GridViewTraining.DataBind();
     SetViewState(dt3);
     //GridViewDisciplinary
     PS_DISCIPLINARY_AND_AMNESTY PDAA = new PS_DISCIPLINARY_AND_AMNESTY();
     DataTable dt4 = PDAA.SELECT_PS_DISCIPLINARY_AND_AMNESTY(p, "", "", "");
     GridViewDAA.DataSource = dt4;
     GridViewDAA.DataBind();
     SetViewState(dt4);
     //GridViewPositionAndSalary
     PS_POSITION_AND_SALARY PPAS = new PS_POSITION_AND_SALARY();
     DataTable dt5 = PPAS.SELECT_PS_POSITION_AND_SALARY(p, "", "", "", "", "", "", "", "");
     GridViewPAS.DataSource = dt5;
     GridViewPAS.DataBind();
     SetViewState(dt5);
     //GridViewPositionDegreeHistoryGover
     TB_PDH_GOVER PDHgover = new TB_PDH_GOVER();
     DataTable dt6 = PDHgover.SELECT_POSI_GOVER_ONLY(p, "", "");
     GridviewPDHgover.DataSource = dt6;
     GridviewPDHgover.DataBind();
     SetViewState(dt6);
     //GridViewPositionDegreeHistoryEMP
     TB_PDH_EMP PDHemp = new TB_PDH_EMP();
     DataTable dt7 = PDHemp.SELECT_POSI_EMP_ONLY(p, "", "");
     GridviewPDHemp.DataSource = dt7;
     GridviewPDHemp.DataBind();
     SetViewState(dt7);
 }
        protected void modDeleteCommand5(Object sender, GridViewDeleteEventArgs e)
        {
            int id = Convert.ToInt32(GridViewPAS.DataKeys[e.RowIndex].Value);

            PS_POSITION_AND_SALARY PPAS = new PS_POSITION_AND_SALARY();
            PPAS.PS_PAS_ID = id;
            PPAS.DELETE_PS_POSITION_AND_SALARY();

            PS_PERSON P0 = new PS_PERSON();
            int salary = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT PS_SALARY FROM PS_POSITION_AND_SALARY ORDER BY PS_DATE DESC) WHERE ROWNUM = 1");
            int posisalary = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT PS_SALARY_POSITION FROM PS_POSITION_AND_SALARY ORDER BY PS_DATE DESC) WHERE ROWNUM = 1");

            P0.PS_SALARY = Convert.ToInt32(salary);
            P0.PS_POSS_SALARY = Convert.ToInt32(posisalary);
            P0.PS_CITIZEN_ID = p;
            P0.UPDATE_CURRENT_SALARY_PERSON();

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

            if (string.IsNullOrEmpty(labelCitizenID.Text))
            {
                GridViewPAS.EditIndex = -1;
                BindData();
            }
            else
            {
                GridViewPAS.EditIndex = -1;
                BindData1();
            }
        }
        protected void modUpdateCommand5(Object sender, GridViewUpdateEventArgs e)
        {
            Label lblPersonPASID = (Label)GridViewPAS.Rows[e.RowIndex].FindControl("lblPersonPASID");
            Label lblPersonPASCitizenID = (Label)GridViewPAS.Rows[e.RowIndex].FindControl("lblPersonPASCitizenID");
            TextBox txtPersonPASDate = (TextBox)GridViewPAS.Rows[e.RowIndex].FindControl("txtPersonPASDate");
            TextBox txtPersonPASPOsitionName = (TextBox)GridViewPAS.Rows[e.RowIndex].FindControl("txtPersonPASPOsitionName");
            TextBox txtPersonPASPositionNO = (TextBox)GridViewPAS.Rows[e.RowIndex].FindControl("txtPersonPASPositionNO");
            DropDownList ddlPersonPASPositionType = (DropDownList)GridViewPAS.Rows[e.RowIndex].FindControl("ddlPersonPASPositionType");
            DropDownList ddlPersonPASDegree = (DropDownList)GridViewPAS.Rows[e.RowIndex].FindControl("ddlPersonPASDegree");
            TextBox txtPersonPASSalary = (TextBox)GridViewPAS.Rows[e.RowIndex].FindControl("txtPersonPASSalary");
            TextBox txtPersonPASSalaryPosition = (TextBox)GridViewPAS.Rows[e.RowIndex].FindControl("txtPersonPASSalaryPosition");
            TextBox txtPersonPASRef = (TextBox)GridViewPAS.Rows[e.RowIndex].FindControl("txtPersonPASRef");

            PS_POSITION_AND_SALARY PPAS = new PS_POSITION_AND_SALARY(Convert.ToInt32(lblPersonPASID.Text)
                , lblPersonPASCitizenID.Text
                , Util.ODT(txtPersonPASDate.Text)
                , txtPersonPASPOsitionName.Text
                , txtPersonPASPositionNO.Text
                , ddlPersonPASPositionType.SelectedValue
                , ddlPersonPASDegree.SelectedValue
                , Convert.ToInt32(txtPersonPASSalary.Text)
                , Convert.ToInt32(txtPersonPASSalaryPosition.Text)
                , txtPersonPASRef.Text);

            if (txtPersonPASDate.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณากรอกวัน เดือน ปี</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }
            if (txtPersonPASPOsitionName.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณากรอกตำแหน่ง</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }
            if (txtPersonPASPositionNO.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณากรอกเลขที่ตำแหน่ง</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }
            if (ddlPersonPASPositionType.SelectedIndex == 0)
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณาเลือกตำแหน่งประเภท</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }
            if (ddlPersonPASDegree.SelectedIndex == 0)
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณาเลือกระดับ</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }
            if (txtPersonPASSalary.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณากรอกเงินเดือน</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }
            if (txtPersonPASSalaryPosition.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณากรอกเงินประจำตำแหน่ง</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }
            if (txtPersonPASRef.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณากรอกเอกสารอ้างอิง</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }

            PPAS.UPDATE_PS_POSITION_AND_SALARY();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true);
            if (string.IsNullOrEmpty(labelCitizenID.Text))
            {
                GridViewPAS.EditIndex = -1;
                BindData();
            }
            else
            {
                GridViewPAS.EditIndex = -1;
                BindData1();
            }
        }
        protected void lbuTab9Save_Click(object sender, EventArgs e)
        {
            if (tbDate14.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณากรอกวัน เดือน ปี</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }
            if (tbPosition14.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณากรอกตำแหน่ง</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }
            if (tbPositionNo14.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณากรอกเลขที่ตำแหน่ง</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }
            if (ddlPositionType14.SelectedIndex == 0)
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณาเลือกตำแหน่งประเภท</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }
            if (ddlPositionDegree14.SelectedIndex == 0)
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณาเลือกระดับ</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }
            if (tbSalary14.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณากรอกเงินเดือน</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }
            if (tbSalaryPosition14.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณากรอกเงินประจำตำแหน่ง</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }
            if (tbRef14.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>กรุณากรอกเอกสารอ้างอิง</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }

            PS_PERSON P0 = new PS_PERSON();
            PS_POSITION_AND_SALARY PPAS = new PS_POSITION_AND_SALARY();
            PPAS.PS_CITIZEN_ID = p;
            PPAS.PS_DATE = Util.ODT(tbDate14.Text);
            PPAS.PS_POSITION = tbPosition14.Text;
            PPAS.PS_POSITION_NO = tbPositionNo14.Text;
            PPAS.PS_POSITION_TYPE = ddlPositionType14.SelectedValue;
            PPAS.PS_POSITION_DEGREE = ddlPositionDegree14.SelectedValue;
            PPAS.PS_SALARY = Convert.ToInt32(tbSalary14.Text);
            PPAS.PS_SALARY_POSITION = Convert.ToInt32(tbSalaryPosition14.Text);
            PPAS.PS_REF = tbRef14.Text;
            PPAS.INSERT_PS_POSITION_AND_SALARY();

            int salary = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT PS_SALARY FROM PS_POSITION_AND_SALARY ORDER BY PS_DATE DESC) WHERE ROWNUM = 1");
            int posisalary = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT PS_SALARY_POSITION FROM PS_POSITION_AND_SALARY ORDER BY PS_DATE DESC) WHERE ROWNUM = 1");

            P0.PS_SALARY = Convert.ToInt32(salary);
            P0.PS_POSS_SALARY = Convert.ToInt32(posisalary);
            P0.PS_CITIZEN_ID = p;
            P0.UPDATE_CURRENT_SALARY_PERSON();

            ClearPPAS14();
            DataTable dt5 = PPAS.SELECT_PS_POSITION_AND_SALARY(p, "", "", "", "", "", "", "", "");
            GridViewPAS.DataSource = dt5;
            GridViewPAS.DataBind();
            SetViewState(dt5);

            notification.Attributes["class"] = "alert alert_success";
            notification.InnerHtml = "";
            notification.InnerHtml += "<div><img src='Image/Small/correct.png' /><strong>บันทึกข้อมูลตำแหน่งและเงินเดือนสำเร็จ</strong></div>";
        }