protected IList<Navigation> GetChild(Navigation nav) { return Common.VerifiedNavigationList .Where(n => n.ParentId == nav.NavigationId && n.AsMenu) .OrderBy(n => n.SortIndex) .ToList(); }
//添加导航时不对排序字段进行设置,默认为0,显示在最前的位置,当第一次执行排序操作时,将会对SortIndex进行更新 public void AddNavigation(string navName, string url, string description, string parentId, bool asMenu) { using (var context = new WSI.DataAccess.WSICmsContext()) { Navigation nav = new Navigation(); nav.NavigationName = navName; nav.Url = url; nav.Description = description; nav.AsMenu = asMenu; //父导航 Guid id; if (Guid.TryParse(parentId, out id)) { nav.Parent = context.Navigations.Find(id); } nav.State = (int)EnumHelper.State.Enable; nav.CreateTime = DateTime.Now; context.Navigations.Add(nav); context.LogChangesDuringSave = true; context.SaveChanges(); } }
protected IList<Navigation> GetChildren(Navigation parent) { return baseNavigations .Where(n => n.Parent == parent) .OrderBy(n => n.SortIndex) .ToList(); }
//是否显示页面预览按钮 protected bool showPreview(Navigation nav) { return nav.Url != "" && nav.Url.ToLower().IndexOf(".aspx") != -1; }