Esempio n. 1
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            Categories = new List <AppliedTags>();
            DetailCollection tags = CurrentPage.GetDetailCollection("Tags", false);

            if (tags == null)
            {
                return;
            }

            foreach (ITag tag in tags)
            {
                AppliedTags applied = Categories.Find(at => at.Group == tag.Category);
                if (applied == null)
                {
                    applied = new AppliedTags {
                        Group = tag.Category, Tags = new List <string>()
                    };
                    Categories.Add(applied);
                }
                applied.Tags.Add(tag.Title);
            }
        }
Esempio n. 2
0
        private void ValidateTimeSeriesConfiguration()
        {
            GetAttachmentFilename("DummyLocation");

            if (!Context.AttachmentTags.Any())
            {
                return;
            }

            var locationTags = GetConfiguredTags()
                               .Where(t => t.AppliesToAttachments)
                               .ToDictionary(t => t.Key, t => t, StringComparer.InvariantCultureIgnoreCase);

            AppliedTags.Clear();

            foreach (var kvp in Context.AttachmentTags)
            {
                if (!locationTags.TryGetValue(kvp.Key, out var locationTag))
                {
                    throw new ExpectedException($"'{kvp.Key}' is not an existing tag with {nameof(Tag.AppliesToAttachments)}=true");
                }

                AppliedTags.Add(new ApplyTagRequest
                {
                    UniqueId = locationTag.UniqueId,
                    Value    = kvp.Value
                });
            }
        }
Esempio n. 3
0
 public TopicDetail ToDetail()
 {
     return(new TopicDetail
     {
         Id = Id,
         PublisherDetail = new AnonymousDetail
         {
             FakeName = Anonymous.Where(a => a.UserId == Publisher.Id).FirstOrDefault().DisplayName,
             UserId = Publisher.Id,
         },
         Tags = AppliedTags.Select(t => t.TagDisplayName).ToList(),
         Title = Title,
         ZoneId = ZoneId,
         ContentDetail = Content.ToDetail(),
     });
 }