Exemple #1
0
        public static IEnumerable <DataRow> CopyVirtualContents(int sourceSiteId, int destinationSiteId)
        {
            var newContents   = ContentRepository.CopyVirtualContents(sourceSiteId, destinationSiteId).ToList();
            var newContentIds = string.Join(",", newContents.Select(r => r.Field <int>("content_id_new")));

            FieldRepository.CopyContentsAttributes(sourceSiteId, destinationSiteId, newContentIds, true);

            var relBetweenAttributes = FieldRepository.GetRelationsBetweenAttributesXml(sourceSiteId, destinationSiteId, string.Empty, null, true);

            if (string.IsNullOrEmpty(newContentIds))
            {
                newContentIds = "0";
            }

            FieldRepository.UpdateAttributes(sourceSiteId, destinationSiteId, relBetweenAttributes, newContentIds);
            ContentRepository.CopyUnionContents(sourceSiteId, destinationSiteId, newContentIds);
            ContentRepository.UpdateVirtualContentAttributes(sourceSiteId, destinationSiteId);

            FieldRepository.UpdateAttributesOrder(destinationSiteId, relBetweenAttributes, newContentIds);

            ContentRepository.CopyContentsGroups(sourceSiteId, destinationSiteId);
            ContentRepository.UpdateContentGroupIds(sourceSiteId, destinationSiteId);

            var relBetweenContents = ContentRepository.GetRelationsBetweenContentsXml(sourceSiteId, destinationSiteId, string.Empty);

            ContentRepository.CopyUserQueryContents(relBetweenContents);

            ContentRepository.CopyUserQueryAttributes(relBetweenContents, relBetweenAttributes);

            return(newContents);
        }
Exemple #2
0
        public static int CopyContents(int sourceSiteId, int destinationSiteId, int startFrom, int endOn)
        {
            var count = ContentRepository.CopyContents(sourceSiteId, destinationSiteId, startFrom, endOn, out var newContentIds);

            var relBetweenContents = ContentRepository.GetRelationsBetweenContentsXml(sourceSiteId, destinationSiteId, newContentIds);
            var relBetweenStatuses = ContentRepository.GetRelationsBetweenStatuses(sourceSiteId, destinationSiteId);

            FieldRepository.CopyContentsAttributes(sourceSiteId, destinationSiteId, newContentIds, false);
            var relBetweenAttributes = FieldRepository.GetRelationsBetweenAttributesXml(sourceSiteId, destinationSiteId, newContentIds, false, true);

            NotificationRepository.CopyContentNotifications(relBetweenContents, relBetweenStatuses, relBetweenAttributes);

            ContentRepository.CopyContentConstraints(relBetweenContents, out var relBetweenConstraints);
            ContentConstraintRepository.CopyContentConstrainRules(relBetweenConstraints, relBetweenAttributes);

            FieldRepository.CopyDynamicImageAttributes(relBetweenAttributes);
            ContentRepository.CopyContentWorkflowBind(sourceSiteId, destinationSiteId, relBetweenContents);
            return(count);
        }