Ejemplo n.º 1
0
    private void LoadData()
    {
        HR_KONTRAK_DAL _dalHR_KONTRAK_DAL = null;
        Hashtable      _htParameters      = null;

        try
        {
            _dalHR_KONTRAK_DAL = new HR_KONTRAK_DAL();
            _htParameters      = new Hashtable();

            _htParameters["p_ID"] = Request.Params["id"];
            DataTable _dt = _dalHR_KONTRAK_DAL.GetRow(_htParameters);

            if (_dt.Rows[0]["STATUS_PEGAWAI"].ToString() == "True")
            {
                cbStatus.Checked = true;
            }
            if (_dt.Rows[0]["is_shift"].ToString() == "1")
            {
                cbShift.Checked = true;
            }
            if (_dt.Rows[0]["is_cuti"].ToString() == "1")
            {
                cbCuti.Checked = true;
            }

            MPF23.Shared.Mapper.DBToUI.Map(pnlBody.Controls, _dt.Rows[0]);
        }
        catch (Exception ex)
        {
            Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null);
        }
    }
Ejemplo n.º 2
0
    private void SaveData()
    {
        HR_KONTRAK_DAL _dalHR_KONTRAK_DAL = null;
        Hashtable      _htParameters      = null;
        int            iNextID            = 0;

        try
        {
            _dalHR_KONTRAK_DAL = new HR_KONTRAK_DAL();
            _htParameters      = new Hashtable();
            _htParameters["p_DOKUMEN_PATH"] = filepath;

            if (cbStatus.Checked)
            {
                _htParameters["p_STATUS_PEGAWAI"] = "1";
            }
            else
            {
                _htParameters["p_STATUS_PEGAWAI"] = "0";
            }

            if (cbShift.Checked)
            {
                _htParameters["p_IS_SHIFT"] = "1";
            }
            else
            {
                _htParameters["p_IS_SHIFT"] = "0";
            }

            if (cbCuti.Checked)
            {
                _htParameters["p_IS_CUTI"] = "1";
            }
            else
            {
                _htParameters["p_IS_CUTI"] = "0";
            }

            MPF23.Shared.Mapper.UIToDB.Map(pnlBody.Controls, _htParameters);
            Utility.ApplyDefaultProp(_htParameters);

            if (Request.Params["action"] == "add")
            {
                _dalHR_KONTRAK_DAL.Insert(_htParameters, ref iNextID);
            }
            else
            {
                _dalHR_KONTRAK_DAL.Update(_htParameters);
                iNextID = Int32.Parse(lblID.Text);
            }

            Utility.ShowMessageBox(this, Utility.SAVE_DATA_SUCCESS_MESSAGE, null, "kontrakdtl.aspx?action=edt&id=" + iNextID.ToString());
        }
        catch (Exception ex)
        {
            Utility.ShowMessageBox(this, Utility.SAVE_DATA_FAIL_MESSAGE, ex, null);
        }
    }
Ejemplo n.º 3
0
    private void BindGrid()
    {
        HR_KONTRAK_DAL _dalHR_KONTRAK_DAL = null;
        Hashtable      _htParameters      = null;

        try
        {
            _dalHR_KONTRAK_DAL = new HR_KONTRAK_DAL();
            _htParameters      = new Hashtable();

            _htParameters["p_keywords"] = txtSearch.Text;

            gvwList.DataSource = _dalHR_KONTRAK_DAL.GetRows(_htParameters);
            gvwList.DataBind();
        }
        catch (Exception ex)
        {
            Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null, null);
        }
    }
Ejemplo n.º 4
0
    protected void gvwList_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int    rowIndex = Convert.ToInt32(e.CommandArgument) - 1;
        string p_ID     = gvwList.DataKeys[rowIndex].Values[1].ToString();

        switch (e.CommandName)
        {
        case "Edit":
            Response.Redirect("kontrakdtl.aspx?action=edt&id=" + p_ID);
            break;

        case "Delete":
            HR_KONTRAK_DAL _dalHR_KONTRAK_DAL = null;
            Hashtable      _htParameters      = null;

            try
            {
                string filename = gvwList.DataKeys[rowIndex].Values[2].ToString();
                string savefile = Path.Combine(Server.MapPath("~/FileAttachments/"), filename);

                _dalHR_KONTRAK_DAL    = new HR_KONTRAK_DAL();
                _htParameters         = new Hashtable();
                _htParameters["p_ID"] = p_ID;
                _dalHR_KONTRAK_DAL.Delete(_htParameters);

                if (System.IO.File.Exists(savefile))
                {
                    System.IO.File.Delete(savefile);
                }

                this.BindGrid();
                Response.Redirect("kontraklist.aspx");
            }
            catch (Exception ex)
            {
                Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null);
            }
            break;
        }
    }