protected void modDeleteCommand4(Object sender, GridViewDeleteEventArgs e) { int id = Convert.ToInt32(GridViewPunish.DataKeys[e.RowIndex].Value); PS_PUNISHMENT PStudy = new PS_PUNISHMENT(); PStudy.PUNISH_ID = id; PStudy.DELETE_PS_PUNISHMENT(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true); GridViewPunish.EditIndex = -1; BindData(); }
protected void btnSave5_Click(object sender, EventArgs e) { PS_PUNISHMENT Punish = new PS_PUNISHMENT(); Punish.UOC_ID = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())); Punish.YEAR = tbYear13.Text; Punish.PUNISH_NAME = tbPunishName13.Text; Punish.REF_DOC = tbRefDoc13.Text; Punish.INSERT_PS_PUNISHMENT(); ClearPunish(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true); BindData(); }
protected void modUpdateCommand4(Object sender, GridViewUpdateEventArgs e) { Label lblPUNISH_ID13 = (Label)GridViewPunish.Rows[e.RowIndex].FindControl("lblPUNISH_ID13"); Label lblPunishUOC_ID13 = (Label)GridViewPunish.Rows[e.RowIndex].FindControl("lblPunishUOC_ID13"); TextBox txtYEAR13 = (TextBox)GridViewPunish.Rows[e.RowIndex].FindControl("txtYEAR13"); TextBox txtPUNISH_NAME13 = (TextBox)GridViewPunish.Rows[e.RowIndex].FindControl("txtPUNISH_NAME13"); TextBox txtREF_DOC13 = (TextBox)GridViewPunish.Rows[e.RowIndex].FindControl("txtREF_DOC13"); if (txtYEAR13.Text == "") { notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก พ.ศ. !</div>"; return; } else if (txtPUNISH_NAME13.Text == "") { notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก รายการ !</div>"; return; } else if (txtREF_DOC13.Text == "") { notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก เอกสารอ้างอิง !</div>"; return; } else { notification.Attributes["class"] = "none"; notification.InnerHtml = ""; } PS_PUNISHMENT PStudy = new PS_PUNISHMENT(Convert.ToInt32(lblPUNISH_ID13.Text) , Convert.ToInt32(lblPunishUOC_ID13.Text) , txtYEAR13.Text , txtPUNISH_NAME13.Text , txtREF_DOC13.Text); PStudy.UPDATE_PS_PUNISHMENT(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true); GridViewPunish.EditIndex = -1; BindData(); }
void BindData() { PS_STUDY PStudy = new PS_STUDY(); DataTable dt1 = PStudy.SELECT_PS_STUDY("", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), "", "", "", ""); GridViewStudy.DataSource = dt1; GridViewStudy.DataBind(); SetViewState(dt1); PS_PRO_LICENSE PLicense = new PS_PRO_LICENSE(); DataTable dt2 = PLicense.SELECT_PS_PRO_LICENSE("", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), "", "", "", ""); GridViewLicense.DataSource = dt2; GridViewLicense.DataBind(); SetViewState(dt2); PS_TRAINING Training = new PS_TRAINING(); DataTable dt3 = Training.SELECT_PS_TRAINING("", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), "", "", "", ""); GridViewTraining.DataSource = dt3; GridViewTraining.DataBind(); SetViewState(dt3); PS_PUNISHMENT Punishment = new PS_PUNISHMENT(); DataTable dt4 = Punishment.SELECT_PS_PUNISHMENT("", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), "", "", ""); GridViewPunish.DataSource = dt4; GridViewPunish.DataBind(); SetViewState(dt4); PS_POSI_AND_SALARY PosiSalary = new PS_POSI_AND_SALARY(); DataTable dt5 = PosiSalary.SELECT_PS_POSI_AND_SALARY("", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), "", "", "", "", "", "", "", ""); GridViewPosiSalary.DataSource = dt5; GridViewPosiSalary.DataBind(); SetViewState(dt5); }