示例#1
0
        public static int CopySiteTemplates(int sourceSiteId, int destinationSiteId, int templateNumber)
        {
            var templateIdNew       = PageTemplateRepository.CopySiteTemplates(sourceSiteId, destinationSiteId, templateNumber);
            var relBetweenTemplates = PageTemplateRepository.GetRelationsBetweenTemplates(sourceSiteId, destinationSiteId, templateIdNew);
            var relBetweenContents  = ContentRepository.GetRelationsBetweenContentsXml(sourceSiteId, destinationSiteId, string.Empty);

            PageRepository.CopySiteTemplatePages(sourceSiteId, destinationSiteId, relBetweenTemplates);

            var relBetweenPages = PageRepository.GetRelationsBetweenPages(relBetweenTemplates);

            ObjectRepository.CopySiteTemplateObjects(relBetweenTemplates, relBetweenPages, out var relBetweenObjects);

            ObjectFormatRepository.CopySiteTemplateObjectFormats(relBetweenObjects, out var relBetweenObjectFormats);

            ObjectRepository.CopySiteUpdateObjects(relBetweenObjectFormats, relBetweenObjects);
            ObjectRepository.CopySiteObjectValues(relBetweenObjects);
            ObjectRepository.CopySiteContainers(relBetweenObjects, relBetweenContents);

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

            ObjectRepository.CopyContainerStatuses(relBetweenStatuses, relBetweenObjects);

            NotificationRepository.CopySiteUpdateNotifications(relBetweenObjectFormats, relBetweenContents);

            return(templateIdNew != 0 ? 1 : 0);
        }