Ejemplo n.º 1
0
        public void AddMenuItem(MenuItem menuItem)
        {
            var smi = new ScreenMenuItem {
                MenuItemId = menuItem.Id, Name = menuItem.Name
            };

            ScreenMenuItems.Add(smi);
        }
Ejemplo n.º 2
0
 public IEnumerable <string> GetScreenMenuCategories(string parentTag)
 {
     return(ScreenMenuItems.Where(x => !string.IsNullOrEmpty(x.SubMenuTag))
            .Select(x => x.SubMenuTag)
            .Distinct()
            .Where(x => string.IsNullOrEmpty(parentTag) || (x.StartsWith(parentTag) && x != parentTag))
            .Select(x => Regex.Replace(x, "^" + parentTag + ",", ""))
            .Where(x => !x.Contains(","))
            .Select(x => !string.IsNullOrEmpty(parentTag) ? parentTag + "," + x : x));
 }
Ejemplo n.º 3
0
        public IEnumerable <ScreenMenuItem> GetScreenMenuItems(int currentPageNo, string tag)
        {
            var items = ScreenMenuItems.Where(x => x.SubMenuTag == tag || (string.IsNullOrEmpty(tag) && string.IsNullOrEmpty(x.SubMenuTag)));

            if (PageCount > 1)
            {
                items = items
                        .Skip(ItemCountPerPage * currentPageNo)
                        .Take(ItemCountPerPage);
            }

            return(items.OrderBy(x => x.SortOrder));
        }
Ejemplo n.º 4
0
        public IEnumerable <ScreenMenuItem> GetScreenMenuItems(int currentPageNo, string tag)
        {
            var items = ScreenMenuItems.Where(x => x.SubMenuTag == tag || (string.IsNullOrEmpty(tag) && string.IsNullOrEmpty(x.SubMenuTag)));

            items = (this.SortAlphabetically ?
                     from x in items
                     orderby x.Caption
                     select x :
                     from x in items
                     orderby x.SortOrder
                     select x);

            if (PageCount > 1)
            {
                items = items
                        .Skip(ItemCountPerPage * currentPageNo)
                        .Take(ItemCountPerPage);
            }

            return(items.OrderBy(x => x.SortOrder));
        }
 public bool ContainsMenuItem(MenuItem item)
 {
     return(ScreenMenuItems.Any(x => x.MenuItemId == item.Id));
 }
 public bool ContainsMenuItem(MenuItem item)
 {
     return(ScreenMenuItems.Where(x => x.MenuItemId == item.Id).Count() > 0);
 }