This commit is contained in:
@@ -1,12 +1,13 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class ContractBiz : BizObject, ISearchAbleObject
|
internal class ContractBiz : BizObject, ISearchAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
internal ContractBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal ContractBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
{
|
{
|
||||||
@@ -49,7 +50,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,7 +84,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +133,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +165,7 @@ namespace AyaNova.Biz
|
|||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -245,12 +246,30 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//JOB / OPERATIONS
|
// NOTIFICATION PROCESSING
|
||||||
//
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<ContractBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
//Other job handlers here...
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
@@ -11,7 +12,7 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class CustomerBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject
|
internal class CustomerBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
internal CustomerBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal CustomerBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
{
|
{
|
||||||
@@ -54,7 +55,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +89,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +138,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +201,7 @@ namespace AyaNova.Biz
|
|||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -470,6 +471,29 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// NOTIFICATION PROCESSING
|
||||||
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<CustomerBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
@@ -11,7 +12,7 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class HeadOfficeBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject
|
internal class HeadOfficeBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
internal HeadOfficeBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal HeadOfficeBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
{
|
{
|
||||||
@@ -54,7 +55,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +89,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +138,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +186,7 @@ namespace AyaNova.Biz
|
|||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -432,6 +433,31 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// NOTIFICATION PROCESSING
|
||||||
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<HeadOfficeBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class LoanUnitBiz : BizObject, ISearchAbleObject
|
internal class LoanUnitBiz : BizObject, ISearchAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
internal LoanUnitBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal LoanUnitBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
{
|
{
|
||||||
@@ -49,7 +50,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,7 +84,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +133,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +165,7 @@ namespace AyaNova.Biz
|
|||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -244,12 +245,27 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//JOB / OPERATIONS
|
// NOTIFICATION PROCESSING
|
||||||
//
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<LoanUnitBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
//Other job handlers here...
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
@@ -11,7 +12,7 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class MemoBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject
|
internal class MemoBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
internal MemoBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal MemoBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
{
|
{
|
||||||
@@ -55,7 +56,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -153,7 +154,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +187,7 @@ namespace AyaNova.Biz
|
|||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -439,6 +440,35 @@ namespace AyaNova.Biz
|
|||||||
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Completed);
|
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Completed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// NOTIFICATION PROCESSING
|
||||||
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<MemoBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class PMTemplateBiz : BizObject, ISearchAbleObject
|
internal class PMTemplateBiz : BizObject, ISearchAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
internal PMTemplateBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal PMTemplateBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
{
|
{
|
||||||
@@ -57,7 +58,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,7 +92,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +148,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +180,7 @@ namespace AyaNova.Biz
|
|||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -259,12 +260,30 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//JOB / OPERATIONS
|
// NOTIFICATION PROCESSING
|
||||||
//
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PMTemplateBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
//Other job handlers here...
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class PartBiz : BizObject, ISearchAbleObject
|
internal class PartBiz : BizObject, ISearchAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
internal PartBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal PartBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
{
|
{
|
||||||
@@ -49,7 +50,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,7 +84,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +133,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +165,7 @@ namespace AyaNova.Biz
|
|||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -245,12 +246,27 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//JOB / OPERATIONS
|
// NOTIFICATION PROCESSING
|
||||||
//
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PartBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
//Other job handlers here...
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -11,7 +12,7 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class ProjectBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject
|
internal class ProjectBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
internal ProjectBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal ProjectBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
{
|
{
|
||||||
@@ -54,7 +55,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +89,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +138,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +170,7 @@ namespace AyaNova.Biz
|
|||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -406,6 +407,29 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// NOTIFICATION PROCESSING
|
||||||
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<ProjectBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class PurchaseOrderBiz : BizObject, ISearchAbleObject
|
internal class PurchaseOrderBiz : BizObject, ISearchAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
internal PurchaseOrderBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal PurchaseOrderBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
{
|
{
|
||||||
@@ -49,7 +50,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,7 +84,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +133,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +163,7 @@ namespace AyaNova.Biz
|
|||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -242,12 +243,29 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//JOB / OPERATIONS
|
// NOTIFICATION PROCESSING
|
||||||
//
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PurchaseOrderBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
//Other job handlers here...
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -11,7 +12,7 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class ReminderBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject
|
internal class ReminderBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
internal ReminderBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal ReminderBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
{
|
{
|
||||||
@@ -54,7 +55,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +89,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +138,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +170,7 @@ namespace AyaNova.Biz
|
|||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -401,6 +402,29 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// NOTIFICATION PROCESSING
|
||||||
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<ReminderBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ namespace AyaNova.Biz
|
|||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -465,7 +465,7 @@ namespace AyaNova.Biz
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// NOTIFICATION PROCESSING
|
// NOTIFICATION PROCESSING
|
||||||
//
|
//
|
||||||
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj)
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
{
|
{
|
||||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<ReviewBiz>();
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<ReviewBiz>();
|
||||||
if (ServerBootConfig.SEEDING) return;
|
if (ServerBootConfig.SEEDING) return;
|
||||||
@@ -533,8 +533,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}//overdue event
|
}//overdue event
|
||||||
}//custom events for created / modified
|
}//custom events for created / modified
|
||||||
|
}//end of process notifications
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class UnitBiz : BizObject, ISearchAbleObject
|
internal class UnitBiz : BizObject, ISearchAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
internal UnitBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal UnitBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
{
|
{
|
||||||
@@ -49,7 +50,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,7 +84,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +133,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +163,7 @@ namespace AyaNova.Biz
|
|||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -241,12 +242,29 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//JOB / OPERATIONS
|
// NOTIFICATION PROCESSING
|
||||||
//
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<UnitBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
//Other job handlers here...
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class UnitModelBiz : BizObject, ISearchAbleObject
|
internal class UnitModelBiz : BizObject, ISearchAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
internal UnitModelBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal UnitModelBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
{
|
{
|
||||||
@@ -49,7 +50,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,7 +84,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +133,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +163,7 @@ namespace AyaNova.Biz
|
|||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -243,12 +244,29 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//JOB / OPERATIONS
|
// NOTIFICATION PROCESSING
|
||||||
//
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<UnitModelBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
//Other job handlers here...
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using EnumsNET;
|
using EnumsNET;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
@@ -8,7 +9,6 @@ using AyaNova.Models;
|
|||||||
using System;
|
using System;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
internal class UserBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject
|
internal class UserBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
dtUser retUser = new dtUser();
|
dtUser retUser = new dtUser();
|
||||||
CopyObject.Copy(newObject, retUser);
|
CopyObject.Copy(newObject, retUser);
|
||||||
return retUser;
|
return retUser;
|
||||||
@@ -220,7 +220,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,7 +322,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
|
|
||||||
|
|
||||||
return dbObject;
|
return dbObject;
|
||||||
@@ -496,7 +496,7 @@ namespace AyaNova.Biz
|
|||||||
//all good do the commit if it's ours
|
//all good do the commit if it's ours
|
||||||
if (parentTransaction == null)
|
if (parentTransaction == null)
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -891,7 +891,7 @@ namespace AyaNova.Biz
|
|||||||
await JobsBiz.LogJobAsync(job.GId, ExceptionUtil.ExtractAllExceptionMessages(ex));
|
await JobsBiz.LogJobAsync(job.GId, ExceptionUtil.ExtractAllExceptionMessages(ex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await JobsBiz.LogJobAsync(job.GId, $"LT:BatchJob {job.SubType} {idList.Count}{(FailedObjectCount > 0 ? " - LT:Failed " + FailedObjectCount : "")}");
|
await JobsBiz.LogJobAsync(job.GId, $"LT:BatchJob {job.SubType} {idList.Count}{(FailedObjectCount > 0 ? " - LT:Failed " + FailedObjectCount : "")}");
|
||||||
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Completed);
|
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Completed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -900,39 +900,65 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
case AyaType.User:
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//USER MODIFIED SPECIAL
|
// NOTIFICATION PROCESSING
|
||||||
//This one's a little different, if user has had roles changed, then pre-existing subs may not be allowed anymore
|
//
|
||||||
//Remove any notification subscriptions user doesn't have rights to:
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||||
if (((User)originalObject).Roles != ((User)newObject).Roles)
|
{
|
||||||
{
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<UserBiz>();
|
||||||
var DeleteList = new List<long>();
|
if (ServerBootConfig.SEEDING) return;
|
||||||
var NewRoles = ((User)newObject).Roles;
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
//iterate subs and remove any user shouldn't have
|
|
||||||
var userSubs = await ct.NotifySubscription.Where(z => z.UserId == newObject.Id).ToListAsync();
|
bool isNew = currentObj == null;
|
||||||
foreach (var sub in userSubs)
|
|
||||||
{
|
|
||||||
if (sub.AyaType != AyaType.NoType)
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
{
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
//check if user has rights to it or not still
|
|
||||||
//must have read rights to be valid
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
if (!AyaNova.Api.ControllerHelpers.Authorized.HasAnyRole(NewRoles, sub.AyaType))
|
if (ayaEvent == AyaEvent.Modified)
|
||||||
{
|
{
|
||||||
//no rights whatsoever, so delete it
|
//USER MODIFIED ROLES CHANGED MIGHT AFFECT ALLOWED SUBS
|
||||||
DeleteList.Add(sub.Id);
|
//This one's a little different, if user has had roles changed, then pre-existing subs may not be allowed anymore
|
||||||
}
|
//Remove any notification subscriptions user doesn't have rights to:
|
||||||
}
|
if (((User)currentObj).Roles != ((User)proposedObj).Roles)
|
||||||
}
|
{
|
||||||
if (DeleteList.Count > 0)
|
var DeleteList = new List<long>();
|
||||||
{
|
var NewRoles = ((User)proposedObj).Roles;
|
||||||
var NSB = NotifySubscriptionBiz.GetBiz(ct);
|
//iterate subs and remove any user shouldn't have
|
||||||
foreach (var l in DeleteList)
|
var userSubs = await ct.NotifySubscription.Where(z => z.UserId == proposedObj.Id).ToListAsync();
|
||||||
{
|
foreach (var sub in userSubs)
|
||||||
await NSB.DeleteAsync(l);
|
{
|
||||||
}
|
if (sub.AyaType != AyaType.NoType)
|
||||||
}
|
{
|
||||||
}
|
//check if user has rights to it or not still
|
||||||
break;
|
//must have read rights to be valid
|
||||||
|
if (!AyaNova.Api.ControllerHelpers.Authorized.HasAnyRole(NewRoles, sub.AyaType))
|
||||||
|
{
|
||||||
|
//no rights whatsoever, so delete it
|
||||||
|
DeleteList.Add(sub.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (DeleteList.Count > 0)
|
||||||
|
{
|
||||||
|
var NSB = NotifySubscriptionBiz.GetBiz(ct);
|
||||||
|
foreach (var l in DeleteList)
|
||||||
|
{
|
||||||
|
await NSB.DeleteAsync(l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
@@ -11,7 +12,7 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class VendorBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject
|
internal class VendorBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
internal VendorBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal VendorBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
{
|
{
|
||||||
@@ -54,7 +55,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +89,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +138,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,7 +167,7 @@ namespace AyaNova.Biz
|
|||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -405,6 +406,29 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// NOTIFICATION PROCESSING
|
||||||
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<VendorBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using EnumsNET;
|
using EnumsNET;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
@@ -12,7 +13,7 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class WidgetBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject
|
internal class WidgetBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,7 +92,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +141,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +175,7 @@ namespace AyaNova.Biz
|
|||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
//all good do the commit
|
//all good do the commit
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -454,6 +455,29 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// NOTIFICATION PROCESSING
|
||||||
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<WidgetBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
@@ -11,7 +12,7 @@ using System.Collections.Generic;
|
|||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
|
|
||||||
internal class WorkOrderBiz : BizObject, IJobObject, ISearchAbleObject
|
internal class WorkOrderBiz : BizObject, IJobObject, ISearchAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
//Feature specific roles
|
//Feature specific roles
|
||||||
internal static AuthorizationRoles RolesAllowedToChangeSerial = AuthorizationRoles.BizAdminFull | AuthorizationRoles.DispatchFull | AuthorizationRoles.AccountingFull;
|
internal static AuthorizationRoles RolesAllowedToChangeSerial = AuthorizationRoles.BizAdminFull | AuthorizationRoles.DispatchFull | AuthorizationRoles.AccountingFull;
|
||||||
@@ -71,7 +72,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await WorkOrderSearchIndexAsync(newObject, true);
|
await WorkOrderSearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,7 +97,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await WorkOrderSearchIndexAsync(newObject, true);
|
await WorkOrderSearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +186,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await WorkOrderSearchIndexAsync(dbObject, false);
|
await WorkOrderSearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +234,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -419,7 +420,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItem, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItem, AyaEvent.Created), ct);
|
||||||
await ItemSearchIndexAsync(newObject, true);
|
await ItemSearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -496,7 +497,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItem, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItem, AyaEvent.Modified), ct);
|
||||||
await ItemSearchIndexAsync(dbObject, false);
|
await ItemSearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -567,7 +568,7 @@ namespace AyaNova.Biz
|
|||||||
//all good do the commit if it's ours
|
//all good do the commit if it's ours
|
||||||
if (parentTransaction == null)
|
if (parentTransaction == null)
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -688,7 +689,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemExpense, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemExpense, AyaEvent.Created), ct);
|
||||||
await ExpenseSearchIndexAsync(newObject, true);
|
await ExpenseSearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -749,7 +750,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemExpense, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemExpense, AyaEvent.Modified), ct);
|
||||||
await ExpenseSearchIndexAsync(dbObject, false);
|
await ExpenseSearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -770,7 +771,7 @@ namespace AyaNova.Biz
|
|||||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemExpense, ct);
|
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemExpense, ct);
|
||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -881,7 +882,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemLabor, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemLabor, AyaEvent.Created), ct);
|
||||||
await LaborSearchIndexAsync(newObject, true);
|
await LaborSearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -942,7 +943,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemLabor, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemLabor, AyaEvent.Modified), ct);
|
||||||
await LaborSearchIndexAsync(dbObject, false);
|
await LaborSearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -963,7 +964,7 @@ namespace AyaNova.Biz
|
|||||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemLabor, ct);
|
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemLabor, ct);
|
||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1073,7 +1074,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemLoan, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemLoan, AyaEvent.Created), ct);
|
||||||
await LoanSearchIndexAsync(newObject, true);
|
await LoanSearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1134,7 +1135,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemLoan, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemLoan, AyaEvent.Modified), ct);
|
||||||
await LoanSearchIndexAsync(dbObject, false);
|
await LoanSearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1155,7 +1156,7 @@ namespace AyaNova.Biz
|
|||||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemLoan, ct);
|
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemLoan, ct);
|
||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1326,7 +1327,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemPart, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemPart, AyaEvent.Modified), ct);
|
||||||
await PartSearchIndexAsync(dbObject, false);
|
await PartSearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1347,7 +1348,7 @@ namespace AyaNova.Biz
|
|||||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemPart, ct);
|
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemPart, ct);
|
||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1455,7 +1456,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemPartRequest, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemPartRequest, AyaEvent.Created), ct);
|
||||||
await PartRequestSearchIndexAsync(newObject, true);
|
await PartRequestSearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1516,7 +1517,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemPartRequest, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemPartRequest, AyaEvent.Modified), ct);
|
||||||
await PartRequestSearchIndexAsync(dbObject, false);
|
await PartRequestSearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1537,7 +1538,7 @@ namespace AyaNova.Biz
|
|||||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemPartRequest, ct);
|
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemPartRequest, ct);
|
||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1648,7 +1649,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemScheduledUser, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemScheduledUser, AyaEvent.Created), ct);
|
||||||
await ScheduledUserSearchIndexAsync(newObject, true);
|
await ScheduledUserSearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1709,7 +1710,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemScheduledUser, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemScheduledUser, AyaEvent.Modified), ct);
|
||||||
await ScheduledUserSearchIndexAsync(dbObject, false);
|
await ScheduledUserSearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1730,7 +1731,7 @@ namespace AyaNova.Biz
|
|||||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemScheduledUser, ct);
|
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemScheduledUser, ct);
|
||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1841,7 +1842,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemTask, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemTask, AyaEvent.Created), ct);
|
||||||
await TaskSearchIndexAsync(newObject, true);
|
await TaskSearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1902,7 +1903,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemTask, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemTask, AyaEvent.Modified), ct);
|
||||||
await TaskSearchIndexAsync(dbObject, false);
|
await TaskSearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1923,7 +1924,7 @@ namespace AyaNova.Biz
|
|||||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemTask, ct);
|
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemTask, ct);
|
||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2034,7 +2035,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemTravel, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemTravel, AyaEvent.Created), ct);
|
||||||
await TravelSearchIndexAsync(newObject, true);
|
await TravelSearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2095,7 +2096,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemTravel, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemTravel, AyaEvent.Modified), ct);
|
||||||
await TravelSearchIndexAsync(dbObject, false);
|
await TravelSearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2116,7 +2117,7 @@ namespace AyaNova.Biz
|
|||||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemTravel, ct);
|
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemTravel, ct);
|
||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2227,7 +2228,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemUnit, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemUnit, AyaEvent.Created), ct);
|
||||||
await UnitSearchIndexAsync(newObject, true);
|
await UnitSearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2288,7 +2289,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemUnit, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, AyaType.WorkOrderItemUnit, AyaEvent.Modified), ct);
|
||||||
await UnitSearchIndexAsync(dbObject, false);
|
await UnitSearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2309,7 +2310,7 @@ namespace AyaNova.Biz
|
|||||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemUnit, ct);
|
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.WorkOrderItemUnit, ct);
|
||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2577,6 +2578,30 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// NOTIFICATION PROCESSING
|
||||||
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<WorkOrderBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
@@ -8,7 +9,7 @@ using AyaNova.Models;
|
|||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
|
|
||||||
internal class WorkOrderTemplateBiz : BizObject, ISearchAbleObject
|
internal class WorkOrderTemplateBiz : BizObject, ISearchAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
|
|
||||||
internal WorkOrderTemplateBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal WorkOrderTemplateBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
@@ -86,7 +87,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(outObj, true);
|
await SearchIndexAsync(outObj, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, outObj.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, outObj.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
|
|
||||||
return outObj;
|
return outObj;
|
||||||
}
|
}
|
||||||
@@ -128,7 +129,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -169,7 +170,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndexAsync(dbObject, false);
|
await SearchIndexAsync(dbObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,7 +222,7 @@ namespace AyaNova.Biz
|
|||||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct);
|
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct);
|
||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
await NotifyEventHelper.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,12 +278,27 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//JOB / OPERATIONS
|
// NOTIFICATION PROCESSING
|
||||||
//
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
|
||||||
|
{
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<WorkOrderTemplateBiz>();
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
|
||||||
//Other job handlers here...
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user