protected void btnSave6_Click(object sender, EventArgs e) { PS_POSI_AND_SALARY PosiSalary = new PS_POSI_AND_SALARY(); PosiSalary.UOC_ID = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())); PosiSalary.START_DATE = DateTime.Parse(tbStartDate14.Text); PosiSalary.PAS_NAME = tbName14.Text; PosiSalary.NO_POSITION = tbNoPosition14.Text; PosiSalary.POSITION_TYPE = tbPosiType14.Text; PosiSalary.POSITION_DEGREE = tbPosiDegree14.Text; PosiSalary.SALARY = Convert.ToInt32(tbSalary14.Text); PosiSalary.POSITION_SALARY = Convert.ToInt32(tbPosiSalary14.Text); PosiSalary.REF_DOC = tbRefDoc14.Text; PosiSalary.INSERT_PS_POSI_AND_SALARY(); PS_PERSON P0 = new PS_PERSON(); int salary = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT salary FROM PS_POSI_AND_SALARY ORDER BY START_DATE DESC) WHERE ROWNUM = 1"); int posisalary = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT position_salary FROM PS_POSI_AND_SALARY ORDER BY START_DATE DESC) WHERE ROWNUM = 1"); P0.SALARY = salary.ToString(); P0.POSITION_SALARY = posisalary.ToString(); P0.UOC_ID = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())); P0.UPDATE_CURRENT_SALARY_PERSON(); ClearPositionAndSalary(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true); BindData(); }
protected void modDeleteCommand5(Object sender, GridViewDeleteEventArgs e) { int id = Convert.ToInt32(GridViewPosiSalary.DataKeys[e.RowIndex].Value); PS_POSI_AND_SALARY PStudy = new PS_POSI_AND_SALARY(); PStudy.PAS_ID = id; PStudy.DELETE_PS_POSI_AND_SALARY(); PS_PERSON P0 = new PS_PERSON(); int salary = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT salary FROM PS_POSI_AND_SALARY ORDER BY START_DATE DESC) WHERE ROWNUM = 1"); int posisalary = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT position_salary FROM PS_POSI_AND_SALARY ORDER BY START_DATE DESC) WHERE ROWNUM = 1"); P0.SALARY = salary.ToString(); P0.POSITION_SALARY = posisalary.ToString(); P0.UOC_ID = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())); P0.UPDATE_CURRENT_SALARY_PERSON(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true); GridViewPosiSalary.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); }
protected void modUpdateCommand5(Object sender, GridViewUpdateEventArgs e) { Label lblPAS_ID14 = (Label)GridViewPosiSalary.Rows[e.RowIndex].FindControl("lblPAS_ID14"); Label lblPosiSalaryUOC_ID14 = (Label)GridViewPosiSalary.Rows[e.RowIndex].FindControl("lblPosiSalaryUOC_ID14"); TextBox txtSTART_DATE14 = (TextBox)GridViewPosiSalary.Rows[e.RowIndex].FindControl("txtSTART_DATE14"); TextBox txtPAS_NAME14 = (TextBox)GridViewPosiSalary.Rows[e.RowIndex].FindControl("txtPAS_NAME14"); TextBox txtNO_POSITION14 = (TextBox)GridViewPosiSalary.Rows[e.RowIndex].FindControl("txtNO_POSITION14"); TextBox txtPOSITION_TYPE14 = (TextBox)GridViewPosiSalary.Rows[e.RowIndex].FindControl("txtPOSITION_TYPE14"); TextBox txtPOSITION_DEGREE14 = (TextBox)GridViewPosiSalary.Rows[e.RowIndex].FindControl("txtPOSITION_DEGREE14"); TextBox txtSALARY14 = (TextBox)GridViewPosiSalary.Rows[e.RowIndex].FindControl("txtSALARY14"); TextBox txtPOSITION_SALARY14 = (TextBox)GridViewPosiSalary.Rows[e.RowIndex].FindControl("txtPOSITION_SALARY14"); TextBox txtREF_DOC14 = (TextBox)GridViewPosiSalary.Rows[e.RowIndex].FindControl("txtREF_DOC14"); if (txtSTART_DATE14.Text == "") { notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก วัน เดือน ปี !</div>"; return; } /*else if (txtPAS_NAME14.Text == "") * { * notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก ตำแหน่ง !</div>"; * return; * } * else if (txtNO_POSITION14.Text == "") * { * notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก เลขที่ตำแหน่ง !</div>"; * return; * } * else if (txtPOSITION_TYPE14.Text == "") * { * notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก ตำแหน่งประเภท !</div>"; * return; * } * else if (txtPOSITION_DEGREE14.Text == "") * { * notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก ระดับ !</div>"; * return; * }*/ else if (txtSALARY14.Text == "") { notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก เงินเดือน !</div>"; return; } else if (txtPOSITION_SALARY14.Text == "") { notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก เงินประจำตำแหน่ง !</div>"; return; } /*else if (txtREF_DOC14.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_POSI_AND_SALARY PStudy = new PS_POSI_AND_SALARY(Convert.ToInt32(lblPAS_ID14.Text) , Convert.ToInt32(lblPosiSalaryUOC_ID14.Text) , DateTime.Parse(txtSTART_DATE14.Text) , txtPAS_NAME14.Text , txtNO_POSITION14.Text , txtPOSITION_TYPE14.Text , txtPOSITION_DEGREE14.Text , Convert.ToInt32(txtSALARY14.Text) , Convert.ToInt32(txtPOSITION_SALARY14.Text) , txtREF_DOC14.Text); PStudy.UPDATE_PS_POSI_AND_SALARY(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true); GridViewPosiSalary.EditIndex = -1; BindData(); }