Exemplo n.º 1
0
        void ISPModelEventHandler.HandleEvent(SPModel item, SPModelEventArgs e)
        {
            T typedItem = CommonHelper.TryCastOrDefault <T>(item);

            switch (e.EventType)
            {
            case SPModelEventType.Adding:
                OnAdding(typedItem, e);
                OnAddingOrUpdating(typedItem, e);
                return;

            case SPModelEventType.Added:
                OnAdded(typedItem, e);
                OnAddedOrUpdated(typedItem, e);
                return;

            case SPModelEventType.AddedAsync:
                OnAddedAsync(typedItem, e);
                OnAddedOrUpdatedAsync(typedItem, e);
                return;

            case SPModelEventType.Updating:
                OnUpdating(typedItem, e);
                OnAddingOrUpdating(typedItem, e);
                return;

            case SPModelEventType.Updated:
                OnUpdated(typedItem, e);
                OnAddedOrUpdated(typedItem, e);
                return;

            case SPModelEventType.UpdatedAsync:
                OnUpdatedAsync(typedItem, e);
                OnAddedOrUpdatedAsync(typedItem, e);
                return;

            case SPModelEventType.Deleting:
                OnDeleting(typedItem, e);
                return;

            case SPModelEventType.Deleted:
                OnDeleted(typedItem, e);
                return;

            case SPModelEventType.Publishing:
                OnPublishing(typedItem, e);
                return;

            case SPModelEventType.Published:
                OnPublished(typedItem, e);
                return;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Invoked when the underlying list item is being added to a list.
 /// </summary>
 /// <param name="e">Event data.</param>
 protected virtual void OnAdding(SPModelEventArgs e)
 {
 }
Exemplo n.º 3
0
        internal void HandleEvent(SPModelEventArgs e)
        {
            SPModelDescriptor descriptor = SPModelDescriptor.Resolve(this.GetType());

            foreach (SPModelInterfaceTypeDescriptor d in descriptor.Interfaces)
            {
                if (d.EventHandlerType != null)
                {
                    ISPModelEventHandler handler = (ISPModelEventHandler)d.EventHandlerType.CreateInstance();
                    handler.HandleEvent(this, e);
                }
            }
            switch (e.EventType)
            {
            case SPModelEventType.Adding:
                OnAdding(e);
                OnAddingOrUpdating(e);
                return;

            case SPModelEventType.Added:
                OnAdded(e);
                OnAddedOrUpdated(e);
                return;

            case SPModelEventType.AddedAsync:
                OnAddedAsync(e);
                OnAddedOrUpdatedAsync(e);
                return;

            case SPModelEventType.Updating:
                OnUpdating(e);
                OnAddingOrUpdating(e);
                return;

            case SPModelEventType.Updated:
                OnUpdated(e);
                OnAddedOrUpdated(e);
                return;

            case SPModelEventType.UpdatedAsync:
                OnUpdatedAsync(e);
                OnAddedOrUpdatedAsync(e);
                return;

            case SPModelEventType.Deleting:
                OnDeleting(e);
                return;

            case SPModelEventType.Deleted:
                OnDeleted(e);
                return;

            case SPModelEventType.Publishing:
                OnPublishing(e);
                return;

            case SPModelEventType.Published:
                OnPublished(e);
                return;
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Invoked when the underlying list item is published.
 /// </summary>
 /// <param name="e">Event data.</param>
 protected virtual void OnPublished(SPModelEventArgs e)
 {
 }
Exemplo n.º 5
0
 /// <summary>
 /// Invoked when the underlying list item is deleted.
 /// </summary>
 /// <param name="e">Event data.</param>
 protected virtual void OnDeleted(SPModelEventArgs e)
 {
 }
Exemplo n.º 6
0
 /// <summary>
 /// Invoked asynchronously when the underlying list item is added to a list or updated.
 /// </summary>
 /// <param name="e">Event data.</param>
 protected virtual void OnAddedOrUpdatedAsync(SPModelEventArgs e)
 {
 }
Exemplo n.º 7
0
 /// <summary>
 /// Invoked when the underlying list item is updated.
 /// </summary>
 /// <param name="e">Event data.</param>
 protected virtual void OnUpdated(SPModelEventArgs e)
 {
 }
Exemplo n.º 8
0
 /// <summary>
 /// Invoked when the underlying list item is being deleted.
 /// </summary>
 /// <param name="item">Instance of the model class representing a list item.</param>
 /// <param name="e">Event data.</param>
 public virtual void OnDeleting(T item, SPModelEventArgs e)
 {
 }
Exemplo n.º 9
0
 /// <summary>
 /// Invoked asynchronously when the underlying list item is added to a list or updated.
 /// </summary>
 /// <param name="item">Instance of the model class representing a list item.</param>
 /// <param name="e">Event data.</param>
 public virtual void OnAddedOrUpdatedAsync(T item, SPModelEventArgs e)
 {
 }
Exemplo n.º 10
0
 /// <summary>
 /// Invoked when the underlying list item is being added to a list or being updated.
 /// </summary>
 /// <param name="item">Instance of the model class representing a list item.</param>
 /// <param name="e">Event data.</param>
 public virtual void OnAddingOrUpdating(T item, SPModelEventArgs e)
 {
 }
Exemplo n.º 11
0
 /// <summary>
 /// Invoked when the underlying list item is updated.
 /// </summary>
 /// <param name="item">Instance of the model class representing a list item.</param>
 /// <param name="e">Event data.</param>
 public virtual void OnUpdated(T item, SPModelEventArgs e)
 {
 }
Exemplo n.º 12
0
 /// <summary>
 /// Invoked when the underlying list item is added to a list.
 /// </summary>
 /// <param name="item">Instance of the model class representing a list item.</param>
 /// <param name="e">Event data.</param>
 public virtual void OnAdded(T item, SPModelEventArgs e)
 {
 }
Exemplo n.º 13
0
 /// <summary>
 /// Invoked when the underlying list item is published.
 /// </summary>
 /// <param name="item">Instance of the model class representing a list item.</param>
 /// <param name="e">Event data.</param>
 public virtual void OnPublished(T item, SPModelEventArgs e)
 {
 }