コード例 #1
0
        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);
        }
コード例 #2
0
 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);
 }
コード例 #3
0
        protected void modDeleteCommand1(Object sender, GridViewDeleteEventArgs e)
        {
            int id = Convert.ToInt32(GridViewStudy.DataKeys[e.RowIndex].Value);
            PS_STUDY PStudy = new PS_STUDY();
            PStudy.PS_STUDY_ID = id;
            PStudy.DELETE_PS_STUDY();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true);

            if (string.IsNullOrEmpty(labelCitizenID.Text))
            {
                GridViewStudy.EditIndex = -1;
                BindData();
            }
            else
            {
                GridViewStudy.EditIndex = -1;
                BindData1();
            }

            notification.Attributes["class"] = "none";
            notification.InnerHtml = "";
        }
コード例 #4
0
        protected void modUpdateCommand1(Object sender, GridViewUpdateEventArgs e)
        {
            Label lblPersonStudyID = (Label)GridViewStudy.Rows[e.RowIndex].FindControl("lblPersonStudyID");
            Label lblPersonStudyCitizenID = (Label)GridViewStudy.Rows[e.RowIndex].FindControl("lblPersonStudyCitizenID");
            DropDownList ddlPersonStudyDegreeID = (DropDownList)GridViewStudy.Rows[e.RowIndex].FindControl("ddlPersonStudyDegreeID");
            TextBox txtPersonStudyUnivName = (TextBox)GridViewStudy.Rows[e.RowIndex].FindControl("txtPersonStudyUnivName");
            DropDownList ddlPersonStudyFromMonth = (DropDownList)GridViewStudy.Rows[e.RowIndex].FindControl("ddlPersonStudyFromMonth");
            DropDownList ddlPersonStudyFromYear = (DropDownList)GridViewStudy.Rows[e.RowIndex].FindControl("ddlPersonStudyFromYear");
            DropDownList ddlPersonStudyToMonth = (DropDownList)GridViewStudy.Rows[e.RowIndex].FindControl("ddlPersonStudyToMonth");
            DropDownList ddlPersonStudyToYear = (DropDownList)GridViewStudy.Rows[e.RowIndex].FindControl("ddlPersonStudyToYear");
            TextBox txtPersonStudyQualification = (TextBox)GridViewStudy.Rows[e.RowIndex].FindControl("txtPersonStudyQualification");
            TextBox txtPersonStudyMajor = (TextBox)GridViewStudy.Rows[e.RowIndex].FindControl("txtPersonStudyMajor");
            DropDownList ddlPersonStudyCountryID = (DropDownList)GridViewStudy.Rows[e.RowIndex].FindControl("ddlPersonStudyCountryID");

            PS_STUDY PStudy = new PS_STUDY(Convert.ToInt32(lblPersonStudyID.Text)
                , lblPersonStudyCitizenID.Text
                , Convert.ToInt32(ddlPersonStudyDegreeID.SelectedValue)
                , txtPersonStudyUnivName.Text
                , Convert.ToInt32(ddlPersonStudyFromMonth.SelectedValue)
                , Convert.ToInt32(ddlPersonStudyFromYear.SelectedValue)
                , Convert.ToInt32(ddlPersonStudyToMonth.SelectedValue)
                , Convert.ToInt32(ddlPersonStudyToYear.SelectedValue)
                , txtPersonStudyQualification.Text
                , txtPersonStudyMajor.Text
                , Convert.ToInt32(ddlPersonStudyCountryID.SelectedValue));

            if (ddlPersonStudyDegreeID.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 (string.IsNullOrEmpty(txtPersonStudyUnivName.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 (ddlPersonStudyFromMonth.SelectedIndex == 0 && ddlPersonStudyFromYear.SelectedIndex == 0 && ddlPersonStudyToMonth.SelectedIndex == 0 && ddlPersonStudyToYear.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 (string.IsNullOrEmpty(txtPersonStudyQualification.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 (string.IsNullOrEmpty(txtPersonStudyMajor.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 (ddlPersonStudyCountryID.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 = "";
            }

            //เช็ค เลือก ระดับการศึกษาซ้ำ
            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("SELECT COUNT(*) FROM PS_STUDY WHERE PS_DEGREE_ID = '" + ddlPersonStudyDegreeID.SelectedValue + "'", con))
                {
                    using (OracleDataReader reader = com.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            if (reader.GetInt32(0) > 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
                            {
                                PStudy.UPDATE_PS_STUDY();
                                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true);
                                if (string.IsNullOrEmpty(labelCitizenID.Text))
                                {
                                    GridViewStudy.EditIndex = -1;
                                    BindData();
                                }
                                else
                                {
                                    GridViewStudy.EditIndex = -1;
                                    BindData1();
                                }

                                notification.Attributes["class"] = "none";
                                notification.InnerHtml = "";
                            }
                        }
                    }
                }
            }
        }
コード例 #5
0
        protected void lbuTab5Save_Click(object sender, EventArgs e)
        {
            if (ddlDegree10.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 (tbUnivName10.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 (ddlMonth10From.SelectedIndex == 0 && ddlYear10From.SelectedIndex == 0 && ddlMonth10To.SelectedIndex == 0 && ddlYear10To.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 (tbQualification10.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 (tbMajor10.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 (ddlCountrySuccess10.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 = "";
            }

            DateTime dtStudyFrom = new DateTime(int.Parse(ddlYear10From.SelectedValue), int.Parse(ddlMonth10From.SelectedValue), 1);
            DateTime dtStudyTo = new DateTime(int.Parse(ddlYear10To.SelectedValue), int.Parse(ddlMonth10To.SelectedValue), 1);

            if((dtStudyTo - dtStudyFrom).TotalDays < 28)
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>กรุณากรอกข้อมูลให้ครบถ้วน</strong></div>";
                notification.InnerHtml += "<div>ตั้งแต่ - ถึง (เดือน ปี) : ช่วงเวลาการศึกษาต้องมากกว่า 1 เดือน</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }

            //เช็ค เลือก ระดับการศึกษาซ้ำ
            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("SELECT COUNT(*) FROM PS_STUDY WHERE PS_DEGREE_ID = '" + ddlDegree10.SelectedValue + "'", con))
                {
                    using (OracleDataReader reader = com.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            if (reader.GetInt32(0) > 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 = "";
                            }
                        }
                    }
                }
            }

            PS_STUDY PStudy = new PS_STUDY();
            PStudy.PS_CITIZEN_ID = p;
            PStudy.PS_DEGREE_ID = Convert.ToInt32(ddlDegree10.SelectedValue);
            PStudy.PS_UNIV_NAME = tbUnivName10.Text;
            PStudy.PS_FROM_MONTH = Convert.ToInt32(ddlMonth10From.SelectedValue);
            PStudy.PS_FROM_YEAR = Convert.ToInt32(ddlYear10From.SelectedValue);
            PStudy.PS_TO_MONTH = Convert.ToInt32(ddlMonth10To.SelectedValue);
            PStudy.PS_TO_YEAR = Convert.ToInt32(ddlYear10To.SelectedValue);
            PStudy.PS_QUALIFICATION = tbQualification10.Text;
            PStudy.PS_MAJOR = tbMajor10.Text;
            PStudy.PS_COUNTRY_ID = Convert.ToInt32(ddlCountrySuccess10.SelectedValue);
            PStudy.INSERT_PS_STUDY();

            ClearPStudy10();
            DataTable dt1 = PStudy.SELECT_PS_STUDY(p, "", "", "", "", "", "", "", "", "");
            GridViewStudy.DataSource = dt1;
            GridViewStudy.DataBind();
            SetViewState(dt1);

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