Add debug tracing, email cleanup

This commit is contained in:
2016-04-13 10:48:32 -04:00
parent 123af4f44d
commit 064b86a37b
4 changed files with 38 additions and 10 deletions
+19 -6
View File
@@ -59,13 +59,12 @@ namespace LeafWeb.Web.Services
leafInput.OutputFiles
select Tuple.Create(outputFile, new MemoryStream(outputFile.Contents))).ToList();
var body = $"Your leaf analysis job, {leafInput.Identifier}, has completed." + Environment.NewLine;
if (leafInput.OutputWarningMessage != null)
body += "The following warning message was generated."
+ Environment.NewLine + Environment.NewLine
+ leafInput.OutputWarningMessage.Contents.GetString()
+ Environment.NewLine;
var body = $"Your leaf analysis job, {leafInput.Identifier}, has completed. ";
body += FormatWarningMessage(leafInput);
body += "Please see the attached results.";
var message = new MailMessage(_emaialFromAddress, leafInput.Email, "LeafWeb results", body);
try
@@ -95,10 +94,24 @@ namespace LeafWeb.Web.Services
+ errorMessage
+ Environment.NewLine + Environment.NewLine
+ "You will need to correct your input and resubmit.";
body += FormatWarningMessage(leafInput);
var message = new MailMessage(_emaialFromAddress, leafInput.Email, "LeafWeb processing error", body);
SendMessage(message);
}
private string FormatWarningMessage(LeafInput leafInput)
{
if (leafInput.OutputWarningMessage != null)
return Environment.NewLine + Environment.NewLine
+ "The following warning message was generated."
+ Environment.NewLine + Environment.NewLine
+ leafInput.OutputWarningMessage.Contents.GetString()
+ Environment.NewLine;
return string.Empty;
}
private void SendMessage(MailMessage mailMessage)
{
try