Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

How to get notified when OU changes #3726


User avatar
0
bilalhaidar created

Hi, I am making use of OU to provide some dropdown lists for users with the following hierarchy:

Region --> Camp --> Shelter --> Sub Shelter 1 / Sub Shelter 2 / ...

I want to be notified when:

Member is removed or added OU is removed or added or changed (name)

Can I make use of the Entity events something like "EntityCreatedEventData<OrganizationUnit>" and "EntityUpdatedEventData<OrganizationUnit>" and "EntityChangedEventData<OrganizationUnit>" and "EntityDeletedEventData<OrganizationUnit>"

One more thing, on the client side, do you trigger any events similar to the above? For instance, if an OU changes, I want to clear the Local Storage data (that I am using to cache the data in).

Finally, can I cancel for instance deleting an OU by handling "EntityDeletingEventData<OrganizationUnit>"? The reason I am asking for that is that maybe an OU is already used on another Entity and deleting it would break the data. So before deleting an OU, I would check if this OU that is being deleted is linked to some other entity, if yes, I halt the deletion process?

How is that possible? Any example, please.

Thanks Bilal


6 Answer(s)
  • User Avatar
    0
    bilalhaidar created

    Any assistance?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @bilalhaidar,

    Yes, you can use Event Bus for most of your needs, you can read more about it here <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/EventBus-Domain-Events">https://aspnetboilerplate.com/Pages/Doc ... ain-Events</a>.

    We don't have any client side implementation about it. You can also cancel deletion of an entity in [*ING] events.

    Thanks.

  • User Avatar
    0
    bilalhaidar created

    Thanks for your time Ismail.

    I could make use of the abp.event.trigger and abp.event.on but then I have to add this code to the OU screen, is that okay? Or I shouldnt be touching those screens in general.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Yes, you can use those client side methods. You also need to call client side code from server using SignalR. You can check implementation of Chat for that.

    Thanks.

  • User Avatar
    0
    bilalhaidar created

    Thanks. Maybe this is the best option. To make use of server-side events since they exist and then use SignalR to call some code on client side to invalidate the data in Local Storage.

    Thank you

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It seems like that :)