private void BindGrid() { HR_CUTI_PEGAWAI_DAL _dalHR_CUTI_PEGAWAI_DAL = null; Hashtable _htParameters = null; try { _dalHR_CUTI_PEGAWAI_DAL = new HR_CUTI_PEGAWAI_DAL(); _htParameters = new Hashtable(); _htParameters["p_keywords"] = txtSearch.Text; _htParameters["p_status"] = "0"; if (Session[SessionKey.CURRENT_USER_HRMS_ROLE].ToString() == "1") { _htParameters["p_NIK"] = lblEmployee_Code.Text; } gvwList.DataSource = _dalHR_CUTI_PEGAWAI_DAL.GetRows(_htParameters); gvwList.DataBind(); } catch (Exception ex) { Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null, null); } }
private void LoadData() { HR_CUTI_PEGAWAI_DAL _dalHR_CUTI_PEGAWAI_DAL = null; Hashtable _htParameters = null; try { //System.Diagnostics.Debugger.Break(); //ddlEmployee_Code.SelectedValue = SessionKey.CURRENT_USER_HRMS_EMP_CODE.ToString(); txtSubmissionDate.Text = Utility.CurrentDate; //GET ROLE Response.Write(Session[SessionKey.CURRENT_USER_HRMS_ROLE]); _dalHR_CUTI_PEGAWAI_DAL = new HR_CUTI_PEGAWAI_DAL(); _htParameters = new Hashtable(); if (Request.Params["action"] == "edt") { _htParameters["p_ID"] = Request.Params["id"]; DataTable _dt = _dalHR_CUTI_PEGAWAI_DAL.GetRow(_htParameters); MPF23.Shared.Mapper.DBToUI.Map(pnlBody.Controls, _dt.Rows[0]); if (ddlStatus.SelectedValue == "0") { btnSave.Visible = true; } else { btnSave.Visible = false; } if (txtTotDay.Text == "0.5") { CheckHAlf.Checked = true; HitungHari(); } } else { txtNIK.Text = Session[SessionKey.CURRENT_USER_HRMS_EMP_CODE].ToString().Trim(); txtNama.Text = Session[SessionKey.CURRENT_USER_HRMS_EMP_NAME].ToString().Trim(); } } catch (Exception ex) { Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null); } }
protected void gvwList_RowCommand(object sender, GridViewCommandEventArgs e) { switch (e.CommandName) { case "Edit": Response.Redirect("cutidtl.aspx?action=edt&id=" + e.CommandArgument); break; case "Delete": HR_CUTI_PEGAWAI_DAL _dalHR_CUTI_PEGAWAI_DAL = null; HR_ABSENSI_DAL _dalHR_ABSENSI = null; Hashtable _htParameters = null; Hashtable _htParameters2 = null; try { _dalHR_CUTI_PEGAWAI_DAL = new HR_CUTI_PEGAWAI_DAL(); _dalHR_ABSENSI = new HR_ABSENSI_DAL(); _htParameters = new Hashtable(); _htParameters2 = new Hashtable(); _htParameters["p_ID"] = e.CommandArgument.ToString(); DataTable _dt = _dalHR_CUTI_PEGAWAI_DAL.GetRow(_htParameters); //TotDay for (int i = 0; i < Convert.ToInt16(_dt.Rows[0]["TotDay"]); i++) { //Parameter Insert _htParameters2["p_NIK"] = _dt.Rows[0]["NIK"].ToString(); _htParameters2["p_TANGGAL_ABSEN"] = Convert.ToDateTime(_dt.Rows[0]["StartDate"].ToString()).AddDays(i); _dalHR_ABSENSI.DeleteAbsensi(_htParameters2); } _dalHR_CUTI_PEGAWAI_DAL.Delete(_htParameters); this.BindGrid(); Response.Redirect("cutilist.aspx"); } catch (Exception ex) { Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null); } break; } }
public void btnMail_Click(object sender, EventArgs e) { HR_CUTI_PEGAWAI_DAL _dalHR_CUTI_PEGAWAI_DAL = new HR_CUTI_PEGAWAI_DAL(); Hashtable _htParameters = new Hashtable(); foreach (GridViewRow row in gvwList.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox chb = (CheckBox)row.Cells[1].Controls[1]; if (chb.Checked) { try { _htParameters.Clear(); _htParameters["p_ID"] = Int32.Parse(gvwList.DataKeys[row.RowIndex][0].ToString()); _htParameters["p_ACT"] = "LEV"; Utility.ApplyDefaultProp(_htParameters); if (row.Cells[8].Text != "Send") { _dalHR_CUTI_PEGAWAI_DAL.Mail(_htParameters); Utility.ShowMessageBox(this, Utility.MAIL_SENDING_SUCCESS_MESSAGE, null, "cutilist.aspx"); } else { Utility.ShowMessageBoxAnas(this, "Tidak dapat mengirim, <br>Status email saat ini sudah terkirim [send]", "Gagal"); } } catch (Exception ex) { Utility.ShowMessageBox(this, Utility.MAIL_SENDING_FAIL_MESSAGE, ex, null); } } } } }
private void SaveData() { HR_CUTI_PEGAWAI_DAL _dalHR_CUTI_PEGAWAI_DAL = null; HR_ABSENSI_DAL _dalHR_ABSENSI = null; Hashtable _htParameters = null; Hashtable _htParameters3 = null; int iNextID = 0; try { _dalHR_CUTI_PEGAWAI_DAL = new HR_CUTI_PEGAWAI_DAL(); _htParameters = new Hashtable(); _dalHR_ABSENSI = new HR_ABSENSI_DAL(); _htParameters3 = new Hashtable(); MPF23.Shared.Mapper.UIToDB.Map(pnlBody.Controls, _htParameters); Utility.ApplyDefaultProp(_htParameters); if (Request.Params["action"] == "edt") { _dalHR_CUTI_PEGAWAI_DAL.Update(_htParameters); iNextID = Int32.Parse(lbl_ID.Text); for (int i = 0; i < Convert.ToInt16(txtTotDay.Text); i++) { //Parameter Insert _htParameters3["p_NIK"] = txtNIK.Text; _htParameters3["p_TANGGAL_ABSEN"] = Convert.ToDateTime(conversiDate(txtStartDate.Text)).AddDays(i); _htParameters3["p_IN_TIME"] = "07:00"; _htParameters3["p_OUT_TIME"] = "15:00"; _htParameters3["p_ATTEND_TIME"] = ""; _htParameters3["p_LEAVE_TIME"] = ""; _htParameters3["p_KODE_JENIS_SHIFT"] = "1"; _htParameters3["p_ABNORMAL"] = "Absence"; _htParameters3["p_WORK_TIME"] = 0; _htParameters3["p_Keterangan"] = "Cuti"; Utility.ApplyDefaultProp(_htParameters3); _dalHR_ABSENSI.DeleteInsertAbsen(_htParameters3); } } else { _dalHR_CUTI_PEGAWAI_DAL.Insert(_htParameters, ref iNextID); if (txtStartDate.Text == txtEndDate.Text) { //Parameter Insert _htParameters3["p_NIK"] = txtNIK.Text; _htParameters3["p_TANGGAL_ABSEN"] = conversiDate(txtStartDate.Text); _htParameters3["p_IN_TIME"] = "07:00"; _htParameters3["p_OUT_TIME"] = "15:00"; _htParameters3["p_ATTEND_TIME"] = ""; _htParameters3["p_LEAVE_TIME"] = ""; _htParameters3["p_KODE_JENIS_SHIFT"] = "1"; _htParameters3["p_ABNORMAL"] = "Absence"; _htParameters3["p_WORK_TIME"] = 0; _htParameters3["p_Keterangan"] = "Cuti"; Utility.ApplyDefaultProp(_htParameters3); _dalHR_ABSENSI.Insert(_htParameters3); } else { for (int i = 0; i < Convert.ToInt16(txtTotDay.Text); i++) { //Parameter Insert _htParameters3["p_NIK"] = txtNIK.Text; _htParameters3["p_TANGGAL_ABSEN"] = Convert.ToDateTime(conversiDate(txtStartDate.Text)).AddDays(i); _htParameters3["p_IN_TIME"] = "07:00"; _htParameters3["p_OUT_TIME"] = "15:00"; _htParameters3["p_ATTEND_TIME"] = ""; _htParameters3["p_LEAVE_TIME"] = ""; _htParameters3["p_KODE_JENIS_SHIFT"] = "1"; _htParameters3["p_ABNORMAL"] = "Absence"; _htParameters3["p_WORK_TIME"] = 0; _htParameters3["p_Keterangan"] = "Cuti"; Utility.ApplyDefaultProp(_htParameters3); _dalHR_ABSENSI.Insert(_htParameters3); } } } Utility.ShowMessageBox(this, Utility.SAVE_DATA_SUCCESS_MESSAGE, null, "cutidtl.aspx?action=edt&id=" + iNextID.ToString()); } catch (Exception ex) { Utility.ShowMessageBox(this, Utility.SAVE_DATA_FAIL_MESSAGE, ex, null); } }