Example #1
0
        public static IList<Menu> CreateMenuList(ICommandAdapter cmd)
        {
            lock (SyncRoot)
            {
                List<Menu> list = new List<Menu>();
                if (null != cmd)
                {
                    List<Menu> pureList = cmd.Select<Menu>().OrderBy(c => c.OrderNum).ToList();
                    list.AddRange(TreeView(pureList, null));
                }

                return list;
            }
        }
Example #2
0
        public static IList<Menu> CreateMenuListAutharized(ICommandAdapter cmd, IAuthenticationValidator validator, string role)
        {
            lock (SyncRootAutharized)
            {
                List<Menu> tempList = new List<Menu>();
                if (null != cmd)
                {
                    List<Menu> pureList = cmd.Select<Menu>().OrderBy(c => c.OrderNum).ToList();
                    tempList.AddRange(TreeViewAutharized(pureList, null, validator, ref role));
                }

                List<Menu> ret = new List<Menu>();
                //delete if has no child
                foreach (Menu menu in tempList)
                {
                    if (menu.Childs.Count > 0)
                        ret.Add(menu);
                }

                return ret;
            }
        }