public void GetStepCountTest() { Assert.AreEqual(0, MultistepActionHelper.GetStepCount(0, 20)); Assert.AreEqual(1, MultistepActionHelper.GetStepCount(1, 20)); Assert.AreEqual(1, MultistepActionHelper.GetStepCount(19, 20)); Assert.AreEqual(1, MultistepActionHelper.GetStepCount(20, 20)); Assert.AreEqual(2, MultistepActionHelper.GetStepCount(21, 20)); Assert.AreEqual(5, MultistepActionHelper.GetStepCount(100, 20)); Assert.AreEqual(6, MultistepActionHelper.GetStepCount(101, 20)); }
public MultistepActionSettings SetupAction(int contentId, int fieldId) { if (HasAlreadyRun()) { throw new ApplicationException(MultistepActionStrings.ActionHasAlreadyRun); } var flds = GetFields(fieldId); if (flds.Item1.BaseImageId != null) { var articleData = RecreateDynamicImagesRepository.GetDataToProcess(flds.Item1.BaseImageId.Value); var dataRows = articleData as DataRow[] ?? articleData.ToArray(); var context = new RecreateDynamicImagesContext { FieldId = fieldId, ContentId = contentId, ArticleData = dataRows.Select(r => Tuple.Create(Converter.ToInt32(r.Field <decimal>("ID")), r.Field <string>("DATA"))).ToArray(), ProcessedImages = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase) }; HttpContext.Current.Session[HttpContextSession.RecreateDynamicImagesServiceProcessingContext] = context; var itemCount = dataRows.Length; var stepCount = MultistepActionHelper.GetStepCount(itemCount, ItemsPerStep); return(new MultistepActionSettings { Stages = new[] { new MultistepStageSettings { Name = FieldStrings.RecreateDynamicImagesStageName, StepCount = stepCount, ItemCount = itemCount } } }); } return(null); }
public MultistepActionSettings SetupAction(int contentId, int fieldId) { var field = FieldRepository.GetById(fieldId); if (field == null) { throw new ApplicationException(string.Format(FieldStrings.FieldNotFound, fieldId)); } var contentItemIdsToProcess = FieldDefaultValueRepository.GetItemIdsToProcess(contentId, fieldId, field.DefaultValue, field.IsBlob, field.ExactType == FieldExactTypes.M2MRelation); var itemIdsToProcess = contentItemIdsToProcess as int[] ?? contentItemIdsToProcess.ToArray(); var itemCount = itemIdsToProcess.Length; var stepCount = MultistepActionHelper.GetStepCount(itemCount, ItemsPerStep); var context = new FieldDefaultValueContext { ProcessedContentItemIds = itemIdsToProcess.ToArray(), ContentId = contentId, FieldId = fieldId, IsBlob = field.IsBlob, IsM2M = field.ExactType == FieldExactTypes.M2MRelation, DefaultArticles = field.DefaultArticleIds.ToArray(), Symmetric = field.ContentLink.Symmetric }; HttpContext.Current.Session[HttpContextSession.FieldDefaultValueServiceProcessingContext] = context; return(new MultistepActionSettings { Stages = new[] { new MultistepStageSettings { Name = FieldStrings.ApplyDefaultValueStageName, StepCount = stepCount, ItemCount = itemCount } } }); }
public MultistepStageSettings GetStageSettings() => new MultistepStageSettings { ItemCount = ContentsCount, StepCount = MultistepActionHelper.GetStepCount(ContentsCount, ItemsPerStep), Name = string.Format(SiteStrings.CopySiteContents, SiteName ?? string.Empty) };
public MultistepStageSettings GetStageSettings() => new MultistepStageSettings { ItemCount = _itemCount, StepCount = MultistepActionHelper.GetStepCount(_itemCount, ItemsPerStep), Name = SiteOrTemplate ? string.Format(SiteStrings.AssemblePagesStageName, AssemblingEntityName ?? string.Empty) : string.Format(TemplateStrings.AssemblePagesStageName, AssemblingEntityName ?? string.Empty) };
public MultistepStageSettings GetStageSettings() => new MultistepStageSettings { ItemCount = _itemCount, StepCount = MultistepActionHelper.GetStepCount(_itemCount, ItemsPerStep), Name = string.Format(ContentStrings.RebuildUserQueryStageName, ContentName ?? string.Empty) };
public MultistepStageSettings GetStageSettings() => new MultistepStageSettings { ItemCount = SiteArticlesCount, StepCount = MultistepActionHelper.GetStepCount(SiteArticlesCount, ItemsPerStep), Name = SiteStrings.CopySiteUpdateArticleIds };
public MultistepStageSettings GetStageSettings() => new MultistepStageSettings { ItemCount = ItemCount, StepCount = MultistepActionHelper.GetStepCount(ItemCount, ItemsPerStep), Name = MultistepActionStrings.ResourceManager.GetString(GetType().Name) };
public MultistepStageSettings GetStageSettings() => new MultistepStageSettings { ItemCount = ItemCount, StepCount = MultistepActionHelper.GetStepCount(ItemCount, ITEMS_PER_STEP), Name = string.Format(SiteStrings.RemoveSiteContentsStageName, SiteName ?? "") };
public MultistepStageSettings GetStageSettings() => new MultistepStageSettings { ItemCount = ItemCount, StepCount = MultistepActionHelper.GetStepCount(ItemCount, ItemsPerStep), Name = ContentStrings.ImportArticles };
public MultistepStageSettings GetStageSettings() => new MultistepStageSettings { ItemCount = ItemCount, StepCount = MultistepActionHelper.GetStepCount(ItemCount, ItemsPerStep), Name = string.Format(ContentStrings.ClearContentStageName, ContentName ?? string.Empty) };