protected override void OnInit(EventArgs e) { base.OnInit(e); InitialiseList(); // The state of the list is determined by the current context. var currentCommunity = _communitiesQuery.GetCurrentCommunity(); if (currentCommunity != null) { // Set the default value to that of the current community. SetSelectedValue(currentCommunity.Id); // If the user is an employer that is not associated with any community then // they are a general employer so let them change the selection. Also, no community // should be selected. if (LoggedInEmployer.CanSearchAllMembers(currentCommunity)) { SetSelectedValue(null); _editable = true; } } else { // Default is to not specify any community. SetSelectedValue(null); _editable = true; } }
protected override void OnInit(EventArgs e) { base.OnInit(e); var contentEngine = Container.Current.Resolve <IContentEngine>(); var currentCommunity = _communitiesQuery.GetCurrentCommunity(); if (currentCommunity != null) { _item = contentEngine.GetContentItem <SectionContentItem>(ContentSectionName, currentCommunity.Id); } cvSidebarSection.ItemName = ContentSectionName; cvSidebarSection.TemplateUrl = "~/cms/ContentTemplates/SidebarSectionContentTemplate.ascx"; }
public static Guid?GetDefaultSearchCommunityId(this ICommunitiesQuery communitiesQuery, Employer employer) { // Check the current community. var community = communitiesQuery.GetCurrentCommunity(); // If there is no current community then no community to search by. if (community == null) { return(null); } // If they cannot search all members then restrict them to the current community. return(employer.CanSearchAllMembers(community) ? (Guid?)null : community.Id); }