コード例 #1
0
        private static void ConnectMapContainerToCollections()
        {
            var mapContainers = GetAllInformationObjects(null, io => io is MapContainer).Cast <MapContainer>().ToArray();

            foreach (var mapContainer in mapContainers)
            {
                mapContainer.MarkerSourceActivities = ActivityCollection.CreateDefault();
                mapContainer.MarkerSourceBlogs      = BlogCollection.CreateDefault();
                mapContainer.MarkerSourceLocations  = AddressAndLocationCollection.CreateDefault();
                mapContainer.ReconnectMastersAndCollections(true);
            }
        }
コード例 #2
0
        internal static void Update_BlogIndexGroup_BlogSourceForSummary(BlogIndexGroup blogIndexGroup, BlogCollection localCollection, BlogCollection masterCollection)
        {
            if (localCollection == null)
            {
                localCollection = BlogCollection.CreateDefault();
            }
            localCollection.CollectionContent.Clear();
            var limitDateTime = DateTime.UtcNow.AddMonths(-3);
            var relevantBlogs =
                masterCollection.CollectionContent.Where(blog => blog.Published >= limitDateTime).OrderByDescending(blog => blog.Published).Take(10).ToArray();
            var blogsByAuthor = relevantBlogs.GroupBy(blog => blog.Author).OrderBy(grpItem => grpItem.Key).ToArray();

            if (blogIndexGroup.GroupedByAuthor == null)
            {
                blogIndexGroup.GroupedByAuthor = GroupedInformationCollection.CreateDefault();
            }
            blogIndexGroup.GroupedByAuthor.CollectionContent.Clear();
            blogIndexGroup.GroupedByAuthor.CollectionContent.AddRange(blogsByAuthor.Select(blogGroupToGroupedInformation));

            if (blogIndexGroup.GroupedByCategory == null)
            {
                blogIndexGroup.GroupedByCategory = GroupedInformationCollection.CreateDefault();
            }
            if (blogIndexGroup.GroupedByDate == null)
            {
                blogIndexGroup.GroupedByDate = GroupedInformationCollection.CreateDefault();
            }
            if (blogIndexGroup.GroupedByLocation == null)
            {
                blogIndexGroup.GroupedByLocation = GroupedInformationCollection.CreateDefault();
            }

            var archiveSeq = masterCollection.CollectionContent.OrderByDescending(blog => blog.Published)
                             .ThenBy(blog => blog.Title)
                             .Select(blog => blog.ReferenceToInformation);

            if (blogIndexGroup.FullBlogArchive == null)
            {
                blogIndexGroup.FullBlogArchive = ReferenceCollection.CreateDefault();
            }
            blogIndexGroup.FullBlogArchive.CollectionContent.Clear();
            blogIndexGroup.FullBlogArchive.CollectionContent.AddRange(archiveSeq);
        }