private void btnRight_Click(object sender, EventArgs e) { foreach (Control ctr in flpThisgroupitems.Controls) { if (ctr.BackColor == Color.FromArgb(0, 102, 204)) { UCMenuAdd ucMenuGet = (UCMenuAdd)ctr; SubMenuModel itemlef = (SubMenuModel)(ucMenuGet.Tag); SubMenuModel item = new SubMenuModel(); item.SubMenuID = itemlef.SubMenuID; item.SubMenuName = itemlef.SubMenuName; listall.Add(item); var index = -1; for (int i = 0; i < listmap.Count; i++) { if (listmap[i].SubMenuID == item.SubMenuID) { index = i; } } if (index > -1) { listmap.RemoveAt(index); } } } LoadThisGroupItems(); LoadAllItem(); }
private Button BuildSubMenuItem(SubMenuModel metaData) { var button = new Button() { Text = metaData.Name, Dock = DockStyle.Top, Height = 45, BackColor = Theme.SidePanelSubMenuColor, FlatStyle = FlatStyle.Flat, FlatAppearance = { BorderSize = 0 }, ForeColor = Theme.SidePanelSubMenuTextColor, TextAlign = ContentAlignment.MiddleLeft, Padding = new Padding(35, 0, 0, 0) }; button.Click += metaData.OnClick; return(button); }
// // GET: /Post/ public ActionResult Index(string type, string search = null) { var controller = new SubMenuModel(); controller.Items.Add(new MenuItem("Latest Posts", "Post", "Index", true)); controller.Items.Add(new MenuItem("Not Answered", "Post", "NotAnswered")); var posts = this.PostDB.All() .Where(post => search == null || "title" == type && post.Title.ToLower().Contains(search.ToLower()) || "user" == type && post.Author.Username.ToLower().Contains(search.ToLower()) || "text" == type && post.Text.ToLower().Contains(search.ToLower())) .OrderByDescending(post => post.TimeOfPost) .ToList(); PostOverview model = new PostOverview(); model.SubMenu = controller; model.Posts.AddRange(posts.Select(post => new PostLight(post))); return(View(model)); }
public PartialViewResult SubMenu() { ContentItem startPage = Find.ClosestLanguageRoot; var ancestors = Find.EnumerateParents(N2.Find.CurrentPage, Find.ClosestLanguageRoot, true).ToList(); ContentItem branchRoot = Find.AncestorAtLevel(2, ancestors, N2.Find.CurrentPage); var model = new SubMenuModel(); if (branchRoot != null && !startPage.Equals(CurrentPage) && branchRoot.GetChildren(new NavigationFilter()).Count > 0) { model.CurrentItem = Find.AncestorAtLevel(3, ancestors, CurrentPage) ?? CurrentPage; model.BranchRoot = branchRoot; model.Items = branchRoot.GetChildren(new NavigationFilter()); } else { model.Visible = false; } return(PartialView(model)); }
// // GET: /User/Stream public ActionResult Stream(string type, string search = null) { if (true != User.Identity.IsAuthenticated) { return(RedirectToAction("Login", "Account")); } else { var controller = new SubMenuModel(); controller.Items.Add(new MenuItem("Stream", "User", "Stream", true)); controller.Items.Add(new MenuItem("Members Followed", "User", "StreamUsers")); controller.Items.Add(new MenuItem("Tags Followed", "User", "StreamTags")); controller.Items.Add(new MenuItem("My Posts", "User", "StreamOwn")); PostOverview model = new PostOverview(); model.SubMenu = controller; User user = this.UserDB.GetByUserName(User.Identity.Name); var Posts = this.PostDB.All() .Where(post => post.Author.Id == user.Id || post.Author.Followers.Contains(user) || post.Tags .Where(tag => tag.Followers.Contains(user)) .FirstOrDefault() != null) .Distinct(); if (null == search) { model.Posts.AddRange(Posts .OrderByDescending(post => post.TimeOfPost) .Select(post => new PostLight(post))); } else // Add filtering { model.Posts.AddRange(Posts .Where(post => "title" == type && post.Title.ToLower().Contains(search.ToLower()) || "user" == type && post.Author.Username.ToLower().Contains(search.ToLower()) || "text" == type && post.Text.ToLower().Contains(search.ToLower())) .OrderByDescending(post => post.TimeOfPost) .Select(post => new PostLight(post))); } return(View(model)); } }
public PartialViewResult SubMenu() { ContentItem startPage = Find.ClosestLanguageRoot; var ancestors = Find.EnumerateParents(N2.Find.CurrentPage, Find.ClosestLanguageRoot, true).ToList(); ContentItem branchRoot = Find.AncestorAtLevel(2, ancestors, N2.Find.CurrentPage); var model = new SubMenuModel(); if (branchRoot != null && !startPage.Equals(CurrentPage)) { var children = branchRoot.Children.WhereNavigatable().TryAppendCreatorNode(Engine, branchRoot).ToList(); if (children.Count > 0) { model.CurrentItem = Find.AncestorAtLevel(3, ancestors, CurrentPage) ?? CurrentPage; model.BranchRoot = branchRoot; model.Items = children; return(PartialView(model)); } } model.Visible = false; return(PartialView(model)); }
public HomeController() { _mainModel = new MainMenuModel(); _subModel = new SubMenuModel(); _postModel = new PostModel(); }