private void OnScan(Session obj) { if (!obj.Encounters.Any()) { ScannedContentItems.Clear(); return; } var trie = new Trie(ContentItems.Select(x => x.Name).ToArray()); var sessionTrieIterator = new SessionTrieIterator(obj, ContentItems); trie.Iterate(sessionTrieIterator); ScannedContentItems.ClearAndLoad(sessionTrieIterator); }
public virtual DynamicContentPublication ToModel(DynamicContentPublication publication) { if (publication == null) { throw new ArgumentNullException(nameof(publication)); } publication.Id = Id; publication.CreatedBy = CreatedBy; publication.CreatedDate = CreatedDate; publication.ModifiedBy = ModifiedBy; publication.ModifiedDate = ModifiedDate; publication.OuterId = OuterId; publication.Name = Name; publication.Priority = Priority; publication.IsActive = IsActive; publication.StoreId = StoreId; publication.StartDate = StartDate; publication.EndDate = EndDate; publication.Description = Description; if (ContentItems != null) { publication.ContentItems = ContentItems.Select(x => x.ToModel(AbstractTypeFactory <DynamicContentItem> .TryCreateInstance())).ToList(); } if (ContentPlaces != null) { //TODO publication.ContentPlaces = ContentPlaces.Where(ci => ci.ContentPlace != null).Select(x => x.ContentPlace.ToModel(AbstractTypeFactory <DynamicContentPlace> .TryCreateInstance())).ToList(); } publication.DynamicExpression = AbstractTypeFactory <DynamicContentConditionTree> .TryCreateInstance(); if (PredicateVisualTreeSerialized != null) { publication.DynamicExpression = JsonConvert.DeserializeObject <DynamicContentConditionTree>(PredicateVisualTreeSerialized, new ConditionJsonConverter()); } return(publication); }
public virtual object Clone() { var result = MemberwiseClone() as DynamicContentPublication; if (DynamicExpression != null) { result.DynamicExpression = DynamicExpression.Clone() as DynamicContentConditionTree; } if (ContentItems != null) { result.ContentItems = new ObservableCollection <DynamicContentItem>( ContentItems.Select(x => x.Clone() as DynamicContentItem)); } if (ContentPlaces != null) { result.ContentPlaces = new ObservableCollection <DynamicContentPlace>( ContentPlaces.Select(x => x.Clone() as DynamicContentPlace)); } return(result); }