public virtual void Delete(string[] ids, string[] memberTypes = null)
        {
            using (var repository = RepositoryFactory())
            {
                var members = GetByIds(ids, null, memberTypes);
                if (!members.IsNullOrEmpty())
                {
                    var changedEntries = members.Select(x => new GenericChangedEntry <Member>(x, EntryState.Deleted));
                    EventPublisher.Publish(new MemberChangingEvent(changedEntries));

                    repository.RemoveMembersByIds(members.Select(m => m.Id).ToArray());
                    CommitChanges(repository);
                    foreach (var member in members)
                    {
                        DynamicPropertyService.DeleteDynamicPropertyValues(member);
                        var seoObject = member as ISeoSupport;
                        if (seoObject != null)
                        {
                            CommerceService.DeleteSeoForObject(seoObject);
                        }
                    }
                    EventPublisher.Publish(new MemberChangedEvent(changedEntries));
                }
            }
        }
Beispiel #2
0
        public virtual void Delete(string[] ids)
        {
            var orders = GetByIds(ids, CustomerOrderResponseGroup.Full.ToString());

            using (var repository = RepositoryFactory())
            {
                foreach (var order in orders)
                {
                    OrderChangingPublisher.Publish(new OrderChangeEvent(EntryState.Deleted, order, order));
                }

                repository.RemoveOrdersByIds(ids);

                foreach (var order in orders)
                {
                    DynamicPropertyService.DeleteDynamicPropertyValues(order);
                }

                repository.UnitOfWork.Commit();

                foreach (var order in orders)
                {
                    OrderChangedPublisher.Publish(new OrderChangedEvent(EntryState.Deleted, order, order));
                }
            }
        }
        public override void Delete(string[] ids)
        {
            var orders = GetByIds(ids, CustomerOrderResponseGroup.Full.ToString());

            using (var repository = RepositoryFactory()) {
                var dbOrders = repository.GetCustomerOrdersByIds(ids, CustomerOrderResponseGroup.Full);
                foreach (var order in orders)
                {
                    CustomerOrderEventventPublisher.Publish(new OrderChangeEvent(Platform.Core.Common.EntryState.Deleted, order, order));
                }
                repository.RemoveOrdersByIds(ids);
                foreach (var order in orders)
                {
                    DynamicPropertyService.DeleteDynamicPropertyValues(order);
                }
                repository.UnitOfWork.Commit();
            }
        }
        public virtual void Delete(string[] cartIds)
        {
            var carts = GetByIds(cartIds);

            using (var repository = RepositoryFactory())
            {
                //Raise domain events before deletion
                var changedEntries = carts.Select(x => new GenericChangedEntry <ShoppingCart>(x, EntryState.Deleted));
                EventPublisher.Publish(new CartChangeEvent(changedEntries));

                repository.RemoveCarts(cartIds);

                foreach (var cart in carts)
                {
                    DynamicPropertyService.DeleteDynamicPropertyValues(cart);
                }
                repository.UnitOfWork.Commit();
                //Raise domain events after deletion
                EventPublisher.Publish(new CartChangedEvent(changedEntries));
            }
        }
        public virtual void Delete(string[] ids)
        {
            var orders = GetByIds(ids, CustomerOrderResponseGroup.Full.ToString());

            using (var repository = RepositoryFactory())
            {
                //Raise domain events before deletion
                var changedEntries = orders.Select(x => new GenericChangedEntry <CustomerOrder>(x, EntryState.Deleted));
                EventPublisher.Publish(new OrderChangeEvent(changedEntries));

                repository.RemoveOrdersByIds(ids);

                foreach (var order in orders)
                {
                    DynamicPropertyService.DeleteDynamicPropertyValues(order);
                }

                repository.UnitOfWork.Commit();
                //Raise domain events after deletion
                EventPublisher.Publish(new OrderChangedEvent(changedEntries));
            }
        }