public virtual void OnPostDelete(PostDeleteEvent e)
 {
     if (used)
     {
         ProcessWork(e.Entity, e.Id, WorkType.Delete, e);
     }
 }
Exemplo n.º 2
0
 /*  public bool OnPreDelete(PreDeleteEvent @event)
 {
     return false;
 }*/
 public void OnPostDelete(PostDeleteEvent @event)
 {
     var persistableObject = @event.Entity as IPersistableObject;
     persistableObject.OnDeleted();
     //if (persistableObject != null)
     //{
     //    persistableObject.SysState = EntityStateEnum.Deleted;
     //}
 }
Exemplo n.º 3
0
		public void OnPostDelete(PostDeleteEvent @event)
		{
			IAuditor auditor;
			auditors.TryGetValue(@event.Persister.EntityName, out auditor);
			if (auditor == null)
			{
				return;
			}
			auditor.Deleted(@event);
		}
        /// <summary>
        /// The on post delete.
        /// </summary>
        /// <param name="event">
        /// The event.
        /// </param>
        public void OnPostDelete(PostDeleteEvent @event)
        {
            if (!(@event.Entity is IEntity))
            {
                return;
            }

            var domainEvent = CreateDomainEvent(typeof(EntityDeletedEvent<>), @event.Entity);
            DomainEvents.Raise(domainEvent);
        }
Exemplo n.º 5
0
        public void OnPostDelete(PostDeleteEvent @event)
        {
            if (@event.Entity is ISearchable == false)
                return;

            using (var session = sessionFactory.OpenSession())
            {
                session.FlushMode = FlushMode.Never;
                var entity = session.Get(@event.Entity.GetType(), ((ISearchable) @event.Entity).Id);
                Indexer.RemoveFromLucene((ISearchable)entity);
            }
        }
Exemplo n.º 6
0
        public void OnPostDelete(PostDeleteEvent @event)
        {
            var seat = default(Seat);

            if (@event.TryCatchEntity(ref seat))
            {
                if(_seatBoxRepository==null)
                    _seatBoxRepository = ServiceLocator.Current.GetInstance<ISeatBoxRepository>();
                // = @event.Session.SessionFactory.OpenSession();
                _seatBoxRepository.MakeTransient(seat);
                //@event.Session.SessionFactory.GetCurrentSession();
            }
        }
Exemplo n.º 7
0
        public virtual void OnPostDelete(PostDeleteEvent evt)
        {
            var entityName = evt.Persister.EntityName;
            if (!VerCfg.EntCfg.IsVersioned(entityName)) return;

            var verSync = VerCfg.AuditProcessManager.Get(evt.Session);
            var workUnit = new DelWorkUnit(evt.Session, evt.Persister.EntityName, VerCfg,
                                            evt.Id, evt.Persister, evt.DeletedState);
            verSync.AddWorkUnit(workUnit);
            if (workUnit.ContainsWork())
            {
                GenerateBidirectionalCollectionChangeWorkUnits(verSync, evt.Persister, entityName, null,
                                                                    evt.DeletedState, evt.Session);
            }
        }
Exemplo n.º 8
0
        public void OnPostDelete(PostDeleteEvent @event)
        {
            if (!(@event.Entity is Entity))
                return;

            var session = @event.Session.GetSession(EntityMode.Poco);
            var entityName = @event.Entity.GetType().Name;
            var propertyNames = @event.Persister.EntityMetamodel.PropertyNames;
            var before = Serialize(propertyNames, @event.DeletedState);
            var after = string.Empty;

            Log.Debug(before);

            AuditEvent(session, @event.Id, "DELETE", entityName, before, after);
        }
Exemplo n.º 9
0
        public void OnPostDelete(PostDeleteEvent evt)
        {
            String entityName = evt.Persister.EntityName;

            if (verCfg.EntCfg.IsVersioned(entityName)) {
                AuditSync verSync = verCfg.AuditSyncManager.get(evt.Session);

                IAuditWorkUnit workUnit = new DelWorkUnit(evt.Session, evt.Persister.EntityName, verCfg,
                        evt.Id, evt.Persister, evt.DeletedState);
                verSync.AddWorkUnit(workUnit);

                if (workUnit.ContainsWork()) {
                    GenerateBidirectionalCollectionChangeWorkUnits(verSync, evt.Persister, entityName, null,
                            evt.DeletedState, evt.Session);
                }
            }
        }
        public void OnPostDelete(PostDeleteEvent e)
        {
            if (Params.SkipTrakingList.Contains(e.Entity.GetType().FullName)
                || e.Entity.GetType().Name.Equals("AuditRegister"))
                return;

            var entityFullName = e.Entity.GetType().FullName;

            var aud = new AuditRegister()
            {
                ContextId = long.Parse(e.Id.ToString()),
                OperationDate = DateTime.Now,
                OperationType = AuditOperationType.Delete,
                ObjectName = AnnotationsAttributes.GetClassTitle(e.Entity.GetType()),
                ContextUser = GetUsuarioLogado(),
            };

            e.Session.GetSession(EntityMode.Poco).Save(aud);
        }
