1234567891011121314151617181920212223242526272829303132333435363738 |
- using System;
- using Luticate2.Utils.Dbo.Basic;
- using Luticate2.Utils.Interfaces;
-
- namespace Luticate2.Utils.Business
- {
- public static class LuUtilsBusinessExtensions
- {
- public static void NotifyCrudCreate(this ILuNotificationsBusiness business, string entityType, object newEntity)
- {
- business.Notify(LuUtilsConstants.EventCreate, entityType, null, newEntity);
- }
-
- public static void NotifyCrudUpdate(this ILuNotificationsBusiness business, string entityType, object oldEntity, object newEntity)
- {
- business.Notify(LuUtilsConstants.EventUpdate, entityType, oldEntity, newEntity);
- }
-
- public static void NotifyCrudDelete(this ILuNotificationsBusiness business, string entityType, object oldEntity)
- {
- business.Notify(LuUtilsConstants.EventDelete, entityType, oldEntity, null);
- }
-
- public static string GetCrudEntityType(this Type crudType)
- {
- var name = crudType.Name;
- if (name.EndsWith("Business"))
- {
- name = name.Remove(name.Length - 8);
- }
- if (name.Length > 0 && char.IsUpper(name[0]))
- {
- name = char.ToLower(name[0]) + name.Remove(0, 1);
- }
- return name;
- }
- }
- }
|