private void lstDataMenus_SelectedIndexChanged(object sender, EventArgs e) { if (lstDataMenus.SelectedItem == null) { return; } ModuleMenuItem moduleMenu = (ModuleMenuItem)lstDataMenus.SelectedItem; List <TXItem> visibleTxItems = selectedModule.TXItems.Where(item => item.ModuleMenuID == moduleMenu.ID).ToList(); lstDataMenuTXs.InvokeIfRequired(() => { lstDataMenuTXs.Items.Clear(); foreach (TXItem tx in visibleTxItems) { ListViewItem newItem = new ListViewItem(tx.Name.ResourceString) { Tag = tx }; newItem.SubItems.Add(tx.DataDisplay.FormattedData); lstDataMenuTXs.Items.Add(newItem); } }); vlm.SetQueriedTXItems(visibleTxItems); }
public List<ModuleMenuItem> BuildMenu() { menu = new List<ModuleMenuItem>(); foreach(var userRole in user.UserRoles) { int roleId = userRole.RoleId; var moduleRoles = repository.RetrieveByRoleId(roleId); foreach(var moduleRole in moduleRoles) { if(moduleRole.Module.DeletedAt == null && !isModuleLoaded(moduleRole.ModuleId)) { Module module = new Module(moduleRole.Module); ModuleMenuItem moduleMenuItem = module.ModuleMenuItem(); foreach(var item in moduleRole.Module.SysMenuitem) { int permissionId = item.PermissionId.Value; if(userHasPermission(permissionId) && item.DeletedAt == null) { MenuItem menuItem= new MenuItem(item); moduleMenuItem.MenuItems.Add(menuItem); } moduleMenuItem.MenuItems.Sort(); } menu.Add(moduleMenuItem); } } } menu.Sort(); return menu; }
void ReadModuleMenuItems(Table moduleMenuTable) { for (int i = 0, readOffset = (int)moduleMenuTable.offset; i < moduleMenuTable.rowCount; i++, readOffset += moduleMenuTable.rowSize) { uint ID = (uint)moduleMenuTable.ReadField(dbReader.rawDB, readOffset, 0); uint nameId = (uint)moduleMenuTable.ReadField(dbReader.rawDB, readOffset, 1); ModuleMenuItems[ID] = new ModuleMenuItem(this, ID, nameId); } }
public List <ModuleMenuItem> RetrieveMenuForUser() { var menu = new List <ModuleMenuItem>(); var m1 = new ModuleMenuItem { Title = "Admin", ModuleMenuItemId = 1 }; m1.MenuItems.Add(new MenuItem { Controller = "User2", ControllerAction = "Index", Title = "User Admin", MenuItemId = 1 }); m1.MenuItems.Add(new MenuItem { Controller = "RoleAdmin", ControllerAction = "Index", Title = "Role Admin", MenuItemId = 2 }); m1.MenuItems.Add(new MenuItem { Controller = "PermissionAdmin", ControllerAction = "Index", Title = "Permission Admin", MenuItemId = 3 }); menu.Add(m1); var m2 = new ModuleMenuItem { Title = "Corrective Actions", ModuleMenuItemId = 2 }; m2.MenuItems.Add(new MenuItem { Title = "My Org's Actions", Controller = "CorrectiveAction", ControllerAction = "Index", UseCase = "VCAFO", MenuItemId = 4 }); m2.MenuItems.Add(new MenuItem { Title = "My Org's Archived Actions", Controller = "CorrectiveAction", ControllerAction = "Index", UseCase = "VACAFO", MenuItemId = 5 }); m2.MenuItems.Add(new MenuItem { Title = "Employees We Service", Controller = "CorrectiveAction", ControllerAction = "Index", UseCase = "VCAFP", MenuItemId = 6 }); m2.MenuItems.Add(new MenuItem { Title = "Employees We Service Archive", Controller = "CorrectiveAction", ControllerAction = "Index", UseCase = "VACAFP", MenuItemId = 7 }); menu.Add(m2); return(menu); }
private void CreateMenuItems() { foreach (var item in this.notifyContextMenu.Items.OfType <ModuleMenuItem>().ToList()) { this.notifyContextMenu.Items.Remove(item); item.Dispose(); } foreach (var module in this.Modules) { var toolStripModule = new ModuleMenuItem(module); foreach (var user in this.Users) { var toolStripUser = new UserMenuItem(user); toolStripModule.DropDownItems.Add(toolStripUser); } notifyContextMenu.Items.Insert(0, toolStripModule); } notifyContextMenu.Refresh(); }
private ModuleMenuItems BuildDocumentMenu() { ModuleMenuItems moduleMenuItems = new ModuleMenuItems(); ModuleMenuItem moduleMenuItem = new ModuleMenuItem(); moduleMenuItem.Name = MenuNameConstants.DocumentManagement; moduleMenuItem.DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.ApplicationName); moduleMenuItem.Order = 0; if (_permissionChecker.IsGranted("admindocumentmvc_permission", "write")) { #region Release Document MenuItem menuReleaseDocument = new MenuItem(); menuReleaseDocument.Name = MenuNameConstants.ReleaseDocument; menuReleaseDocument.DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuReleaseDocument); menuReleaseDocument.Order = 0; menuReleaseDocument.Url = "#"; menuReleaseDocument.Icon = "fa fa-cog"; menuReleaseDocument.CssClass = "treeview"; menuReleaseDocument.Items.Add(new MenuItem { Name = MenuNameConstants.ReleaseNewDocument, DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuReleaseNewDocument), Url = "/document/index", Order = 0 }); menuReleaseDocument.Items.Add(new MenuItem { Name = MenuNameConstants.ReviewDocument, DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuReviewDocument), Url = "/document/reviewdocument", Order = 1 }); #endregion moduleMenuItem.Items.Add(menuReleaseDocument); #region Appendice MenuItem menuAppendiceDocument = new MenuItem(); menuAppendiceDocument.Name = MenuNameConstants.ReleaseAppendice; menuAppendiceDocument.DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuReleaseAppendice); menuAppendiceDocument.Order = 0; menuAppendiceDocument.Url = "#"; menuAppendiceDocument.Icon = "fa fa-cog"; menuAppendiceDocument.CssClass = "treeview"; menuAppendiceDocument.Items.Add(new MenuItem { Name = MenuNameConstants.ReleaseNewAppendice, DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuReleaseNewAppendice), Url = "/appendice/index", Order = 0 }); menuAppendiceDocument.Items.Add(new MenuItem { Name = MenuNameConstants.ReviewAppendice, DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuReviewAppendice), Url = "/document/reviewdocument", Order = 1 }); #endregion moduleMenuItem.Items.Add(menuAppendiceDocument); #region Categories MenuItem menuCategory = new MenuItem(); menuCategory.Name = MenuNameConstants.Category; menuCategory.DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuCategory); menuCategory.Order = 0; menuCategory.Url = "#"; menuCategory.Icon = "fa fa-list"; menuCategory.CssClass = "treeview"; menuCategory.Items.Add(new MenuItem { Name = MenuNameConstants.Module, DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuModule), Url = "/module/index", Order = 0 }); menuCategory.Items.Add(new MenuItem { Name = MenuNameConstants.DocumentType, DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuDocumentType), Url = "/documenttype/index", Order = 1 }); menuCategory.Items.Add(new MenuItem { Name = MenuNameConstants.PromulgateStatus, DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuPromulgateStatus), Url = "/promulgatestatus/index", Order = 2 }); #endregion moduleMenuItem.Items.Add(menuCategory); } #region Operation Data MenuItem menuOperationData = new MenuItem(); menuOperationData.Name = MenuNameConstants.OperationData; menuOperationData.DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuOperationData); menuOperationData.Order = 0; menuOperationData.Url = "#"; menuOperationData.Icon = "fa fa-list"; menuOperationData.CssClass = "treeview"; var documentTypes = SimpleCache.DocumentTypes; if (documentTypes != null && documentTypes.Any()) { foreach (var documentType in documentTypes) { menuOperationData.Items.Add(new MenuItem { Name = documentType.Code, DisplayName = documentType.Name, Url = $"/OperationData/list?code={documentType.Code}", Order = 2 }); } } #endregion moduleMenuItem.Items.Add(menuOperationData); moduleMenuItems.Add(moduleMenuItem); return(moduleMenuItems); }