private void InsertToCollection(IEnumerable <string> listToAdd, ModelItem modelItem) { var modelProperty = modelItem.Properties["MergeCollection"]; if (modelProperty != null) { ModelItemCollection mic = modelProperty.Collection; if (mic != null) { List <DataMergeDTO> listOfValidRows = MergeCollection.Where(c => !c.CanRemove()).ToList(); if (listOfValidRows.Count > 0) { DataMergeDTO dataMergeDto = MergeCollection.Last(c => !c.CanRemove()); int startIndex = MergeCollection.IndexOf(dataMergeDto) + 1; foreach (string s in listToAdd) { mic.Insert(startIndex, new DataMergeDTO(s, MergeCollection[startIndex - 1].MergeType, MergeCollection[startIndex - 1].At, startIndex + 1, MergeCollection[startIndex - 1].Padding, MergeCollection[startIndex - 1].Alignment)); startIndex++; } CleanUpCollection(mic, modelItem, startIndex); } else { AddToCollection(listToAdd, modelItem); } } } }
public override void UpdateForEachInputs(IList <Tuple <string, string> > updates, NativeActivityContext context) { if (updates != null) { foreach (Tuple <string, string> t in updates) { // locate all updates for this tuple Tuple <string, string> t1 = t; var items = MergeCollection.Where(c => !string.IsNullOrEmpty(c.InputVariable) && c.InputVariable.Equals(t1.Item1)); // issues updates foreach (var a in items) { a.InputVariable = t.Item2; } } } }
public override IList <DsfForEachItem> GetForEachInputs() { var items = (MergeCollection.Where(c => !string.IsNullOrEmpty(c.InputVariable)).Select(c => c.InputVariable).Union(MergeCollection.Where(c => !string.IsNullOrEmpty(c.At)).Select(c => c.At))).ToArray(); return(GetForEachItems(items)); }