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 modDeleteCommand3(Object sender, GridViewDeleteEventArgs e) { int id = Convert.ToInt32(GridViewTraining.DataKeys[e.RowIndex].Value); PS_TRAINING PTraining = new PS_TRAINING(); PTraining.PS_TRAINING_ID = id; PTraining.DELETE_PS_TRAINING(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true); if (string.IsNullOrEmpty(labelCitizenID.Text)) { GridViewTraining.EditIndex = -1; BindData(); } else { GridViewTraining.EditIndex = -1; BindData1(); } }
protected void modUpdateCommand3(Object sender, GridViewUpdateEventArgs e) { Label lblPersonTrainingID = (Label)GridViewTraining.Rows[e.RowIndex].FindControl("lblPersonTrainingID"); Label lblPersonTrainingCitizenID = (Label)GridViewTraining.Rows[e.RowIndex].FindControl("lblPersonTrainingCitizenID"); TextBox txtPersonTrainingCourse = (TextBox)GridViewTraining.Rows[e.RowIndex].FindControl("txtPersonTrainingCourse"); DropDownList ddlPersonTrainingFromMonth = (DropDownList)GridViewTraining.Rows[e.RowIndex].FindControl("ddlPersonTrainingFromMonth"); DropDownList ddlPersonTrainingFromYear = (DropDownList)GridViewTraining.Rows[e.RowIndex].FindControl("ddlPersonTrainingFromYear"); DropDownList ddlPersonTrainingToMonth = (DropDownList)GridViewTraining.Rows[e.RowIndex].FindControl("ddlPersonTrainingToMonth"); DropDownList ddlPersonTrainingToYear = (DropDownList)GridViewTraining.Rows[e.RowIndex].FindControl("ddlPersonTrainingToYear"); TextBox txtPersonTrainingDepartment = (TextBox)GridViewTraining.Rows[e.RowIndex].FindControl("txtPersonTrainingDepartment"); PS_TRAINING PTraining = new PS_TRAINING(Convert.ToInt32(lblPersonTrainingID.Text) , lblPersonTrainingCitizenID.Text , txtPersonTrainingCourse.Text , Convert.ToInt32(ddlPersonTrainingFromMonth.SelectedValue) , Convert.ToInt32(ddlPersonTrainingFromYear.SelectedValue) , Convert.ToInt32(ddlPersonTrainingToMonth.SelectedValue) , Convert.ToInt32(ddlPersonTrainingToYear.SelectedValue) , txtPersonTrainingDepartment.Text); if (txtPersonTrainingCourse.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 (ddlPersonTrainingFromMonth.SelectedIndex == 0 && ddlPersonTrainingFromYear.SelectedIndex == 0 && ddlPersonTrainingToMonth.SelectedIndex == 0 && ddlPersonTrainingToYear.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 (txtPersonTrainingDepartment.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 = ""; } PTraining.UPDATE_PS_TRAINING(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true); if (string.IsNullOrEmpty(labelCitizenID.Text)) { GridViewTraining.EditIndex = -1; BindData(); } else { GridViewTraining.EditIndex = -1; BindData1(); } }
protected void lbuTab7Save_Click(object sender, EventArgs e) { if (tbCourse.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 (ddlMonth12From.SelectedIndex == 0 && ddlYear12From.SelectedIndex == 0 && ddlMonth12To.SelectedIndex == 0 && ddlYear12To.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 (tbDepartment.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 = ""; } DateTime dtTrainingFrom = new DateTime(int.Parse(ddlYear12From.SelectedValue), int.Parse(ddlMonth12From.SelectedValue), 1); DateTime dtTrainingTo = new DateTime(int.Parse(ddlYear12To.SelectedValue), int.Parse(ddlMonth12To.SelectedValue), 1); if ((dtTrainingTo - dtTrainingFrom).TotalDays < 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_TRAINING PTraining = new PS_TRAINING(); PTraining.PS_CITIZEN_ID = p; PTraining.PS_COURSE = tbCourse.Text; PTraining.PS_FROM_MONTH = Convert.ToInt32(ddlMonth12From.SelectedValue); PTraining.PS_FROM_YEAR = Convert.ToInt32(ddlYear12From.SelectedValue); PTraining.PS_TO_MONTH = Convert.ToInt32(ddlMonth12To.SelectedValue); PTraining.PS_TO_YEAR = Convert.ToInt32(ddlYear12To.SelectedValue); PTraining.PS_DEPARTMENT = tbDepartment.Text; PTraining.INSERT_PS_TRAINING(); ClearPTraining12(); DataTable dt3 = PTraining.SELECT_PS_TRAINING(p, "", "", "", "", "", ""); GridViewTraining.DataSource = dt3; GridViewTraining.DataBind(); SetViewState(dt3); notification.Attributes["class"] = "alert alert_success"; notification.InnerHtml = ""; notification.InnerHtml += "<div><img src='Image/Small/correct.png' /><strong>บันทึกข้อมูลประวัติการฝึกอบรมสำเร็จ</strong></div>"; }