コード例 #1
0
    private bool SaveData()
    {
        objClsCommon = new clsCommon();
        if (objClsCommon.IsRecordExists("tblMenuItemType", tblMenuItemType.ColumnNames.AppMenuItemType, tblMenuItemType.ColumnNames.AppMenuItemTypeID, txtMenuItemType.Text.Trim(), hdnPKID.Value))
        {
            DInfo.ShowMessage("Menu iten type is already exists", Enums.MessageType.Warning);
            return(false);
        }


        objMenuItemType = new tblMenuItemType();

        if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
        {
            objMenuItemType.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value));
        }
        else
        {
            objMenuItemType.AddNew();
            objMenuItemType.AppDisplayOrder = objClsCommon.GetNextDisplayOrder("tblMenuItemType", tblMenuItemType.ColumnNames.AppDisplayOrder);
            objMenuItemType.AppCreateDate   = System.DateTime.Now;
            objMenuItemType.AppCreateBy     = Convert.ToInt32(Session[appFunctions.Session.UserID.ToString()]);
        }
        objMenuItemType.s_AppMenuItemType = txtMenuItemType.Text;
        objMenuItemType.AppIsActive       = chkIsActive.Checked;
        objMenuItemType.Save();
        iMenuItemTypeid = objMenuItemType.AppMenuItemTypeID;
        objMenuItemType = null;
        objClsCommon    = null;
        return(true);
    }
コード例 #2
0
    private bool Delete(int intPKID)
    {
        bool retval = false;

        objMenuItemType = new tblMenuItemType();



        if (objMenuItemType.LoadByPrimaryKey(intPKID))
        {
            objMenuItemType.MarkAsDeleted();
            objMenuItemType.Save();
        }

        retval          = true;
        objMenuItemType = null;
        return(retval);
    }
コード例 #3
0
    protected void dgvGridView_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
    {
        if (!string.IsNullOrEmpty(e.CommandArgument.ToString()))
        {
            clsEncryption objEncrypt    = new clsEncryption();
            int           intHiddenPKID = 0;

            if (!string.IsNullOrEmpty(hdnPKID.Value))
            {
                intHiddenPKID = Convert.ToInt32(hdnPKID.Value);
            }

            objCommon     = new clsCommon();
            hdnPKID.Value = e.CommandArgument.ToString();
            if (e.CommandName == "Up")
            {
                LinkButton inkButton = (LinkButton)e.CommandSource;

                GridViewRow drCurrent = (GridViewRow)inkButton.Parent.Parent;

                if (drCurrent.RowIndex > 0)
                {
                    GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex - 1];
                    objCommon.SetDisplayOrder("tblMenuItemType", tblMenuItemType.ColumnNames.AppMenuItemTypeID, tblMenuItemType.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[1], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[1]);
                    hdnPKID.Value = intHiddenPKID.ToString();
                    LoadDataGrid(false, false);
                    objCommon = null;
                }

                hdnPKID.Value = intHiddenPKID.ToString();
            }
            else if (e.CommandName == "Down")
            {
                LinkButton lnkButton = (LinkButton)e.CommandSource;

                GridViewRow drCurrent = (GridViewRow)lnkButton.Parent.Parent;

                if (drCurrent.RowIndex < dgvGridView.Rows.Count - 1)
                {
                    GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex + 1];
                    objCommon.SetDisplayOrder("tblMenuItemType", tblMenuItemType.ColumnNames.AppMenuItemTypeID, tblMenuItemType.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[1], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[1]);
                    hdnPKID.Value = intHiddenPKID.ToString();
                    LoadDataGrid(false, false);
                    objCommon = null;
                }

                hdnPKID.Value = intHiddenPKID.ToString();
            }
            else if (e.CommandName == "IsActive")
            {
                objMenuItemType = new tblMenuItemType();

                if (objMenuItemType.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)))
                {
                    if (objMenuItemType.AppIsActive)
                    {
                        objMenuItemType.AppIsActive = false;
                    }
                    else
                    {
                        objMenuItemType.AppIsActive = true;
                    }

                    objMenuItemType.Save();
                    LoadDataGrid(false, false, "", "");
                }
            }
        }
    }