Exemplo n.º 1
0
        //Check submenu on all xml
        public RootMenuSubmenuEntity getEntity(Root rootDB, string entityName)
        {
            RootMenuSubmenuEntity data =
                (
                    from menu in rootDB.Menu
                    from submenu in menu.Submenu
                    from entity in submenu.Entity
                    where entity.name == entityName
                    select new RootMenuSubmenuEntity {
                Action = entity.Action, check = entity.check, name = entity.name, text = entity.text, path = entity.path
            }
                ).SingleOrDefault();

            return(data);
        }
Exemplo n.º 2
0
        //Check action by xml role to decide when the button should be showed or hidden
        public static bool checkEntityButtonByXML(Root roleObject, string entityName, string action)
        {
            RootMenuSubmenuEntity entity = new RootMenuSubmenuEntity();

            entity.name = entityName;

            if (roleObject.Menu.Any(a => a.Submenu.Any(b => b.Entity.Any(c => c.name == entityName && c.Action != null))))
            {
                bool isCheck = roleObject.Menu.Any(a => a.Submenu.Any(b => b.Entity.Any(c => c.name == entityName && c.Action.Any(d => d.name == action && d.check == true))));
                return(isCheck);
            }
            else
            {
                return(false);
            }
        }