/// <summary> /// Primary method that build menu. This method examines all of the 'applications' that are /// present in a 'store' under the NetSqlAzMan model. Any valid menus are added to this instance. /// </summary> private void GetMenu() { try { IAzManStore store = _storage.GetStore(_store); // Am I allowed in this store (city)? This is top-level check. if (store.CheckStoreAccess(_dbUser, DateTime.Now, null)) { foreach (var applicationKvp in store.Applications) { IAzManApplication application = applicationKvp.Value; // Are there any menu items under this application that user has rights to? // If not then continue on to next application if (!_displayFullMenu && !application.CheckApplicationAccess(_dbUser, DateTime.Now, null)) { continue; } // Check if there is a menu at this (app) level. // If the application has a task named the same as the application then derive // the MenuItem item from that Task. It is possible for the application to not have a menu. PemsMenuItem appMenuItem = application.Items.ContainsKey(application.Name) ? GetTaskMenu(application.Items[application.Name]) : null; if (appMenuItem != null) { // Get any child menu items. GetTaskMenuItems(application.Name, appMenuItem, application.Items, 0); appMenuItem.Sort(); // Add present top-level app menu if it has children or has explicit link. if (appMenuItem.Url != null || appMenuItem.Count > 0) { Add(appMenuItem); } } } } } catch (Exception ex) { // If any exception, clear menu. Clear(); } // Prune dead branches. Prune(this); // Sort the menu list by Order this.Sort(); }