This commit is contained in:
2021-06-14 19:42:05 +00:00
parent c8ff1099a9
commit b5135c0a1a
4 changed files with 25 additions and 5 deletions

View File

@@ -120,7 +120,19 @@ namespace AyaNova.Biz
private static async Task DeliverInApp(NotifyEvent ne, TimeSpan ageValue, AyContext ct)
{
log.LogTrace($"DeliverInApp notify event: {ne}");
await ct.Notification.AddAsync(new Notification() { UserId = ne.UserId, AyaType = ne.AyaType, ObjectId = ne.ObjectId, EventType = ne.EventType, NotifySubscriptionId = ne.NotifySubscriptionId, Message = ne.Message, Name = ne.Name, AgeValue = ageValue });
await ct.Notification.AddAsync(
new Notification()
{
UserId = ne.UserId,
AyaType = ne.AyaType,
ObjectId = ne.ObjectId,
EventType = ne.EventType,
NotifySubscriptionId = ne.NotifySubscriptionId,
Message = ne.Message,
Name = ne.Name,
AgeValue = ageValue,
DecValue = ne.DecValue
});
await ct.SaveChangesAsync();
ct.NotifyEvent.Remove(ne);
await ct.SaveChangesAsync();
@@ -182,6 +194,12 @@ namespace AyaNova.Biz
if (ageValue != TimeSpan.Zero)
AgeDisplay = $"({AyaNova.Util.DateUtil.FormatTimeSpan(ageValue, LT["TimeSpanDays"], LT["TimeSpanHours"], LT["TimeSpanMinutes"], LT["TimeSpanSeconds"])})\n";
//DecValue (only for TheAndy for now workorder exceedsthreshold so not putting a lot of localization effort in; in app will localize properly)
string DecDisplay= "";
if(ne.DecValue!=0)
DecDisplay=ne.DecValue.ToString("N2", System.Globalization.CultureInfo.InvariantCulture);
string subject = "";
@@ -200,7 +218,7 @@ namespace AyaNova.Biz
subject = $"AY:{AyaTypeTranslated}:{name}:{SubscriptionTypeName}";
if (ne.ObjectId != 0 || ne.EventType == NotifyEventType.BackupStatus)
{
body = $"{AgeDisplay}{AyaTypeTranslated}\n{OpenObjectUrlBuilder(ne.AyaType, ne.ObjectId, ne.EventType)}\n";
body = $"{AgeDisplay}{DecDisplay}{AyaTypeTranslated}\n{OpenObjectUrlBuilder(ne.AyaType, ne.ObjectId, ne.EventType)}\n";
}
body += ne.Message;
break;