protected void modDeleteCommand2(Object sender, GridViewDeleteEventArgs e) { int id = Convert.ToInt32(GridViewLicense.DataKeys[e.RowIndex].Value); PS_PRO_LICENSE PStudy = new PS_PRO_LICENSE(); PStudy.PRO_ID = id; PStudy.DELETE_PS_PRO_LICENSE(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true); GridViewLicense.EditIndex = -1; BindData(); }
protected void btnSave3_Click(object sender, EventArgs e) { PS_PRO_LICENSE PLicense = new PS_PRO_LICENSE(); PLicense.UOC_ID = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())); PLicense.LICENSE_NAME = tbLicenseName11.Text; PLicense.DEPARTMENT = tbDepartment11.Text; PLicense.LICENSE_NUMBER = tbLicenseNumber11.Text; PLicense.START_DATE = DateTime.Parse(tbStartDate11.Text); PLicense.INSERT_PS_PRO_LICENSE(); ClearPLicense(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true); BindData(); }
protected void modUpdateCommand2(Object sender, GridViewUpdateEventArgs e) { Label lblProID11 = (Label)GridViewLicense.Rows[e.RowIndex].FindControl("lblProID11"); Label lblProUOC_ID11 = (Label)GridViewLicense.Rows[e.RowIndex].FindControl("lblProUOC_ID11"); TextBox txtLICENSE_NAME11 = (TextBox)GridViewLicense.Rows[e.RowIndex].FindControl("txtLICENSE_NAME11"); TextBox txtDEPARTMENT11 = (TextBox)GridViewLicense.Rows[e.RowIndex].FindControl("txtDEPARTMENT11"); TextBox txtLICENSE_NUMBER11 = (TextBox)GridViewLicense.Rows[e.RowIndex].FindControl("txtLICENSE_NUMBER11"); TextBox txtSTART_DATE11 = (TextBox)GridViewLicense.Rows[e.RowIndex].FindControl("txtSTART_DATE11"); if (txtLICENSE_NAME11.Text == "") { notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก ชื่อใบอนุญาต !</div>"; return; } else if (txtDEPARTMENT11.Text == "") { notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก หน่วยงาน !</div>"; return; } else if (txtLICENSE_NUMBER11.Text == "") { notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก เลขที่ใบอนุญาต !</div>"; return; } else if (txtSTART_DATE11.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_PRO_LICENSE PStudy = new PS_PRO_LICENSE(Convert.ToInt32(lblProID11.Text) , Convert.ToInt32(lblProUOC_ID11.Text) , txtLICENSE_NAME11.Text , txtDEPARTMENT11.Text , txtLICENSE_NUMBER11.Text , DateTime.Parse(txtSTART_DATE11.Text)); PStudy.UPDATE_PS_PRO_LICENSE(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true); GridViewLicense.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); }