Leaf Input and Submit
This commit is contained in:
@@ -13,7 +13,7 @@ namespace LeafWeb.WebCms.Services
|
||||
{
|
||||
public class EmailNotificationService : IDisposable
|
||||
{
|
||||
private static readonly ILog Logger = LogManager.GetLogger(typeof(EmailNotificationService));
|
||||
private static readonly ILog Logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private readonly string _emailFromAddress;
|
||||
|
||||
@@ -78,7 +78,9 @@ namespace LeafWeb.WebCms.Services
|
||||
|
||||
body += FormatWarningMessage(leafInput);
|
||||
|
||||
if (true)
|
||||
var downloadLink = true;
|
||||
|
||||
if (downloadLink)
|
||||
{
|
||||
var downloadUrl = _downloadUrlService.GetDownloadUrl(leafInput);
|
||||
|
||||
@@ -160,7 +162,7 @@ namespace LeafWeb.WebCms.Services
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger.Debug("Email sending to " + mailMessage.To + ", subject: " + mailMessage.Subject);
|
||||
Logger.Info($"Email sending to {mailMessage.To}, subject: {mailMessage.Subject}");
|
||||
_smtpClient.Send(mailMessage);
|
||||
}
|
||||
catch (SmtpException ex)
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace LeafWeb.WebCms.Services.PiscalQueue
|
||||
{
|
||||
DataService = dataService;
|
||||
PiscalService = piscalService;
|
||||
Logger = LogManager.GetLogger(GetType().Name);
|
||||
Logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
_retryPolicy =
|
||||
Policy
|
||||
@@ -60,7 +60,16 @@ namespace LeafWeb.WebCms.Services.PiscalQueue
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void PiscalWarningHandler(string warningMessage, LeafInput leafInput)
|
||||
{
|
||||
Logger.Warn(warningMessage);
|
||||
|
||||
// send admin an email
|
||||
BackgroundJobEnqueueRetry<EmailNotificationService>(
|
||||
email => email.SendAdministratorMessage($"LeafWeb: PiscalQueue {GetType().Name} Warning", warningMessage));
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
DataService.Dispose();
|
||||
|
||||
@@ -107,7 +107,8 @@ namespace LeafWeb.WebCms.Services.PiscalQueue
|
||||
{
|
||||
case PiscalStatus.NotStarted:
|
||||
// if it's not started - this is unusual state
|
||||
Logger.WarnFormat("LeafInput: {0}, Piscal Not Started", leafInput.Id);
|
||||
PiscalWarningHandler($"LeafInput: {leafInput.Id}, Piscal reporting Not Started, setting to pending to retry", leafInput);
|
||||
DataService.SetLeafInputStatus(leafInput, LeafInputStatusType.Pending);
|
||||
break;
|
||||
|
||||
case PiscalStatus.Running:
|
||||
|
||||
Reference in New Issue
Block a user