protected void gvwList_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        switch (e.CommandName)
        {
        case "Edit":
            Response.Redirect("appspddtl.aspx?action=edt&id=" + e.CommandArgument);
            break;

        case "Delete":
            EmpSPDDAL _dalEmpSPD    = null;
            Hashtable _htParameters = null;

            try
            {
                _dalEmpSPD    = new EmpSPDDAL();
                _htParameters = new Hashtable();

                _htParameters["p_ID"] = e.CommandArgument.ToString();

                _dalEmpSPD.Delete(_htParameters);
                this.BindGrid();
                Response.Redirect("appspdlst.aspx");
            }
            catch (Exception ex)
            {
                Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null, null);
            }
            break;
        }
    }
    //-------------------------- asfor SPD 20161215_Anas -------------------------------------------



    private void BindGridPopUp()
    {
        EmpSPDDAL _dalEmpSPD    = null;
        Hashtable _htParameters = null;

        try
        {
            _dalEmpSPD    = new EmpSPDDAL();
            _htParameters = new Hashtable();

            _htParameters["p_keywords"] = txtSearchSPD.Text;
            _htParameters["p_status"]   = "3";
            if (Session[SessionKey.CURRENT_USER_HRMS_ROLE].ToString() == "1")
            {
                _htParameters["p_Employee_Code"] = Session[SessionKey.CURRENT_USER_HRMS_EMP_CODE].ToString();
            }

            gvwListSPD.DataSource = _dalEmpSPD.GetRowsForClaim(_htParameters);
            gvwListSPD.DataBind();
        }
        catch (Exception ex)
        {
            Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null, null);
        }
    }
    private void BindGrid()
    {
        EmpSPDDAL _dalEmpSPD    = null;
        Hashtable _htParameters = null;

        try
        {
            _dalEmpSPD    = new EmpSPDDAL();
            _htParameters = new Hashtable();

            _htParameters["p_keywords"]      = txtSearch.Text;
            _htParameters["p_status"]        = "0";
            _htParameters["p_Employee_Code"] = lblEmployee_Code.Text;
            gvwList.DataSource = _dalEmpSPD.GetRowsApproval(_htParameters);
            gvwList.DataBind();

            if (Session[SessionKey.CURRENT_USER_HRMS_ROLE].ToString() == "2")
            {
                btnApprove.Visible = true;
                btnReject.Visible  = true;
            }
            else
            {
                btnApprove.Visible = false;
                btnReject.Visible  = false;
            }
        }
        catch (Exception ex)
        {
            Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null, null);
        }
    }
Exemple #4
0
    private void LoadData()
    {
        EmpSPDDAL _dalEmpSPDDAL = null;
        Hashtable _htParameters = null;

        try
        {
            _dalEmpSPDDAL = new EmpSPDDAL();
            _htParameters = new Hashtable();

            if (Request.Params["action"] == "edt")
            {
                _htParameters["p_ID"] = Request.Params["id"];
                pnlshow.Visible       = true;
                DataTable _dt = _dalEmpSPDDAL.GetRow(_htParameters);
                MPF23.Shared.Mapper.DBToUI.Map(pnlBody.Controls, _dt.Rows[0]);

                MPF23.Shared.Mapper.DBToUI.Map(pnlBody1.Controls, _dt.Rows[0]);

                LoadDataTask();
                LoadDataCost();
            }
        }
        catch (Exception ex)
        {
            Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null);
        }
    }
    private void SaveData()
    {
        EmpSPDDAL _dalEmpSPDDAL = null;
        Hashtable _htParameters = null;
        int       iNextID       = 0;

        try
        {
            _dalEmpSPDDAL = new EmpSPDDAL();
            _htParameters = new Hashtable();

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

            MPF23.Shared.Mapper.UIToDB.Map(pnlBody1.Controls, _htParameters);
            if (Request.Params["action"] == "edt")
            {
                //string abc = lbl_ID.Text;
                _dalEmpSPDDAL.Update(_htParameters);
                iNextID = Int32.Parse(lbl_ID.Text);
            }
            else
            {
                _htParameters["p_Employee_Code"] = txtEmployee_Code.Text;
                _dalEmpSPDDAL.Insert(_htParameters, ref iNextID);
            }

            Utility.ShowMessageBox(this, Utility.SAVE_DATA_SUCCESS_MESSAGE, null, "SPDdtl.aspx?action=edt&id=" + iNextID.ToString());
            //Utility.ShowMessageBox(this, Utility.SAVE_DATA_SUCCESS_MESSAGE, null, "spddtl.aspx?action=edt&page=0&id=" + Request.Params["id"]);
        }
        catch (Exception ex)
        {
            Utility.ShowMessageBox(this, Utility.SAVE_DATA_FAIL_MESSAGE, ex, null);
        }
    }
Exemple #6
0
    public static void Bind_HRMS_PopUp_SPD(string refName, GridView gvw, string parameternya)
    {
        try
        {
            var dal          = new EmpSPDDAL();
            var htParameters = new Hashtable();
            var tableName    = refName;
            htParameters["p_keywords"] = parameternya;

            gvw.DataSource = dal.GetRows(htParameters);
            gvw.DataBind();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    private void Approve_SPD(GridView grv)
    {
        mdlPopupApproveValidate.Hide();
        if (approvemtd(txtPassword.Text) == 1)
        {
            EmpSPDDAL _dalEmpSPDDAL = new EmpSPDDAL();
            Hashtable _htParameters = new Hashtable();

            foreach (GridViewRow row in grv.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(grv.DataKeys[row.RowIndex][0].ToString());
                            _htParameters["p_Employee_Code"] = lblEmployee_Code.Text;
                            _dalEmpSPDDAL.Approve(_htParameters);
                        }
                        catch (Exception ex)
                        {
                            Utility.ShowMessageBox(this, Utility.SAVE_DATA_FAIL_MESSAGE, ex, null);
                        }
                    }
                }
            }
            BindGrid();
            BindGridHRD();
            BindGridApproved();
            BindGridApproved2();
            BindGridRejected();
        }
        else
        {
            Utility.ShowMessageBox(this, "Wrong Password, or unauthorized user", null, null);
        }
    }
    private void BindGridRejected()
    {
        EmpSPDDAL _dalEmpSPD    = null;
        Hashtable _htParameters = null;

        try
        {
            _dalEmpSPD    = new EmpSPDDAL();
            _htParameters = new Hashtable();

            _htParameters["p_keywords"]      = txtSearchRejected.Text;
            _htParameters["p_status"]        = "9";
            _htParameters["p_Employee_Code"] = lblEmployee_Code.Text;
            gvwListRejected.DataSource       = _dalEmpSPD.GetRowsApproval(_htParameters);
            gvwListRejected.DataBind();
        }
        catch (Exception ex)
        {
            Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null, null);
        }
    }
    public void btnMail_Click(object sender, EventArgs e)
    {
        EmpSPDDAL _DALpelamarDAL = new EmpSPDDAL();
        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"] = "SPD";
                        Utility.ApplyDefaultProp(_htParameters);
                        if (row.Cells[8].Text != "Send")
                        {
                            _DALpelamarDAL.Mail(_htParameters);
                            Utility.ShowMessageBox(this, Utility.MAIL_SENDING_SUCCESS_MESSAGE, null, "spdlst.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);
                    }
                    BindGrid();
                    BindGridApproved();
                    BindGridApproved2();
                    BindGridRejected();
                }
            }
        }
    }
    private void LoadData()
    {
        EmpSPDDAL _dalEmpSPDDAL = null;
        Hashtable _htParameters = null;

        try
        {
            //System.Diagnostics.Debugger.Break();
            //ddlEmployee_Code.SelectedValue = SessionKey.CURRENT_USER_HRMS_EMP_CODE.ToString();
            txtSPD_Date.Text = Utility.CurrentDate;
            //GET ROLE Response.Write(Session[SessionKey.CURRENT_USER_HRMS_ROLE]);

            _dalEmpSPDDAL = new EmpSPDDAL();
            _htParameters = new Hashtable();

            if (Request.Params["action"] == "edt")
            {
                _htParameters["p_ID"] = Request.Params["id"];
                lbl_ID.Text           = Request.Params["id"];
                pnlshow.Visible       = true;
                DataTable _dt = _dalEmpSPDDAL.GetRow(_htParameters);
                MPF23.Shared.Mapper.DBToUI.Map(pnlBody.Controls, _dt.Rows[0]);

                MPF23.Shared.Mapper.DBToUI.Map(pnlBody1.Controls, _dt.Rows[0]);
                LoadDataTask();
                LoadDataCost();
                if (ddlStatus.SelectedValue == "0")
                {
                    btnSave.Visible    = true;
                    btnAddTask.Visible = true;
                    btnAddCost.Visible = true;
                    grvTask.Columns[grvTask.Rows[0].Cells.Count - 1].Visible = true;
                    grvTask.Columns[grvTask.Rows[0].Cells.Count - 2].Visible = true;
                    grvCost.Columns[grvCost.Rows[0].Cells.Count - 1].Visible = true;
                    grvCost.Columns[grvCost.Rows[0].Cells.Count - 2].Visible = true;
                }
                else
                {
                    if (Session[SessionKey.CURRENT_USER_HRMS_ROLE].ToString() == "2")
                    {
                        btnSave.Visible    = true;
                        btnAddTask.Visible = true;
                        btnAddCost.Visible = true;
                        grvTask.Columns[grvTask.Rows[0].Cells.Count - 1].Visible = true;
                        grvTask.Columns[grvTask.Rows[0].Cells.Count - 2].Visible = true;
                        grvCost.Columns[grvCost.Rows[0].Cells.Count - 1].Visible = true;
                        grvCost.Columns[grvCost.Rows[0].Cells.Count - 2].Visible = true;
                    }
                    else
                    {
                        btnSave.Visible    = false;
                        btnAddTask.Visible = false;
                        btnAddCost.Visible = false;
                        grvTask.Columns[grvTask.Rows[0].Cells.Count - 1].Visible = false;
                        grvTask.Columns[grvTask.Rows[0].Cells.Count - 2].Visible = false;
                        grvCost.Columns[grvCost.Rows[0].Cells.Count - 1].Visible = false;
                        grvCost.Columns[grvCost.Rows[0].Cells.Count - 2].Visible = false;
                    }
                }
                //if(Session[SessionKey.CURRENT_USER_HRMS_ROLE].ToString()=="2")
                //{
                //    txtCost_Value.Enabled = true;
                //}
                //else
                //{
                //    txtCost_Value.Enabled = false;
                //}
            }
            else
            {
                pnlshow.Visible        = false;
                txtEmployee_Code.Text  = Session[SessionKey.CURRENT_USER_HRMS_EMP_CODE].ToString().Trim();
                txtEmployee_Descs.Text = Session[SessionKey.CURRENT_USER_HRMS_EMP_NAME].ToString().Trim();
            }
        }
        catch (Exception ex)
        {
            Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null);
        }
    }