/// <summary> /// retrieves tags and categories for the resource /// </summary> private void RetrieveTagsAndCategories() { using (ZentityContext context = CoreHelper.CreateZentityContext()) { ScholarlyWorkItem resource = context.Resources .OfType <ScholarlyWorkItem>() .Where(res => res.Id == ResourceUri) .FirstOrDefault(); if (resource == null || !resource.Authorize("Read", context, CoreHelper.GetAuthenticationToken())) { return; } resource.CategoryNodes.Load(); List <string> categoryNames = resource.CategoryNodes .Select(category => category.Title) .ToList(); CategoryNames.AddRange(categoryNames); resource.Tags.Load(); List <string> tagNames = resource.Tags .Select(tag => tag.Name) .ToList(); TagNames.AddRange(tagNames); } }
/// <summary> /// Populate tree view from data source. /// </summary> protected override void PopulateTree() { if (!this.Page.IsPostBack) { resource = GetScholarlyWorkItem(); _subjectLabel.Text = GlobalResource.CategoryAssociationSubjectLabel; _subjectLink.Text = HttpUtility.HtmlEncode(CoreHelper.FitString(CoreHelper.UpdateEmptyTitle( CoreHelper.GetTitleByResourceType(resource)), _maxCharShownTree)); _subjectLink.NavigateUrl = string.Format(CultureInfo.CurrentCulture, SubjectNavigationUrl, resource.Id); BindTreeView(true); } }