Example #1
0
    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);
        }
    }
Example #2
0
    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;
        }
    }