Esempio n. 1
0
    private void GridPages()
    {
        var bo = new BO.MenuRolManager();

        gvPagina.DataSource = bo.GetMenuPagina(short.Parse(comboModulo.SelectedValue));
        gvPagina.DataBind();
    }
Esempio n. 2
0
    private void LoadRoles()
    {
        var bo = new BO.MenuRolManager();

        comboModulo.DataBind();
        GridPages();
    }
Esempio n. 3
0
    protected void gvRol_ItemCommand(object sender, GridCommandEventArgs e)
    {
        try
        {
            lblMessage.Text = string.Empty;
            txtRol.Text     = string.Empty;
            util.GetActionMenu(mpMenu.SelectedItem.Value);
            var item = (Telerik.Web.UI.GridDataItem)e.Item;
            int id   = int.Parse(gvRol.Items[item.ItemIndex]["Id"].Text);
            ViewState["rol"] = item.ItemIndex;
            gvRol.Items[item.ItemIndex].Selected = true;
            var bo = new BO.MenuRolManager();
            switch (e.CommandName)
            {
            case "editId":
                txtRol.Text = gvRol.Items[item.ItemIndex]["sDescription"].Text;
                GridPages();
                RolDetail1.SetPerfil(id);
                break;

            case "deleteId":
                bo.DeleteRol(id, 0, string.Empty);
                gvRol.Rebind();
                ViewState["rol"] = null;
                util.ErroDisplay(7, string.Empty, ref lblMessage);
                break;

            case "detailId":
                RolDetail1.SetPerfil(id);
                break;
            }
        }
        catch (ArgumentNullException ex)
        {
            Alert.Denegado(this.Page);
        }
        catch (Exception ex)
        {
            util.ErroDisplay(1, ex.Message, ref lblMessage);
        }
    }
Esempio n. 4
0
    public void LoadMenu(string sMenu, int iRol, ref Menu menuVertical)
    {
        var swap  = new DS.SAI.Business.MenuRolManager();
        var menu  = (List <DS.SAI.Data.menuRolCompositeType>)HttpContext.Current.Session["MenuH"];
        var iMenu = (from p in menu where p.sModulo.Equals(sMenu) select p).FirstOrDefault();

        if (iMenu == null)
        {
            return;
        }
        var menuInfor = swap.GetMenuPagina(iMenu.iIdMenu, iRol);

        foreach (DS.SAI.Data.menuCompositeType mt in menuInfor)
        {
            var miNuevo = new MenuItem {
                Text = mt.sDescription, Value = mt.sURL + "|" + mt.sPermission, Selectable = true
            };
            menuVertical.Items.Add(miNuevo);
        }
        menuVertical.Items[0].Selected = true;
    }
Esempio n. 5
0
    protected void LoadMainMenu(int iRol)
    {
        List <DS.SAI.Data.menuRolCompositeType> menu = null;

        if (Session["MenuH"] == null)
        {
            var swap = new DS.SAI.Business.MenuRolManager();
            Session["MenuH"] = swap.getAllMenuRol(iRol);
        }
        menu = (List <DS.SAI.Data.menuRolCompositeType>)Session["MenuH"];
        if (menu.Count == 0)
        {
            var swap = new DS.SAI.Business.MenuRolManager();
            Session["MenuH"] = swap.getAllMenuRol(iRol);
        }
        foreach (var miNuevo in menu.Select(mt => new RadMenuItem {
            NavigateUrl = mt.sModulo, Text = mt.sDescription, Value = mt.iIdMenu.ToString()
        }))
        {
            MenuHorizontal.Items.Add(miNuevo);
        }
    }
Esempio n. 6
0
    private void ConfigPerfil()
    {
        var bo   = new BO.MenuRolManager();
        var swap = new List <string>();

        try
        {
            Util.isRequired(txtRol.Text, "Descripción");
            for (int i = 0; i < gvPagina.Items.Count; i++)
            {
                var cb = (CheckBox)gvPagina.Items[i].Controls[2].Controls[1];
                if (cb.Checked)
                {
                    swap.Add(gvPagina.Items[i]["Id"].Text);
                }
            }
            if (swap.Count > 0)
            {
                bo.InsertUserRol(txtRol.Text, int.Parse(comboModulo.SelectedValue), swap, btnPermisos.SelectedValue);
                gvRol.Rebind();
            }
            util.ErroDisplay(5, string.Empty, ref lblMessage);
            ViewState["Modulo"] = comboModulo.SelectedValue;
        }
        catch (AccessViolationException ave)
        {
            Alert.Permisos(this.Page);
        }
        catch (ArgumentException ae)
        {
            util.ErroDisplay(3, ae.Message, ref lblMessage);
        }
        catch (Exception ex)
        {
            util.ErroDisplay(1, ex.Message, ref lblMessage);
        }
    }
Esempio n. 7
0
        public List <menuRolCompositeType> GetMenuByUser(int iRol)
        {
            var swap = new MenuRolManager();

            return(swap.getAllMenuRol(iRol));
        }