From 8225ff63a2281565d17d137a51ea2faa511e4aca Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 12 Oct 2023 12:31:35 +0200 Subject: [PATCH] Fix invioemail allarme da conf --- MP-TAB-SERV/Components/AlarmsMan.razor.cs | 25 +++++++++++++++++------ MP-TAB-SERV/MP-TAB-SERV.csproj | 2 +- MP-TAB-SERV/Resources/ChangeLog.html | 2 +- MP-TAB-SERV/Resources/VersNum.txt | 2 +- MP-TAB-SERV/Resources/manifest.xml | 2 +- MP-TAB-SERV/appsettings.json | 1 + 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/MP-TAB-SERV/Components/AlarmsMan.razor.cs b/MP-TAB-SERV/Components/AlarmsMan.razor.cs index 63e67d7b..fe242239 100644 --- a/MP-TAB-SERV/Components/AlarmsMan.razor.cs +++ b/MP-TAB-SERV/Components/AlarmsMan.razor.cs @@ -47,13 +47,17 @@ namespace MP_TAB_SERV.Components protected bool isSending = false; protected int NumRecPage = 10; protected int PageNum = 1; - protected int TotalCount = 0; #endregion Protected Fields #region Protected Properties + protected List AlarmsDest { get; set; } = new List(); + + [Inject] + protected IConfiguration config { get; set; } = null!; + [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; @@ -96,6 +100,15 @@ namespace MP_TAB_SERV.Components CurrPeriodo = new Periodo(PeriodSet.LastWeek); await doUpdate(); } + var rawDest = config.GetValue("AlarmDest"); + if (!string.IsNullOrEmpty(rawDest)) + { + AlarmsDest = rawDest.Split(",").ToList(); + } + else + { + AlarmsDest = new List() { "samuele@steamware.net" }; + } } protected void SaveNumRec(int newNum) @@ -118,8 +131,8 @@ namespace MP_TAB_SERV.Components isSending = true; await Task.Delay(1); await InvokeAsync(StateHasChanged); - List dest = new List(); - dest.Add("samuele@steamware.net"); + //List dest = new List(); + //dest.Add("samuele@steamware.net"); string oggetto = $"Notifica allarme impianto {currAlarm.MachineId}"; StringBuilder sb = new StringBuilder(); sb.AppendLine("Attenzione: allarme presente per un periodo superiore alla soglia di controllo."); @@ -131,7 +144,7 @@ namespace MP_TAB_SERV.Components string corpo = sb.ToString().Replace($"{Environment.NewLine}", "
"); MailKitMailData mData = new MailKitMailData() { - To = dest, + To = AlarmsDest, Subject = oggetto, Body = corpo }; @@ -140,11 +153,11 @@ namespace MP_TAB_SERV.Components { // salvo invio Notifica allarme TabDServ.AlarmLogSetNotify(currAlarm.AlarmLogId, DateTime.Now); - Log.Info($"Notifica allarme {currAlarm.AlarmLogId} inviato a {string.Join(",", dest)}"); + Log.Info($"Notifica allarme {currAlarm.AlarmLogId} inviato a {string.Join(",", AlarmsDest)}"); } else { - Log.Error($"Errore in invio email allarmi attivi per {currAlarm.AlarmLogId}"); + Log.Error($"Errore in invio email allarmi attivi per {currAlarm.AlarmLogId} | tentato invio a {string.Join(",", AlarmsDest)}"); } isSending = false; await Task.Delay(1); diff --git a/MP-TAB-SERV/MP-TAB-SERV.csproj b/MP-TAB-SERV/MP-TAB-SERV.csproj index ae85f99c..90468e23 100644 --- a/MP-TAB-SERV/MP-TAB-SERV.csproj +++ b/MP-TAB-SERV/MP-TAB-SERV.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2310.1211 + 6.16.2310.1212 enable MP_TAB_SERV diff --git a/MP-TAB-SERV/Resources/ChangeLog.html b/MP-TAB-SERV/Resources/ChangeLog.html index e861a692..866ca7e8 100644 --- a/MP-TAB-SERV/Resources/ChangeLog.html +++ b/MP-TAB-SERV/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2310.1211

+

Versione: 6.16.2310.1212


Note di rilascio:
  • diff --git a/MP-TAB-SERV/Resources/VersNum.txt b/MP-TAB-SERV/Resources/VersNum.txt index b4c85468..e15728ba 100644 --- a/MP-TAB-SERV/Resources/VersNum.txt +++ b/MP-TAB-SERV/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2310.1211 +6.16.2310.1212 diff --git a/MP-TAB-SERV/Resources/manifest.xml b/MP-TAB-SERV/Resources/manifest.xml index 7b340c07..a999b583 100644 --- a/MP-TAB-SERV/Resources/manifest.xml +++ b/MP-TAB-SERV/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2310.1211 + 6.16.2310.1212 https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html false diff --git a/MP-TAB-SERV/appsettings.json b/MP-TAB-SERV/appsettings.json index 56779bcd..0ac4ed8f 100644 --- a/MP-TAB-SERV/appsettings.json +++ b/MP-TAB-SERV/appsettings.json @@ -23,6 +23,7 @@ "ImgBasePath": "C:\\Steamware\\macchine", "CodModulo": "MoonPro" }, + "AlarmDest": "samuele.locatelli@egalware.com, ceo@steamware.net", "MailKitMailSettings": { "DisplayName": "MAPO EgalWare Email BOT", "From": "steamwarebot@outlook.it",