Exemplo n.º 11
0
        public void OnPostDelete(PostDeleteEvent @event)
        {
            var entity = default(Term);

            if (@event.TryCatchEntity(ref entity))
            {
                var statelessSession = @event.Persister.Factory.OpenStatelessSession();

                var log = new TermLog
                              {
                                  EmployeeId = entity.GetSnapshotValue<Guid>("EmployeeId"),
                                  Action = "D",
                                  Type = entity.GetType().Name,
                                  Name = entity.Text,
                                  Category = _alterWay,
                                  OldTime = FormatTime(entity.Start, entity.End),
                                  NewTime = null,
                                  Remark = _batchAlteringComments
                              };
                SaveLog(statelessSession, log);
                entity.EndEdit();
            }
        }
        public void OnPostDelete(PostDeleteEvent @event)
        {
            System.Diagnostics.Debug.WriteLine("*** OnPostDelete Start ***");

            var product = @event.Entity as SampleSolrApp.Models.Nh.Product;
            if (product != null)
            {
                var productWriter = StructureMap.ObjectFactory.GetInstance<SolrNet.ISolrOperations<SampleSolrApp.Models.Nh.Product>>();
                productWriter.Delete(product);
                productWriter.Commit();
                System.Diagnostics.Debug.WriteLine("*** Product deleted and commited ***");
            }

            var manufacturer = @event.Entity as SampleSolrApp.Models.Nh.Manufacturer;
            if (manufacturer != null)
            {
                var manufacturerWriter = StructureMap.ObjectFactory.GetInstance<SolrNet.ISolrOperations<SampleSolrApp.Models.Nh.Manufacturer>>();
                manufacturerWriter.Delete(manufacturer);
                manufacturerWriter.Commit();
                System.Diagnostics.Debug.WriteLine("*** Manufacturer deleted and commited ***");
            }

            System.Diagnostics.Debug.WriteLine("*** OnPostDelete End ***");
        }
Exemplo n.º 13
0
 public abstract void Deleted(PostDeleteEvent eventArgs);
 public void OnPostDelete(PostDeleteEvent @event)
 {
 }
		private void PostCommitDelete()
		{
			IPostDeleteEventListener[] postListeners = Session.Listeners.PostCommitDeleteEventListeners;
			if (postListeners.Length > 0)
			{
				PostDeleteEvent postEvent = new PostDeleteEvent(Instance, Id, state, Persister, (IEventSource)Session);
				foreach (IPostDeleteEventListener listener in postListeners)
				{
					listener.OnPostDelete(postEvent);
				}
			}
		}
Exemplo n.º 16
0
 public void OnPostDelete(PostDeleteEvent @event)
 {
     log.Info(@event.Id.ToString() + " has been deleted.");
 }
        public void OnPostDelete(PostDeleteEvent @event)
        {
            AuditLogItem ali = AuditLogItem.Find(@event.Entity.GetType());
            if ((ali.AuditLogAction & PPWAuditLogActionEnum.DELETE) == PPWAuditLogActionEnum.DELETE)
            {
                string identityName = IdentityNameHelper.GetIdentityName();
                DateTime now = DateTime.Now;
                string entityName = @event.Entity.GetType().Name;

                using (ISession session = @event.Session.GetSession(EntityMode.Poco))
                {
                    session.Save(new AuditLog
                    {
                        EntryType = "D",
                        EntityName = entityName,
                        EntityId = (long?)@event.Id,
                        CreatedBy = identityName,
                        CreatedAt = now,
                    });
                    session.Flush();
                }
            }
        }
Exemplo n.º 18
0
 public void OnPostDelete(PostDeleteEvent @event)
 {
     log.Debug("OnPostDelete :" + @event);
 }
Exemplo n.º 19
0
 public void OnPostDelete(PostDeleteEvent @event)
 {
     Debug.WriteLine("EventListener.OnPostDelete: {0}", @event.Id);
 }
 /// <summary>
 /// Called when [post delete].
 /// </summary>
 /// <param name="event">The @event.</param>
 public void OnPostDelete( PostDeleteEvent @event )
 {
     AuditPatientAccess(@event.Entity, @event, PatientAccessEventType.DeleteEvent, () => GetAuditNoteForEntity(@event.Entity));
 }
 public void OnPostDelete(PostDeleteEvent ev)
 {
     DispatchEvents(ev.Entity as AggregateRoot);
 }
 public void OnPostDelete(PostDeleteEvent @event)
 {
     EventDispatcher.RaiseEvent(@event.Entity, typeof (DeletedEvent));
 }
Exemplo n.º 23
0
        public void OnPostDelete(PostDeleteEvent @event)
        {
            if (@event.Entity is Audit)
            {
                return;
            }

            if (@event.Entity is IAuditable)
            {

                var auditableEntity = @event.Entity as IAuditable;
                var entityId = @event.Id.ToString();
                var entityFullName = @event.Entity.GetType().FullName;
                
                if (auditableEntity.LastModifiedBy == null)
                {
                    throw new AuditDeleteLastModifiedByNotSetExceptions(entityFullName, entityId);
                }

                AddRecord(
                    "D",
                    entityFullName,
                    entityId,
                    "Entity Deleted",
                    "Entity Deleted",
                    "Entity Deleted",
                    DateTime.Now,
                    auditableEntity.LastModifiedBy.Id.ToString(),
                    Guid.NewGuid());
            }
        }
Exemplo n.º 24
0
			public void OnPostDelete(PostDeleteEvent @event)
			{
				log.Debug("PostCommitDelete fired.");
			}