This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -53,7 +53,7 @@
|
||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
||||
"AYANOVA_SERVER_TEST_MODE": "true",
|
||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
||||
|
||||
@@ -298,6 +298,10 @@ namespace AyaNova.Biz
|
||||
//
|
||||
|
||||
internal static async Task AddGeneralNotifyEvent(NotifyEventType eventType, string message, string name, Exception except = null, long userId = 0)
|
||||
{
|
||||
await AddGeneralNotifyEvent(AyaType.NoType, 0, eventType, message, name, except, userId);
|
||||
}
|
||||
internal static async Task AddGeneralNotifyEvent(AyaType atype, long objectid, NotifyEventType eventType, string message, string name, Exception except = null, long userId = 0)
|
||||
{
|
||||
|
||||
//This handles general notification events not requiring a decision or tied to an object that are basically just a immediate message to the user
|
||||
@@ -350,7 +354,7 @@ namespace AyaNova.Biz
|
||||
var gensubs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.GeneralNotification && z.UserId == userId).ToListAsync();
|
||||
foreach (var sub in gensubs)
|
||||
{
|
||||
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = userId, Message = message, NotifySubscriptionId = sub.Id, Name = name };
|
||||
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = userId, Message = message, NotifySubscriptionId = sub.Id, Name = name, AyaType = atype, ObjectId = objectid };
|
||||
await ct.NotifyEvent.AddAsync(n);
|
||||
}
|
||||
if (gensubs.Count > 0)
|
||||
@@ -371,7 +375,7 @@ namespace AyaNova.Biz
|
||||
//not for inactive users
|
||||
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
||||
//note flag ~SERVER~ means to client to substitute "Server" translation key text instead
|
||||
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = sub.UserId, Message = message, NotifySubscriptionId = sub.Id, Name = "~SERVER~" };
|
||||
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = sub.UserId, Message = message, NotifySubscriptionId = sub.Id, Name = "~SERVER~", AyaType = atype, ObjectId = objectid };
|
||||
await ct.NotifyEvent.AddAsync(n);
|
||||
}
|
||||
if (subs.Count > 0)
|
||||
|
||||
@@ -4802,7 +4802,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
throw new Exception("TEST EXCEPTION IN PM GENERATION");
|
||||
//make new workorder
|
||||
if (await NewServiceWorkOrderFromPMAsync(p, ct, log))
|
||||
{
|
||||
@@ -4888,7 +4888,7 @@ namespace AyaNova.Biz
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.LogError(ex, $"PMBiz::GenerateAsync error updating PM after generation {p.Serial}");
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(NotifyEventType.PMGenerationFailed, $"Error updating PM after generation {p.Serial}", "Preventive Maintenance", ex);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error updating PM after generation {p.Serial}", "Preventive Maintenance", ex);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -4897,7 +4897,7 @@ namespace AyaNova.Biz
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.LogError(ex, $"PMBiz::GenerateAsync error generating Work order from PM {p.Serial}");
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(NotifyEventType.PMGenerationFailed, $"Error generating Work order from PM {p.Serial}", "Preventive Maintenance", ex);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating Work order from PM {p.Serial}", "Preventive Maintenance", ex);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -5159,7 +5159,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
var err = $"PMBiz::NewServiceWorkOrderFromPMAsync error creating from PM {p.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||
log.LogError(err);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(NotifyEventType.PMGenerationFailed, $"Error generating Work order from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating Work order from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
return false;
|
||||
}
|
||||
#if (DEBUG)
|
||||
|
||||
Reference in New Issue
Block a user