Пример #1
0
    private void SaveData()
    {
        LStblDeptDAL _dalLSTblDept = null;
        Hashtable    _htParameters = null;
        int          iNextID       = 0;

        try
        {
            _dalLSTblDept = new LStblDeptDAL();
            _htParameters = new Hashtable();

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

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

            Utility.ShowMessageBox(this, Utility.SAVE_DATA_SUCCESS_MESSAGE, null, "lstbldeptdetail.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("lstbldeptdetail.aspx?action=edt&id=" + e.CommandArgument);
            break;

        case "Delete":
            LStblDeptDAL _dalLSTblDept = null;
            Hashtable    _htParameters = null;

            try
            {
                _dalLSTblDept = new LStblDeptDAL();
                _htParameters = new Hashtable();

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

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

        try
        {
            _dalLSTblDept = new LStblDeptDAL();
            _htParameters = new Hashtable();

            _htParameters["p_keywords"] = txtSearch.Text;

            gvwList.DataSource = _dalLSTblDept.GetRows(_htParameters);
            gvwList.DataBind();
        }
        catch (Exception ex)
        {
            Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null, null);
        }
    }
Пример #4
0
    public static void BindDDLHRMSDept(DropDownList ddl)
    {
        LStblDeptDAL _dalLStblDeptDAL = null;
        Hashtable    _htParameters    = null;

        try
        {
            _dalLStblDeptDAL            = new LStblDeptDAL();
            _htParameters               = new Hashtable();
            _htParameters["p_keywords"] = "";

            ddl.DataSource     = _dalLStblDeptDAL.GetRows(_htParameters);
            ddl.DataValueField = "DeptCode";
            ddl.DataTextField  = "DeptName";
            ddl.DataBind();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Пример #5
0
    private void LoadData()
    {
        LStblDeptDAL _dalLSTblDept = null;
        Hashtable    _htParameters = null;

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

            _dalLSTblDept = new LStblDeptDAL();
            _htParameters = new Hashtable();

            _htParameters["p_ls_tbldeptid"] = Request.Params["id"];
            DataTable _dt = _dalLSTblDept.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);
        }
    }