private void SaveData()
    {
        LStblCostTypeDAL _dalLStblCostTypeDAL = null;
        Hashtable        _htParameters        = null;
        int iNextID = 0;

        try
        {
            _dalLStblCostTypeDAL = new LStblCostTypeDAL();
            _htParameters        = new Hashtable();

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

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

            Utility.ShowMessageBox(this, Utility.SAVE_DATA_SUCCESS_MESSAGE, null, "lstblcosttypedetail.aspx?action=edt&id=" + iNextID.ToString());
        }
        catch (Exception ex)
        {
            Utility.ShowMessageBox(this, Utility.SAVE_DATA_FAIL_MESSAGE, ex, null);
        }
    }
Пример #2
0
    protected void gvwList_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        switch (e.CommandName)
        {
        case "Edit":
            Response.Redirect("lstblcosttypedetail.aspx?action=edt&id=" + e.CommandArgument);
            break;

        case "Delete":
            LStblCostTypeDAL _dalLStblCostTypeDAL = null;
            Hashtable        _htParameters        = null;

            try
            {
                _dalLStblCostTypeDAL = new LStblCostTypeDAL();
                _htParameters        = new Hashtable();

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

                _dalLStblCostTypeDAL.Delete(_htParameters);
                this.BindGrid();
                Response.Redirect("lstblcosttypelist.aspx");
            }
            catch (Exception ex)
            {
                Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null);
            }
            break;
        }
    }
Пример #3
0
    private void BindGrid()
    {
        LStblCostTypeDAL _dalLStblCostTypeDAL = null;
        Hashtable        _htParameters        = null;

        try
        {
            _dalLStblCostTypeDAL = new LStblCostTypeDAL();
            _htParameters        = new Hashtable();

            _htParameters["p_keywords"] = txtSearch.Text;

            gvwList.DataSource = _dalLStblCostTypeDAL.GetRows(_htParameters);
            gvwList.DataBind();
        }
        catch (Exception ex)
        {
            Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null, null);
        }
    }
    private void LoadData()
    {
        LStblCostTypeDAL _dalLStblCostTypeDAL = null;
        Hashtable        _htParameters        = null;

        try
        {
            //System.Diagnostics.Debugger.Break();

            _dalLStblCostTypeDAL = new LStblCostTypeDAL();
            _htParameters        = new Hashtable();

            _htParameters["p_ID"] = Request.Params["id"];
            DataTable _dt = _dalLStblCostTypeDAL.GetRow(_htParameters);
            MPF23.Shared.Mapper.DBToUI.Map(pnlBody.Controls, _dt.Rows[0]);
        }
        catch (Exception ex)
        {
            Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null);
        }
    }
Пример #5
0
    public static void BindDDLHRMSTypeCost(DropDownList ddl, string parameters)
    {
        LStblCostTypeDAL _dalLStblCostTypeDAL = null;
        Hashtable        _htParameters        = null;

        try
        {
            _dalLStblCostTypeDAL        = new LStblCostTypeDAL();
            _htParameters               = new Hashtable();
            _htParameters["p_keywords"] = "";
            _htParameters["p_ID"]       = parameters;

            ddl.DataSource     = _dalLStblCostTypeDAL.GetRows(_htParameters);
            ddl.DataValueField = "Code";
            ddl.DataTextField  = "Description";
            ddl.DataBind();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }