Пример #1
0
        public MultistepActionStepResult Step(int step)
        {
            var result          = new MultistepActionStepResult();
            var sourceSite      = SiteRepository.GetById(SiteId);
            var destinationSite = SiteRepository.GetById(NewSiteId.Value);

            var helper = new CopySiteFilesHelper(sourceSite, destinationSite);

            helper.CopyDirectories();
            result.ProcessedItemsCount = helper.CopyFiles(step);

            return(result);
        }
Пример #2
0
        public CopySiteFilesCommand(int siteId, string siteName, bool doNotCopyFiles)
        {
            SiteId   = siteId;
            SiteName = siteName;

            var prms = (CopySiteSettings)HttpContext.Current.Session[HttpContextSession.CopySiteServiceSettings];

            NewSiteId = prms.DestinationSiteId;

            var sourceSite = SiteRepository.GetById(SiteId);

            if (doNotCopyFiles)
            {
                StepsCount = 0;
                return;
            }

            AllFilesSize = CopySiteFilesHelper.GetAllFileSize(sourceSite);
            AllFileCount = CopySiteFilesHelper.FilesCount(sourceSite);

            var steps = (double)AllFilesSize / CopySiteFilesHelper.FilesSizeLimitPerTransaction;

            StepsCount = CleverRoundSteps(steps);
        }