protected void modUpdateCommand3(Object sender, GridViewUpdateEventArgs e) { Label lblTrainingID12 = (Label)GridViewTraining.Rows[e.RowIndex].FindControl("lblTrainingID12"); Label lblTrainingUOC_ID12 = (Label)GridViewTraining.Rows[e.RowIndex].FindControl("lblTrainingUOC_ID12"); TextBox txtTRAINING_NAME12 = (TextBox)GridViewTraining.Rows[e.RowIndex].FindControl("txtTRAINING_NAME12"); TextBox txtSTART_DATE12 = (TextBox)GridViewTraining.Rows[e.RowIndex].FindControl("txtSTART_DATE12"); TextBox txtEND_DATE12 = (TextBox)GridViewTraining.Rows[e.RowIndex].FindControl("txtEND_DATE12"); TextBox txtDEPARTMENT12 = (TextBox)GridViewTraining.Rows[e.RowIndex].FindControl("txtDEPARTMENT12"); if (txtTRAINING_NAME12.Text == "") { notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก หลักสูตรฝึกอบรม !</div>"; return; } else if (txtSTART_DATE12.Text == "" && txtEND_DATE12.Text == "") { notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก ตั้งแต่ - ถึง (วัน เดือน ปี) !</div>"; return; } else if (txtDEPARTMENT12.Text == "") { notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก หน่วยงานที่จัดฝึกอบรม !</div>"; return; } else if (txtSTART_DATE12.Text != "" && txtEND_DATE12.Text != "") { DateTime dtEndDate12 = DateTime.Parse(txtEND_DATE12.Text); DateTime dtStartDate12 = DateTime.Parse(txtSTART_DATE12.Text); int totalDay = (int)(dtEndDate12 - dtStartDate12).TotalDays + 1; if (totalDay <= 0) { 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 = ""; } } else { notification.Attributes["class"] = "none"; notification.InnerHtml = ""; } PS_TRAINING PStudy = new PS_TRAINING(Convert.ToInt32(lblTrainingID12.Text) , Convert.ToInt32(lblTrainingUOC_ID12.Text) , txtTRAINING_NAME12.Text , DateTime.Parse(txtSTART_DATE12.Text) , DateTime.Parse(txtEND_DATE12.Text) , txtDEPARTMENT12.Text); PStudy.UPDATE_PS_TRAINING(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true); GridViewTraining.EditIndex = -1; BindData(); }
protected void modDeleteCommand3(Object sender, GridViewDeleteEventArgs e) { int id = Convert.ToInt32(GridViewTraining.DataKeys[e.RowIndex].Value); PS_TRAINING PStudy = new PS_TRAINING(); PStudy.TRAINING_ID = id; PStudy.DELETE_PS_TRAINING(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true); GridViewTraining.EditIndex = -1; BindData(); }
protected void btnSave4_Click(object sender, EventArgs e) { PS_TRAINING Training = new PS_TRAINING(); Training.UOC_ID = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())); Training.TRAINING_NAME = tbCourse12.Text; Training.START_DATE = DateTime.Parse(tbStartDate12.Text); Training.END_DATE = DateTime.Parse(tbEndDate12.Text); Training.DEPARTMENT = tbDepartment12.Text; Training.INSERT_PS_TRAINING(); ClearTraining(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true); 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); }