Example #1
0
        protected override void InMemoryLogic(EntityCollectionBase target)
        {
            DateTime minStartDate = Moment;
            DateTime maxEndDate   = EndDate;

            target.ForEach(delegate(int index, CollectionItem item)
            {
                if (item.Item.Equals(target.ForeignItem(this)))
                {
                    if (item.Overlaps(Moment))
                    {
                        if (minStartDate > item.StartDate)
                        {
                            minStartDate = item.StartDate ?? DateTime.MinValue;
                        }

                        if (maxEndDate < item.EndDate)
                        {
                            maxEndDate = item.EndDate ?? DateTime.MaxValue;
                        }

                        target.RemoveAt(index);
                    }
                }
            });

            target.Add(target.NewCollectionItem(target.Parent, target.ForeignItem(this), minStartDate, maxEndDate));
        }
Example #2
0
 protected override void InMemoryLogic(EntityCollectionBase target)
 {
     target.ForEach(delegate(int index, CollectionItem item)
     {
         if (item.Item.Equals(target.ForeignItem(this)))
         {
             target.RemoveAt(index);
         }
     });
 }
        protected override void InMemoryLogic(EntityCollectionBase target)
        {
            bool contains = false;

            target.ForEach(delegate(int index, CollectionItem item)
            {
                if (item.Item.Equals(target.ForeignItem(this)))
                {
                    contains = true;
                }
            });
            if (!contains)
            {
                target.Add(target.NewCollectionItem(target.Parent, target.ForeignItem(this), null, null));
            }
        }
 protected override void InMemoryLogic(EntityCollectionBase target)
 {
     target.ForEach(delegate(int index, CollectionItem item)
     {
         if (item.Item.Equals(target.ForeignItem(this)))
         {
             if (item.IsAfter(Moment))
             {
                 target.RemoveAt(index);
             }
             else if (item.Overlaps(Moment))
             {
                 target.SetItem(index, target.NewCollectionItem(target.Parent, item.Item, item.StartDate, Moment));
             }
         }
     });
 }