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 modDeleteCommandEmp(Object sender, GridViewDeleteEventArgs e)
        {
            int id = Convert.ToInt32(GridviewPDHemp.DataKeys[e.RowIndex].Value);
            TB_PDH_EMP PDHemp = new TB_PDH_EMP();
            PDHemp.PDH_ID = id;
            PDHemp.DELETE_PS_PROFESSIONAL_LICENSE();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true);

            if (string.IsNullOrEmpty(labelCitizenID.Text))
            {
                GridviewPDHemp.EditIndex = -1;
                BindData();
            }
            else
            {
                GridviewPDHemp.EditIndex = -1;
                BindData1();
            }
        }
        protected void modUpdateCommandEmp(Object sender, GridViewUpdateEventArgs e)
        {
            Label lblPDHidEmp = (Label)GridviewPDHemp.Rows[e.RowIndex].FindControl("lblPDHidEmp");
            Label lblPDHcitizenIDEmp = (Label)GridviewPDHemp.Rows[e.RowIndex].FindControl("lblPDHcitizenIDEmp");
            TextBox txtPDHdateEmp = (TextBox)GridviewPDHemp.Rows[e.RowIndex].FindControl("txtPDHdateEmp");
            DropDownList ddlPDHpositionGetEmp = (DropDownList)GridviewPDHemp.Rows[e.RowIndex].FindControl("ddlPDHpositionGetEmp");

            TB_PDH_EMP PDHemp = new TB_PDH_EMP(Convert.ToInt32(lblPDHidEmp.Text)
                , lblPDHcitizenIDEmp.Text
                , Util.ODT(txtPDHdateEmp.Text)
                , Convert.ToInt32(ddlPDHpositionGetEmp.SelectedValue));

            PDHemp.UPDATE_POSI_EMP_ONLY();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true);
            if (string.IsNullOrEmpty(labelCitizenID.Text))
            {
                GridviewPDHemp.EditIndex = -1;
                BindData();
            }
            else
            {
                GridviewPDHemp.EditIndex = -1;
                BindData1();
            }
        }
        protected void lbuTab4Save_Click(object sender, EventArgs e)
        {
            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING)) {
                con.Open();
                int staffTypeID = -1;
                using (OracleCommand com = new OracleCommand("SELECT PS_STAFFTYPE_ID FROM PS_PERSON WHERE PS_CITIZEN_ID = '" + p + "'", con)) {
                    using (OracleDataReader reader = com.ExecuteReader()) {
                        while (reader.Read()) {
                            staffTypeID = reader.GetInt32(0);
                        }
                    }
                }

                idPositionShowAll.Visible = false;
                idPositionShowGover.Visible = false;
                idPositionShowOfficeEmp.Visible = false;

                GridviewPDHgover.Visible = false;
                GridviewPDHemp.Visible = false;

                if (staffTypeID == 1)
                {
                    idPositionShowAll.Visible = true;
                    idPositionShowGover.Visible = true;
                    GridviewPDHgover.Visible = true;
                }
                else if (staffTypeID == 2)
                {
                    idPositionShowAll.Visible = true;
                }
                else if (staffTypeID == 3)
                {
                    idPositionShowAll.Visible = true;
                }
                else if (staffTypeID == 4)
                {
                    idPositionShowAll.Visible = true;
                }
                else if (staffTypeID == 5)
                {
                    idPositionShowAll.Visible = true;
                }
                else if (staffTypeID == 6)
                {
                    idPositionShowAll.Visible = true;
                    idPositionShowOfficeEmp.Visible = true;
                    GridviewPDHemp.Visible = true;
                }

                {
                    if (ddlTab4PositionWorkRow1.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 (ddlTab4AdminPositionRow1.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 (ddlTab4AcadPositionRow1.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 = "";
                    }

                    //บันทึก 3 ตัว
                    PS_PERSON P0 = new PS_PERSON();
                    P0.PS_WORK_POS_ID = Convert.ToInt32(ddlTab4PositionWorkRow1.SelectedValue);
                    P0.PS_ADMIN_POS_ID = Convert.ToInt32(ddlTab4AdminPositionRow1.SelectedValue);
                    P0.PS_ACAD_POS_ID = Convert.ToInt32(ddlTab4AcadPositionRow1.SelectedValue);
                    P0.PS_CITIZEN_ID = p;
                    P0.UPDATE_PS_PERSON_TAB4_EVERYONE();

                    if (chkBoxWorkPosition.Checked)
                    {
                        PS_PERSON P2 = new PS_PERSON();
                        P2.PS_START_POSI_ID = Convert.ToInt32(ddlTab4PositionWorkRow1.SelectedValue);
                        P2.PS_CITIZEN_ID = p;
                        P2.UPDATE_PS_PERSON_START_WORK_POSITION_FIRST_TIME();

                    }
                    if (chkBoxAdminPosition.Checked)
                    {
                        PS_PERSON P3 = new PS_PERSON();
                        P3.PS_START_ADMIN_POSI_ID = Convert.ToInt32(ddlTab4AdminPositionRow1.SelectedValue);
                        P3.PS_CITIZEN_ID = p;
                        P3.UPDATE_PS_PERSON_START_ADMIN_POSITION_FIRST_TIME();
                    }

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

                if (staffTypeID == 1) {

                    if (ddlTab4PositionWorkRow1.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 (ddlTab4AdminPositionRow1.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 (ddlTab4AcadPositionRow1.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 (ddlShowMenuGoverTab4.SelectedIndex == 1)
                    {
                        if (tbDateGetPositionGoverTab4.Text == "" || ddlTab4AdminPositionDegreeRow2.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 (ddlShowMenuGoverTab4.SelectedIndex == 2)
                    {
                        if (tbDateGetPositionGoverTab4.Text == "" || ddlTab4DirectPositionDegreeRow2.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 (ddlShowMenuGoverTab4.SelectedIndex == 3)
                    {
                        if (tbDateGetPositionGoverTab4.Text == "" || ddlTab4AcadPositionDegreeRow2.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 (ddlShowMenuGoverTab4.SelectedIndex == 4)
                    {
                        if (tbDateGetPositionGoverTab4.Text == "" || ddlTab4GeneralPositionDegreeRow2.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 = "";
                    }

                    //เลือกได้แค่ 1 อัน
                    //***

                    ddlShowMenuGoverTab4.SelectedIndex = 0;

                    //มีอยู่แล้วในระบบ ห้ามเลือกซ้ำ
                    //DropMiddle1 - ตำแหน่งประเภทบริหาร
                    string result1 = "";
                    using (OracleCommand com = new OracleCommand("SELECT PDH_POSITION_GET FROM TB_PDH_GOVER WHERE PDH_POSITION_GET = '" + ddlTab4AdminPositionDegreeRow2.SelectedValue + "'", con))
                    {
                        using (OracleDataReader reader = com.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                result1 = reader.GetInt32(0).ToString();
                            }
                        }
                    }
                    if (result1 == ddlTab4AdminPositionDegreeRow2.SelectedValue)
                    {
                        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 = "";
                    }
                    //DropMiddle2 - ตำแหน่งประเภทอำนวยการ
                    string result2 = "";
                    using (OracleCommand com = new OracleCommand("SELECT PDH_POSITION_GET FROM TB_PDH_GOVER WHERE PDH_POSITION_GET = '" + ddlTab4DirectPositionDegreeRow2.SelectedValue + "'", con))
                    {
                        using (OracleDataReader reader = com.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                result2 = reader.GetInt32(0).ToString();
                            }
                        }
                    }
                    if (result2 == ddlTab4DirectPositionDegreeRow2.SelectedValue)
                    {
                        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 = "";
                    }
                    //DropMiddle3 - ตำแหน่งประเภทวิชาการ
                    string result3 = "";
                    using (OracleCommand com = new OracleCommand("SELECT PDH_POSITION_GET FROM TB_PDH_GOVER WHERE PDH_POSITION_GET = '" + ddlTab4AcadPositionDegreeRow2.SelectedValue + "'", con))
                    {
                        using (OracleDataReader reader = com.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                result3 = reader.GetInt32(0).ToString();
                            }
                        }
                    }
                    if (result3 == ddlTab4AcadPositionDegreeRow2.SelectedValue)
                    {
                        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 = "";
                    }
                    //DropMiddle4 - ตำแหน่งประเภททั่วไป
                    string result4 = "";
                    using (OracleCommand com = new OracleCommand("SELECT PDH_POSITION_GET FROM TB_PDH_GOVER WHERE PDH_POSITION_GET = '" + ddlTab4GeneralPositionDegreeRow2.SelectedValue + "'", con))
                    {
                        using (OracleDataReader reader = com.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                result4 = reader.GetInt32(0).ToString();
                            }
                        }
                    }
                    if (result4 == ddlTab4GeneralPositionDegreeRow2.SelectedValue)
                    {
                        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 (ddlTab4AdminPositionDegreeRow2.SelectedIndex == 0 && ddlTab4DirectPositionDegreeRow2.SelectedIndex == 0 && ddlTab4AcadPositionDegreeRow2.SelectedIndex == 0 && ddlTab4GeneralPositionDegreeRow2.SelectedIndex == 0)
                    {
                        //กลาง
                        PS_PERSON P0 = new PS_PERSON();
                        TB_PDH_GOVER P1 = new TB_PDH_GOVER();
                        P0.PS_WORK_POS_ID = Convert.ToInt32(ddlTab4PositionWorkRow1.SelectedValue);
                        P0.PS_ADMIN_POS_ID = Convert.ToInt32(ddlTab4AdminPositionRow1.SelectedValue);
                        P0.PS_ACAD_POS_ID = Convert.ToInt32(ddlTab4AcadPositionRow1.SelectedValue);
                        P0.PS_POSI_ADMIN = Convert.ToInt32(ddlTab4AdminPositionDegreeRow2.SelectedValue);
                        P0.PS_POSI_DIRECT = Convert.ToInt32(ddlTab4DirectPositionDegreeRow2.SelectedValue);
                        P0.PS_POSI_ACAD = Convert.ToInt32(ddlTab4AcadPositionDegreeRow2.SelectedValue);
                        P0.PS_POSI_GENERAL = Convert.ToInt32(ddlTab4GeneralPositionDegreeRow2.SelectedValue);
                        P0.PS_CITIZEN_ID = p;
                        P0.UPDATE_PS_PERSON_TAB4_EVERYONE_GOVER();

                        DataTable dt = P1.SELECT_POSI_GOVER_ONLY(p, "", "");
                        GridviewPDHgover.DataSource = dt;
                        GridviewPDHgover.DataBind();
                        SetViewState(dt);

                        notification.Attributes["class"] = "alert alert_success";
                        notification.InnerHtml = "";
                        notification.InnerHtml += "<div><img src='Image/Small/correct.png' /><strong>บันทึกข้อมูลตำแหน่งสำเร็จ</strong></div>";
                    }
                    else
                    {
                        //กลาง ////////////////////////////
                        PS_PERSON P0 = new PS_PERSON();
                        P0.PS_WORK_POS_ID = Convert.ToInt32(ddlTab4PositionWorkRow1.SelectedValue);
                        P0.PS_ADMIN_POS_ID = Convert.ToInt32(ddlTab4AdminPositionRow1.SelectedValue);
                        P0.PS_ACAD_POS_ID = Convert.ToInt32(ddlTab4AcadPositionRow1.SelectedValue);
                        P0.PS_POSI_ADMIN = Convert.ToInt32(ddlTab4AdminPositionDegreeRow2.SelectedValue);
                        P0.PS_POSI_DIRECT = Convert.ToInt32(ddlTab4DirectPositionDegreeRow2.SelectedValue);
                        P0.PS_POSI_ACAD = Convert.ToInt32(ddlTab4AcadPositionDegreeRow2.SelectedValue);
                        P0.PS_POSI_GENERAL = Convert.ToInt32(ddlTab4GeneralPositionDegreeRow2.SelectedValue);
                        P0.PS_CITIZEN_ID = p;
                        P0.UPDATE_PS_PERSON_TAB4_EVERYONE_GOVER();

                        TB_PDH_GOVER P1 = new TB_PDH_GOVER();
                        P1.PDH_CITIZEN_ID = p;
                        P1.PDH_DATE_START = Util.ODT(tbDateGetPositionGoverTab4.Text);

                        if(ddlTab4AdminPositionDegreeRow2.SelectedIndex != 0)
                        {
                            P1.PDH_POSITION_GET = Convert.ToInt32(ddlTab4AdminPositionDegreeRow2.SelectedValue);
                        }
                        if (ddlTab4DirectPositionDegreeRow2.SelectedIndex != 0)
                        {
                            P1.PDH_POSITION_GET = Convert.ToInt32(ddlTab4DirectPositionDegreeRow2.SelectedValue);
                        }
                        if (ddlTab4AcadPositionDegreeRow2.SelectedIndex != 0)
                        {
                            P1.PDH_POSITION_GET = Convert.ToInt32(ddlTab4AcadPositionDegreeRow2.SelectedValue);
                        }
                        if (ddlTab4GeneralPositionDegreeRow2.SelectedIndex != 0)
                        {
                            P1.PDH_POSITION_GET = Convert.ToInt32(ddlTab4GeneralPositionDegreeRow2.SelectedValue);
                        }

                        P1.INSERT_POSI_GOVER_ONLY();

                        ClearMiddleTab4();
                        DataTable dt = P1.SELECT_POSI_GOVER_ONLY(p, "", "");
                        GridviewPDHgover.DataSource = dt;
                        GridviewPDHgover.DataBind();
                        SetViewState(dt);

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

                } else if (staffTypeID == 6) {
                    if (ddlTab4PositionWorkRow1.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 (ddlTab4AdminPositionRow1.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 (ddlTab4AcadPositionRow1.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 (ddlTab4EmpPositionRow3.SelectedIndex != 0)
                    {
                        if (tbDateGetPositionEMPTab4.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 = "";
                    }

                    //DropRight1 - ตำแหน่งพนักงานราชการ
                    string result5 = "";
                    using (OracleCommand com = new OracleCommand("SELECT PDH_POSITION_GET FROM TB_PDH_EMP WHERE PDH_POSITION_GET = '" + ddlTab4EmpPositionRow3.SelectedValue + "'", con))
                    {
                        using (OracleDataReader reader = com.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                result5 = reader.GetInt32(0).ToString();
                            }
                        }
                    }
                    if (result5 == ddlTab4EmpPositionRow3.SelectedValue)
                    {
                        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 (ddlTab4EmpPositionRow3.SelectedIndex == 0)
                    {
                        //ขวา
                        PS_PERSON P0 = new PS_PERSON();
                        TB_PDH_EMP P2 = new TB_PDH_EMP();
                        P0.PS_WORK_POS_ID = Convert.ToInt32(ddlTab4PositionWorkRow1.SelectedValue);
                        P0.PS_ADMIN_POS_ID = Convert.ToInt32(ddlTab4AdminPositionRow1.SelectedValue);
                        P0.PS_ACAD_POS_ID = Convert.ToInt32(ddlTab4AcadPositionRow1.SelectedValue);
                        P0.PS_POSI_EMP_GROUP = Convert.ToInt32(ddlTab4EmpPositionRow3.SelectedValue);
                        P0.PS_CITIZEN_ID = p;
                        P0.UPDATE_PS_PERSON_TAB4_EVERYONE_EMP();

                        DataTable dt = P2.SELECT_POSI_EMP_ONLY(p, "", "");
                        GridviewPDHemp.DataSource = dt;
                        GridviewPDHemp.DataBind();
                        SetViewState(dt);

                        notification.Attributes["class"] = "alert alert_success";
                        notification.InnerHtml = "";
                        notification.InnerHtml += "<div><img src='Image/Small/correct.png' /><strong>บันทึกข้อมูลตำแหน่งสำเร็จ</strong></div>";
                    }
                    else
                    {
                        //ขวา
                        PS_PERSON P0 = new PS_PERSON();
                        P0.PS_WORK_POS_ID = Convert.ToInt32(ddlTab4PositionWorkRow1.SelectedValue);
                        P0.PS_ADMIN_POS_ID = Convert.ToInt32(ddlTab4AdminPositionRow1.SelectedValue);
                        P0.PS_ACAD_POS_ID = Convert.ToInt32(ddlTab4AcadPositionRow1.SelectedValue);
                        P0.PS_POSI_EMP_GROUP = Convert.ToInt32(ddlTab4EmpPositionRow3.SelectedValue);
                        P0.PS_CITIZEN_ID = p;
                        P0.UPDATE_PS_PERSON_TAB4_EVERYONE_EMP();

                        TB_PDH_EMP P2 = new TB_PDH_EMP();
                        P2.PDH_CITIZEN_ID = p;
                        P2.PDH_DATE_START = Util.ODT(tbDateGetPositionEMPTab4.Text);

                        if (ddlTab4EmpPositionRow3.SelectedIndex != 0)
                        {
                            P2.PDH_POSITION_GET = Convert.ToInt32(ddlTab4EmpPositionRow3.SelectedValue);
                        }

                        P2.INSERT_POSI_EMP_ONLY();

                        ClearRightTab4();
                        DataTable dt = P2.SELECT_POSI_EMP_ONLY(p, "", "");
                        GridviewPDHemp.DataSource = dt;
                        GridviewPDHemp.DataBind();
                        SetViewState(dt);

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

                }
            }
        }