notification improvements

This commit is contained in:
Shaun Walker
2021-01-18 14:39:56 -05:00
parent fc8f200c32
commit 82a118b603
6 changed files with 122 additions and 94 deletions

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Oqtane.Models
@ -23,6 +23,50 @@ namespace Oqtane.Models
public DateTime? DeletedOn { get; set; }
public bool IsDeleted { get; set; }
public DateTime? SendOn { get; set; }
public Notification() {}
public Notification(int siteId, User from, User to, string subject, string body, int? parentId)
{
SiteId = siteId;
if (from != null)
{
FromUserId = from.UserId;
FromDisplayName = from.DisplayName;
FromEmail = from.Email;
}
if (to != null)
{
ToUserId = to.UserId;
ToDisplayName = to.DisplayName;
ToEmail = to.Email;
}
Subject = subject;
Body = body;
ParentId = parentId;
CreatedOn = DateTime.UtcNow;
IsDelivered = false;
DeliveredOn = null;
SendOn = DateTime.UtcNow;
}
public Notification(int siteId, string fromDisplayName, string fromEmail, string toDisplayName, string toEmail, string subject, string body)
{
SiteId = siteId;
FromUserId = null;
FromDisplayName = fromDisplayName;
FromEmail = fromEmail;
ToUserId = null;
ToDisplayName = toDisplayName;
ToEmail = toEmail;
Subject = subject;
Body = body;
ParentId = null;
CreatedOn = DateTime.UtcNow;
IsDelivered = false;
DeliveredOn = null;
SendOn = DateTime.UtcNow;
}
}
}