From 2346c67f3acd4e063dbdec14c717abdd8cf246c7 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 28 Oct 2024 16:57:52 +0100 Subject: [PATCH] Review AppUrl base x siti CORE Divisione aree Redis tra app (x TaskMan in particolare) Test apertura app --- MP-TAB3/Components/PrintMag.razor.cs | 2 +- MP-TAB3/MP-TAB3.csproj | 2 +- MP-TAB3/Program.cs | 2 +- MP-TAB3/Resources/ChangeLog.html | 2 +- MP-TAB3/Resources/VersNum.txt | 2 +- MP-TAB3/Resources/manifest.xml | 2 +- MP-TAB3/Shared/NavMenu.razor | 3 +- MP-TAB3/appsettings.Production.json | 1 - MP-TAB3/appsettings.json | 2 +- MP.Land/MP.Land.csproj | 2 +- MP.Land/Pages/RefreshData.razor | 5 +- MP.Land/Resources/ChangeLog.html | 2 +- MP.Land/Resources/VersNum.txt | 2 +- MP.Land/Resources/manifest.xml | 2 +- MP.Land/Startup.cs | 4 + MP.Land/appsettings.json | 1 + MP.Prog/MP.Prog.csproj | 2 +- MP.Prog/Pages/ForceReload.razor.cs | 11 +- MP.Prog/Resources/ChangeLog.html | 2 +- MP.Prog/Resources/VersNum.txt | 2 +- MP.Prog/Resources/manifest.xml | 2 +- MP.Prog/Startup.cs | 2 +- MP.Prog/appsettings.Production-install.json | 1 - MP.Prog/appsettings.Production-office.json | 1 - MP.Prog/appsettings.Production.json | 1 - MP.Prog/appsettings.json | 2 +- MP.Stats/MP.Stats.csproj | 4 +- MP.Stats/Pages/ForceReset.razor.cs | 19 ++- MP.Stats/Properties/launchSettings.json | 6 +- MP.Stats/Resources/ChangeLog.html | 2 +- MP.Stats/Resources/VersNum.txt | 2 +- MP.Stats/Resources/manifest.xml | 2 +- MP.Stats/Startup.cs | 3 + MP.Stats/appsettings.json | 1 + MP.Stats/wwwroot/css/site.css | 1 + MP.Stats/wwwroot/css/site.less | 1 + MP.Stats/wwwroot/css/site.min.css | 2 +- MP.TaskMan/Controllers/MpTaskController.cs | 139 ++++++++++-------- .../20241028131648_AddTaskStatus.Designer.cs | 126 ++++++++++++++++ .../20241028131648_AddTaskStatus.cs | 26 ++++ .../Migrations/TaskContextModelSnapshot.cs | 3 + MP.TaskMan/Models/TaskListModel.cs | 27 ++++ MP.TaskMan/Services/TaskService.cs | 97 ++++++------ MP.TaskMan/TaskContext.cs | 10 +- MP.TaskMan/TaskEdit.razor | 117 +++++++-------- MP.TaskMan/TaskList.razor | 13 +- MP.TaskMan/TaskList.razor.cs | 16 +- 47 files changed, 462 insertions(+), 217 deletions(-) create mode 100644 MP.TaskMan/Migrations/20241028131648_AddTaskStatus.Designer.cs create mode 100644 MP.TaskMan/Migrations/20241028131648_AddTaskStatus.cs diff --git a/MP-TAB3/Components/PrintMag.razor.cs b/MP-TAB3/Components/PrintMag.razor.cs index 897c4ccc..a7e6d9a0 100644 --- a/MP-TAB3/Components/PrintMag.razor.cs +++ b/MP-TAB3/Components/PrintMag.razor.cs @@ -59,7 +59,7 @@ namespace MP_TAB3.Components { await FixQtyUdc(); var currUrl = NavMan.Uri; - string baseUrl = config.GetValue("ServerConf:BaseUrlTab") ?? (config.GetValue("OptConf:BaseUrlTab") ?? ""); + string baseUrl = config.GetValue("SpecialConf:AppUrl") ?? (config.GetValue("OptConf:AppUrl") ?? ""); string UrlTabJumpMag = SMServ.GetConf("UrlTabJumpMag"); if (string.IsNullOrEmpty(UrlTabJumpMag)) { diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index 5884f0b9..13287006 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2410.2810 + 6.16.2410.2816 enable MP_TAB3 diff --git a/MP-TAB3/Program.cs b/MP-TAB3/Program.cs index 96d5bc17..0d4d14d3 100644 --- a/MP-TAB3/Program.cs +++ b/MP-TAB3/Program.cs @@ -56,7 +56,7 @@ logger.Info("Aggiunti services"); var app = builder.Build(); // aggiunt base URL x routing corretto -var pathBase= configuration.GetValue("ServerConf:BaseUrlTab") ?? (configuration.GetValue("OptConf:BaseUrlTab") ?? ""); +var pathBase= configuration.GetValue("SpecialConf:AppUrl") ?? (configuration.GetValue("OptConf:AppUrl") ?? ""); app.UsePathBase(pathBase); // Configure the HTTP request pipeline. diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index d16345a8..cf19cf04 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2410.2810

+

Versione: 6.16.2410.2816


Note di rilascio:
  • diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt index 20d6919c..05d65809 100644 --- a/MP-TAB3/Resources/VersNum.txt +++ b/MP-TAB3/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2410.2810 +6.16.2410.2816 diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml index 10ea38d1..d88e96ea 100644 --- a/MP-TAB3/Resources/manifest.xml +++ b/MP-TAB3/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2410.2810 + 6.16.2410.2816 https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html false diff --git a/MP-TAB3/Shared/NavMenu.razor b/MP-TAB3/Shared/NavMenu.razor index e316b253..a396220f 100644 --- a/MP-TAB3/Shared/NavMenu.razor +++ b/MP-TAB3/Shared/NavMenu.razor @@ -61,6 +61,7 @@ await MsgServ.IdxMaccSet(""); } await MsgServ.LastOpenedPageSet(tgtUrl); - navManager.NavigateTo(tgtUrl, true); + // navManager.NavigateTo(tgtUrl, true); + navManager.NavigateTo(tgtUrl, false); } } diff --git a/MP-TAB3/appsettings.Production.json b/MP-TAB3/appsettings.Production.json index 077a3fb3..e523a10d 100644 --- a/MP-TAB3/appsettings.Production.json +++ b/MP-TAB3/appsettings.Production.json @@ -22,7 +22,6 @@ "ServerConf": { "BaseAddr": "https://iis04.egalware.com/MP/TAB3/", "BasePathDisegni": "C:\\Steamware\\disegni", - "BaseUrlTab": "/MP/TAB3", "ImgBasePath": "https://iis04.egalware.com/MP/macchine/small/", "MpIoNS": "MoonPro:SQL2016DEV:MoonPro" }, diff --git a/MP-TAB3/appsettings.json b/MP-TAB3/appsettings.json index 6ff54a58..7635bd52 100644 --- a/MP-TAB3/appsettings.json +++ b/MP-TAB3/appsettings.json @@ -75,12 +75,12 @@ "ServerConf": { "BaseAddr": "https://localhost:7295/MP/TAB3/", "BasePathDisegni": "\\\\iis01\\W$\\Files\\Disegni", - "BaseUrlTab": "/MP/TAB3", "ImgBasePath": "https://iis01.egalware.com/MP/macchine/small/", "MpIoNS": "MoonPro:SQL2016DEV:MoonPro", "maxChar4Scroll": 21 }, "SpecialConf": { + "AppUrl": "/MP/TAB3", "CodApp": "MP-LAND", "CodModulo": "MP-TAB3", "CodModuloParam": "MoonPro" diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index 544dbe59..63cfeb8d 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -3,7 +3,7 @@ net6.0 MP.Land - 6.16.2410.2810 + 6.16.2410.2816 Debug;Release;Debug_LiManDebug diff --git a/MP.Land/Pages/RefreshData.razor b/MP.Land/Pages/RefreshData.razor index 60872fe4..61a744a7 100644 --- a/MP.Land/Pages/RefreshData.razor +++ b/MP.Land/Pages/RefreshData.razor @@ -2,9 +2,11 @@ @using MP.Land.Components @using MP.Land.Data +@using MP.TaskMan.Services @inject AppAuthService DataService @inject LicenseService LicServ +@inject TaskService TServ @inject NavigationManager NavManager
    @@ -21,9 +23,10 @@ LicServ.AKVList = new List(); await Task.Delay(100); await DataService.FlushRedisCache(); + await TServ.FlushCache(); await Task.Delay(200); // redireziono - NavManager.NavigateTo(""); + NavManager.NavigateTo("", true); } } diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html index 7c8405fa..01d3ee88 100644 --- a/MP.Land/Resources/ChangeLog.html +++ b/MP.Land/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo Tablet MAPO - DotNet6 -

    Versione: 6.16.2410.2810

    +

    Versione: 6.16.2410.2816


    Note di rilascio:
      diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt index 20d6919c..05d65809 100644 --- a/MP.Land/Resources/VersNum.txt +++ b/MP.Land/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2410.2810 +6.16.2410.2816 diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml index 47303698..deb91133 100644 --- a/MP.Land/Resources/manifest.xml +++ b/MP.Land/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2410.2810 + 6.16.2410.2816 https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html false diff --git a/MP.Land/Startup.cs b/MP.Land/Startup.cs index a9642742..adee6593 100644 --- a/MP.Land/Startup.cs +++ b/MP.Land/Startup.cs @@ -46,6 +46,10 @@ namespace MP.Land // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { + + // aggiunt base URL x routing corretto + app.UsePathBase(Configuration.GetValue("SpecialConf:AppUrl")); + if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); diff --git a/MP.Land/appsettings.json b/MP.Land/appsettings.json index b64a1d90..104a7f5c 100644 --- a/MP.Land/appsettings.json +++ b/MP.Land/appsettings.json @@ -73,6 +73,7 @@ "Prog.ApiUrl": "https://office.egalware.com/MP/PROG" }, "SpecialConf": { + "AppUrl": "/MP/LAND", "TaskManConn": "MP.Land", "CodApp": "MP-LAND", "CodModulo": "MP-LAND" diff --git a/MP.Prog/MP.Prog.csproj b/MP.Prog/MP.Prog.csproj index 30899208..a622a3d3 100644 --- a/MP.Prog/MP.Prog.csproj +++ b/MP.Prog/MP.Prog.csproj @@ -3,7 +3,7 @@ net6.0 MP.Prog - 6.16.2410.2812 + 6.16.2410.2816 True diff --git a/MP.Prog/Pages/ForceReload.razor.cs b/MP.Prog/Pages/ForceReload.razor.cs index 8080ccad..a1546f7e 100644 --- a/MP.Prog/Pages/ForceReload.razor.cs +++ b/MP.Prog/Pages/ForceReload.razor.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Components; using MP.Prog.Data; +using MP.TaskMan.Services; using System.Threading.Tasks; namespace MP.Prog.Pages @@ -9,10 +10,13 @@ namespace MP.Prog.Pages #region Protected Properties [Inject] - protected FileArchDataService FDService { get; set; } + protected FileArchDataService FDService { get; set; } = null!; [Inject] - protected NavigationManager NavManager { get; set; } + protected NavigationManager NavManager { get; set; } = null!; + + [Inject] + protected TaskService TServ { get; set; } = null!; #endregion Protected Properties @@ -22,12 +26,13 @@ namespace MP.Prog.Pages { await Task.Delay(10); await FDService.FlushRedisCache(); + await TServ.FlushCache(); message = "Reset done, now redirect!"; await Task.Delay(100); // passo a pagina home - NavManager.NavigateTo("Home", true); + NavManager.NavigateTo("", true); } #endregion Protected Methods diff --git a/MP.Prog/Resources/ChangeLog.html b/MP.Prog/Resources/ChangeLog.html index d4445701..cc98769a 100644 --- a/MP.Prog/Resources/ChangeLog.html +++ b/MP.Prog/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo gestione Programmi MAPO -

      Versione: 6.16.2410.2812

      +

      Versione: 6.16.2410.2816


      Note di rilascio:
        diff --git a/MP.Prog/Resources/VersNum.txt b/MP.Prog/Resources/VersNum.txt index f2bedc49..05d65809 100644 --- a/MP.Prog/Resources/VersNum.txt +++ b/MP.Prog/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2410.2812 +6.16.2410.2816 diff --git a/MP.Prog/Resources/manifest.xml b/MP.Prog/Resources/manifest.xml index 84f6e609..509ed2b1 100644 --- a/MP.Prog/Resources/manifest.xml +++ b/MP.Prog/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2410.2812 + 6.16.2410.2816 https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html false diff --git a/MP.Prog/Startup.cs b/MP.Prog/Startup.cs index cceb2675..8f941fab 100644 --- a/MP.Prog/Startup.cs +++ b/MP.Prog/Startup.cs @@ -47,7 +47,7 @@ namespace MP.Prog public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { // aggiunt base URL x routing corretto - app.UsePathBase(Configuration.GetValue("ServerConf:BaseUrl")); + app.UsePathBase(Configuration.GetValue("SpecialConf:AppUrl")); if (env.IsDevelopment() || env.IsStaging()) { diff --git a/MP.Prog/appsettings.Production-install.json b/MP.Prog/appsettings.Production-install.json index bda74775..692b78c2 100644 --- a/MP.Prog/appsettings.Production-install.json +++ b/MP.Prog/appsettings.Production-install.json @@ -13,7 +13,6 @@ "MP.Prog": "Server=localhost\\SQLEXPRESS;Database=MoonPro_PROG;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.PROG;" }, "ServerConf": { - "BaseUrl": "/MP/PROG", "FolderBasePath": "\\\\stor01", "Prog.ApiUrl": "https://localhost/MP/PROG" } diff --git a/MP.Prog/appsettings.Production-office.json b/MP.Prog/appsettings.Production-office.json index baa2796e..49ae6e93 100644 --- a/MP.Prog/appsettings.Production-office.json +++ b/MP.Prog/appsettings.Production-office.json @@ -13,7 +13,6 @@ "MP.Prog": "Server=W2019-SQL-STEAM;Database=MoonPro_PROG;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Prog;" }, "ServerConf": { - "BaseUrl": "/MP/PROG", "FolderBasePath": "\\\\stor01", "Prog.ApiUrl": "https://office.egalware.com/MP/PROG" } diff --git a/MP.Prog/appsettings.Production.json b/MP.Prog/appsettings.Production.json index bda74775..692b78c2 100644 --- a/MP.Prog/appsettings.Production.json +++ b/MP.Prog/appsettings.Production.json @@ -13,7 +13,6 @@ "MP.Prog": "Server=localhost\\SQLEXPRESS;Database=MoonPro_PROG;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.PROG;" }, "ServerConf": { - "BaseUrl": "/MP/PROG", "FolderBasePath": "\\\\stor01", "Prog.ApiUrl": "https://localhost/MP/PROG" } diff --git a/MP.Prog/appsettings.json b/MP.Prog/appsettings.json index 9a999d35..4bb09151 100644 --- a/MP.Prog/appsettings.json +++ b/MP.Prog/appsettings.json @@ -59,11 +59,11 @@ "Redis": "localhost:26379,serviceName=devel,DefaultDatabase=5,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false" }, "ServerConf": { - "BaseUrl": "/MP/PROG", "FolderBasePath": "\\\\stor01", "Prog.ApiUrl": "https://iis01.egalware.com/MP/PROG" }, "SpecialConf": { + "AppUrl": "/MP/PROG", "TaskManConn": "MP.Prog", "CodApp": "MP-PROG", "CodModulo": "MP-PROG" diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj index 5da2b4d3..f3bd404e 100644 --- a/MP.Stats/MP.Stats.csproj +++ b/MP.Stats/MP.Stats.csproj @@ -4,8 +4,8 @@ net6.0 MP.Stats 826e877c-ba70-4253-84cb-d0b1cafd4440 - 6.16.2410.2810 - 6.16.2410.2810 + 6.16.2410.2816 + 6.16.2410.2816 true $(NoWarn);1591 diff --git a/MP.Stats/Pages/ForceReset.razor.cs b/MP.Stats/Pages/ForceReset.razor.cs index 72ea3c83..68d87ad0 100644 --- a/MP.Stats/Pages/ForceReset.razor.cs +++ b/MP.Stats/Pages/ForceReset.razor.cs @@ -1,21 +1,36 @@ using Microsoft.AspNetCore.Components; using MP.Data.Services; using MP.Stats.Data; +using MP.TaskMan.Services; using System.Threading.Tasks; namespace MP.Stats.Pages { public partial class ForceReset { + #region Protected Properties + + [Inject] + protected NavigationManager NavManager { get; set; } + [Inject] protected MpStatsService StatService { get; set; } + + [Inject] + protected TaskService TServ { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + protected override async Task OnInitializedAsync() { await StatService.FlushCache(); + await TServ.FlushCache(); await Task.Delay(500); NavManager.NavigateTo("/", true); } - [Inject] - protected NavigationManager NavManager { get; set; } + + #endregion Protected Methods } } \ No newline at end of file diff --git a/MP.Stats/Properties/launchSettings.json b/MP.Stats/Properties/launchSettings.json index d8983460..e6a7ea20 100644 --- a/MP.Stats/Properties/launchSettings.json +++ b/MP.Stats/Properties/launchSettings.json @@ -22,14 +22,14 @@ "ASPNETCORE_ENVIRONMENT": "Development" }, "dotnetRunMessages": "true", - "applicationUrl": "https://localhost:5001;http://localhost:5000" + "applicationUrl": "https://localhost:5031;http://localhost:5030" }, "WSL 2": { "commandName": "WSL2", "launchBrowser": true, - "launchUrl": "https://localhost:5001", + "launchUrl": "https://localhost:5031", "environmentVariables": { - "ASPNETCORE_URLS": "https://localhost:5001;http://localhost:5000", + "ASPNETCORE_URLS": "https://localhost:5031;http://localhost:5030", "ASPNETCORE_ENVIRONMENT": "Development" }, "distributionName": "" diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html index 724026a2..a0157909 100644 --- a/MP.Stats/Resources/ChangeLog.html +++ b/MP.Stats/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo statistiche MAPO -

        Versione: 6.16.2410.2810

        +

        Versione: 6.16.2410.2816


        Note di rilascio:
          diff --git a/MP.Stats/Resources/VersNum.txt b/MP.Stats/Resources/VersNum.txt index 20d6919c..05d65809 100644 --- a/MP.Stats/Resources/VersNum.txt +++ b/MP.Stats/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2410.2810 +6.16.2410.2816 diff --git a/MP.Stats/Resources/manifest.xml b/MP.Stats/Resources/manifest.xml index 60567bd2..40d79758 100644 --- a/MP.Stats/Resources/manifest.xml +++ b/MP.Stats/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2410.2810 + 6.16.2410.2816 https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html false diff --git a/MP.Stats/Startup.cs b/MP.Stats/Startup.cs index 784cb9ee..4dec6194 100644 --- a/MP.Stats/Startup.cs +++ b/MP.Stats/Startup.cs @@ -38,6 +38,9 @@ namespace MP.Stats // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { + // aggiunt base URL x routing corretto + app.UsePathBase(Configuration.GetValue("SpecialConf:AppUrl")); + if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); diff --git a/MP.Stats/appsettings.json b/MP.Stats/appsettings.json index a77c3f43..36657826 100644 --- a/MP.Stats/appsettings.json +++ b/MP.Stats/appsettings.json @@ -57,6 +57,7 @@ }, "FormatDur": "HH:mm.ss.ff", "SpecialConf": { + "AppUrl": "/MP/STATS", "TaskManConn": "MP.Stats" }, "ServerConf": { diff --git a/MP.Stats/wwwroot/css/site.css b/MP.Stats/wwwroot/css/site.css index 35f91717..bf5d55f0 100644 --- a/MP.Stats/wwwroot/css/site.css +++ b/MP.Stats/wwwroot/css/site.css @@ -38,6 +38,7 @@ a, .validation-message { color: red; } +.textStriked, .text-strike { text-decoration: line-through; } diff --git a/MP.Stats/wwwroot/css/site.less b/MP.Stats/wwwroot/css/site.less index 85dfa9a8..bf136e22 100644 --- a/MP.Stats/wwwroot/css/site.less +++ b/MP.Stats/wwwroot/css/site.less @@ -35,6 +35,7 @@ a, .btn-link { color: red; } +.textStriked, .text-strike { text-decoration: line-through; } diff --git a/MP.Stats/wwwroot/css/site.min.css b/MP.Stats/wwwroot/css/site.min.css index 6153ebdc..5d88af4a 100644 --- a/MP.Stats/wwwroot/css/site.min.css +++ b/MP.Stats/wwwroot/css/site.min.css @@ -1 +1 @@ -@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');@import url('fonts.min.css');h1,h2,h3,h4,h5,h6,b,display-1,display-2,display-3,display-4{font-family:'Lato',sans-serif;}html,body{font-family:'Roboto Condensed',sans-serif;}a,.btn-link{color:#0366d6;}.btn-primary{color:#fff;background-color:#1b6ec2;border-color:#1861ac;}.content{padding-top:1.1rem;}.valid.modified:not([type=checkbox]){outline:1px solid #26b050;}.invalid{outline:1px solid #f00;}.validation-message{color:#f00;}.text-strike{text-decoration:line-through;}#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.shortcuts{text-align:center;}.shortcuts .shortcut-icon{font-size:2rem;}.shortcuts .shortcut{min-width:9rem;min-height:5rem;display:inline-block;padding:2rem/3 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:1rem/2;}.shortcuts .shortcut-sm{min-width:4.5rem;min-height:3rem;display:inline-block;padding:1rem/4 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:1rem/2;}.shortcuts .shortcut .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:2rem;color:#333;}.shortcuts .shortcut-sm .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:2rem;color:#333;}.shortcuts .shortcut:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0);}.shortcuts .shortcut-sm:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0);}.shortcuts .shortcut:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125);}.shortcuts .shortcut-sm:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125);}.shortcuts .shortcut:hover .shortcut-icon{color:#c93;}.shortcuts .shortcut-sm:hover .shortcut-icon{color:#666;}.shortcuts .shortcut-label{display:block;margin-top:.75em;font-weight:400;color:#666;}@media(max-width:992px){.shortcuts .shortcut{min-width:8rem;min-height:4rem;}} \ No newline at end of file +@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');@import url('fonts.min.css');h1,h2,h3,h4,h5,h6,b,display-1,display-2,display-3,display-4{font-family:'Lato',sans-serif;}html,body{font-family:'Roboto Condensed',sans-serif;}a,.btn-link{color:#0366d6;}.btn-primary{color:#fff;background-color:#1b6ec2;border-color:#1861ac;}.content{padding-top:1.1rem;}.valid.modified:not([type=checkbox]){outline:1px solid #26b050;}.invalid{outline:1px solid #f00;}.validation-message{color:#f00;}.textStriked,.text-strike{text-decoration:line-through;}#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.shortcuts{text-align:center;}.shortcuts .shortcut-icon{font-size:2rem;}.shortcuts .shortcut{min-width:9rem;min-height:5rem;display:inline-block;padding:2rem/3 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:1rem/2;}.shortcuts .shortcut-sm{min-width:4.5rem;min-height:3rem;display:inline-block;padding:1rem/4 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:1rem/2;}.shortcuts .shortcut .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:2rem;color:#333;}.shortcuts .shortcut-sm .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:2rem;color:#333;}.shortcuts .shortcut:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0);}.shortcuts .shortcut-sm:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0);}.shortcuts .shortcut:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125);}.shortcuts .shortcut-sm:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125);}.shortcuts .shortcut:hover .shortcut-icon{color:#c93;}.shortcuts .shortcut-sm:hover .shortcut-icon{color:#666;}.shortcuts .shortcut-label{display:block;margin-top:.75em;font-weight:400;color:#666;}@media(max-width:992px){.shortcuts .shortcut{min-width:8rem;min-height:4rem;}} \ No newline at end of file diff --git a/MP.TaskMan/Controllers/MpTaskController.cs b/MP.TaskMan/Controllers/MpTaskController.cs index f29ce8bc..ccc5eafc 100644 --- a/MP.TaskMan/Controllers/MpTaskController.cs +++ b/MP.TaskMan/Controllers/MpTaskController.cs @@ -11,16 +11,20 @@ using static MP.TaskMan.Objects.Enums; namespace MP.TaskMan.Controllers { - public class MpTaskController: IDisposable + public class MpTaskController : IDisposable { + #region Public Constructors + public MpTaskController(IConfiguration configuration) { _configuration = configuration; Log.Info("Avviato MpTaskController"); } - private static IConfiguration _configuration; - private static Logger Log = LogManager.GetCurrentClassLogger(); + #endregion Public Constructors + + #region Public Methods + public DateTime CalcNextExe(TaskListModel taskRec) { DateTime dtNext = DateTime.Today; @@ -77,8 +81,9 @@ namespace MP.TaskMan.Controllers { _configuration = null; } + /// - /// Chiamata esecuzione di un singolo task programmato + /// Chiamata esecuzione di un singolo task programmato, SE in stato abilitato /// /// /// Se true rischedula successiva chiamata @@ -97,7 +102,7 @@ namespace MP.TaskMan.Controllers // recupero i dati da richiamare... var currRec = dbCtx .DbSetTaskList - .Where(x => x.TaskId == TaskId) + .Where(x => x.TaskId == TaskId && x.Enabled) .FirstOrDefault(); if (currRec != null) { @@ -151,7 +156,6 @@ namespace MP.TaskMan.Controllers return callRes; } - /// /// Annulla modifiche su una specifica entity (cancel update) /// @@ -164,7 +168,7 @@ namespace MP.TaskMan.Controllers { try { - if (dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Deleted || dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Modified) + if (dbCtx.Entry(item).State == EntityState.Deleted || dbCtx.Entry(item).State == EntityState.Modified) { dbCtx.Entry(item).Reload(); } @@ -198,6 +202,58 @@ namespace MP.TaskMan.Controllers return dbResult; } + /// + /// Esegue registrazione di un Task generico (NON SQL) + /// + /// + /// Se true rischedula successiva chiamata + /// Record esecuzione task esterno + /// + public TaskResultModel TaskExecSaveExecuted(int TaskId, bool SchedNext, TaskExecModel ResRec) + { + TaskResultModel callRes = new TaskResultModel(); + using (var dbCtx = new TaskContext(_configuration)) + { + try + { + // recupero i dati da richiamare... + var currRec = dbCtx + .DbSetTaskList + .Where(x => x.TaskId == TaskId) + .FirstOrDefault(); + if (currRec != null) + { + // registro task ricevuto + dbCtx + .DbSetTaskExe + .Add(ResRec); + + // aggiorno record chiamata... + currRec.DtLastExec = ResRec.DtStart; + currRec.LastResult = ResRec.Result; + currRec.LastIsError = ResRec.IsError; + currRec.LastDuration = ResRec.DtEnd.Subtract(ResRec.DtStart).TotalSeconds; + // solo se richiesto rischedulazione ricalcola chiamata + if (SchedNext) + { + // calcolo prossima esecuzione... + currRec.DtNextExec = CalcNextExe(currRec); + } + // segno modificato + dbCtx.Entry(currRec).State = EntityState.Modified; + + // salvo modifiche! + dbCtx.SaveChanges(); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione in TaskExecSaveExecuted{Environment.NewLine}{exc}"); + } + } + return callRes; + } + /// /// Upsert record TaskExec /// @@ -259,58 +315,6 @@ namespace MP.TaskMan.Controllers return dbResult; } - - /// - /// Esegue registrazione di un Task generico (NON SQL) - /// - /// - /// Se true rischedula successiva chiamata - /// Record esecuzione task esterno - /// - public TaskResultModel TaskExecSaveExecuted(int TaskId, bool SchedNext, TaskExecModel ResRec) - { - TaskResultModel callRes = new TaskResultModel(); - using (var dbCtx = new TaskContext(_configuration)) - { - try - { - // recupero i dati da richiamare... - var currRec = dbCtx - .DbSetTaskList - .Where(x => x.TaskId == TaskId) - .FirstOrDefault(); - if (currRec != null) - { - // registro task ricevuto - dbCtx - .DbSetTaskExe - .Add(ResRec); - - // aggiorno record chiamata... - currRec.DtLastExec = ResRec.DtStart; - currRec.LastResult = ResRec.Result; - currRec.LastIsError = ResRec.IsError; - currRec.LastDuration = ResRec.DtEnd.Subtract(ResRec.DtStart).TotalSeconds; - // solo se richiesto rischedulazione ricalcola chiamata - if (SchedNext) - { - // calcolo prossima esecuzione... - currRec.DtNextExec = CalcNextExe(currRec); - } - // segno modificato - dbCtx.Entry(currRec).State = EntityState.Modified; - - // salvo modifiche! - dbCtx.SaveChanges(); - } - } - catch (Exception exc) - { - Log.Error($"Eccezione in TaskExecSaveExecuted{Environment.NewLine}{exc}"); - } - } - return callRes; - } /// /// Update ordinamento task /// @@ -388,6 +392,7 @@ namespace MP.TaskMan.Controllers if (currData != null) { currData.Ordinal = rec2upd.Ordinal; + currData.Enabled = rec2upd.Enabled; currData.Name = rec2upd.Name; currData.Descript = rec2upd.Descript; currData.Command = rec2upd.Command; @@ -416,5 +421,19 @@ namespace MP.TaskMan.Controllers } return done; } + + #endregion Public Methods + + #region Private Fields + + private static Logger Log = LogManager.GetCurrentClassLogger(); + + #endregion Private Fields + + #region Private Properties + + private static IConfiguration _configuration { get; set; } = null!; + + #endregion Private Properties } -} +} \ No newline at end of file diff --git a/MP.TaskMan/Migrations/20241028131648_AddTaskStatus.Designer.cs b/MP.TaskMan/Migrations/20241028131648_AddTaskStatus.Designer.cs new file mode 100644 index 00000000..7cbd0294 --- /dev/null +++ b/MP.TaskMan/Migrations/20241028131648_AddTaskStatus.Designer.cs @@ -0,0 +1,126 @@ +// +using System; +using MP.TaskMan; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace MP.TaskMan.Migrations +{ + [DbContext(typeof(TaskContext))] + [Migration("20241028131648_AddTaskStatus")] + partial class AddTaskStatus + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseCollation("SQL_Latin1_General_CP1_CI_AS") + .HasAnnotation("ProductVersion", "6.0.33") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("MP.TaskMan.Models.TaskExecModel", b => + { + b.Property("TaskExecId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("TaskExecId"), 1L, 1); + + b.Property("DtEnd") + .HasColumnType("datetime2"); + + b.Property("DtStart") + .HasColumnType("datetime2"); + + b.Property("IsError") + .HasColumnType("bit"); + + b.Property("Result") + .HasColumnType("nvarchar(max)"); + + b.Property("TaskId") + .HasColumnType("int"); + + b.HasKey("TaskExecId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskExec"); + }); + + modelBuilder.Entity("MP.TaskMan.Models.TaskListModel", b => + { + b.Property("TaskId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("TaskId"), 1L, 1); + + b.Property("Args") + .HasColumnType("nvarchar(max)"); + + b.Property("Cad") + .HasColumnType("int"); + + b.Property("Command") + .HasColumnType("nvarchar(max)"); + + b.Property("Descript") + .HasColumnType("nvarchar(max)"); + + b.Property("DtLastExec") + .HasColumnType("datetime2"); + + b.Property("DtNextExec") + .HasColumnType("datetime2"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("Freq") + .HasColumnType("int"); + + b.Property("LastDuration") + .HasColumnType("float"); + + b.Property("LastIsError") + .HasColumnType("bit"); + + b.Property("LastResult") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Ordinal") + .HasColumnType("int"); + + b.Property("TType") + .HasColumnType("int"); + + b.HasKey("TaskId"); + + b.ToTable("TaskList"); + }); + + modelBuilder.Entity("MP.TaskMan.Models.TaskExecModel", b => + { + b.HasOne("MP.TaskMan.Models.TaskListModel", "TaskListNav") + .WithMany() + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TaskListNav"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/MP.TaskMan/Migrations/20241028131648_AddTaskStatus.cs b/MP.TaskMan/Migrations/20241028131648_AddTaskStatus.cs new file mode 100644 index 00000000..aa1b75df --- /dev/null +++ b/MP.TaskMan/Migrations/20241028131648_AddTaskStatus.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace MP.TaskMan.Migrations +{ + public partial class AddTaskStatus : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Enabled", + table: "TaskList", + type: "bit", + nullable: false, + defaultValue: false); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Enabled", + table: "TaskList"); + } + } +} diff --git a/MP.TaskMan/Migrations/TaskContextModelSnapshot.cs b/MP.TaskMan/Migrations/TaskContextModelSnapshot.cs index 400856cb..e56f525d 100644 --- a/MP.TaskMan/Migrations/TaskContextModelSnapshot.cs +++ b/MP.TaskMan/Migrations/TaskContextModelSnapshot.cs @@ -79,6 +79,9 @@ namespace MP.TaskMan.Migrations b.Property("DtNextExec") .HasColumnType("datetime2"); + b.Property("Enabled") + .HasColumnType("bit"); + b.Property("Freq") .HasColumnType("int"); diff --git a/MP.TaskMan/Models/TaskListModel.cs b/MP.TaskMan/Models/TaskListModel.cs index 950ef5ad..25303571 100644 --- a/MP.TaskMan/Models/TaskListModel.cs +++ b/MP.TaskMan/Models/TaskListModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Drawing.Printing; using static MP.TaskMan.Objects.Enums; #nullable disable @@ -23,6 +24,11 @@ namespace MP.TaskMan.Models /// public int Ordinal { get; set; } = 0; + /// + /// Stato Task abilitato / disabilitato + /// + public bool Enabled { get; set; } = false; + /// /// Nome Task /// @@ -83,5 +89,26 @@ namespace MP.TaskMan.Models public string LastResult { get; set; } = ""; #endregion Public Properties + + /// + /// Equals solo su chiave! + /// + /// + /// + public override bool Equals(object obj) + { + if (!(obj is TaskListModel item)) + return false; + + if (TaskId != item.TaskId) + return false; + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } } } \ No newline at end of file diff --git a/MP.TaskMan/Services/TaskService.cs b/MP.TaskMan/Services/TaskService.cs index 00aaa8e7..ca9d42e9 100644 --- a/MP.TaskMan/Services/TaskService.cs +++ b/MP.TaskMan/Services/TaskService.cs @@ -61,6 +61,7 @@ namespace MP.TaskMan.Services // sistemo DataSource = connStrParams["Server"]; DataBase = connStrParams["Database"]; + RedisBaseKey= $"MP:TaskMan:{DataSource}:{DataBase}"; } // conf rest call service @@ -101,46 +102,50 @@ namespace MP.TaskMan.Services { Task = $"TaskId: {TaskRec.TaskId} | {TaskRec.TType}", ExecResult = -1, - TextResult = "Task Not recognized" + TextResult = TaskRec.Enabled ? "Task Not Recognized" : "Task Not Enabled for Execution" }; - // verifico tipo di task ed eseguo di conseguenza... - switch (TaskRec.TType) + // in primis verifica che SIA abilitato... + if (TaskRec.Enabled) { - //case Task2ExeType.ND: - // break; - //case Task2ExeType.Exe: - // break; - //case Task2ExeType.SqlCommand: - // break; - case Task2ExeType.SqlStored: - answ = MLController.ExecuteSqlTask(TaskRec.TaskId, SchedNext); - break; - case Task2ExeType.RestCallGet: - DateTime dtStart = DateTime.Now; - // in primis testo la chiamata al servizio Health - string rAnsw = await RCallService.CheckServer(); - // se ok effettuo vera chiamata... - if (rAnsw.ToUpper() == "OK") - { - var callResp = await RCallService.CallRestGet(TaskRec.Command, TaskRec.Args); - DateTime dtEnd = DateTime.Now; - TaskExecModel tExeMod = new TaskExecModel() + // verifico tipo di task ed eseguo di conseguenza... + switch (TaskRec.TType) + { + //case Task2ExeType.ND: + // break; + //case Task2ExeType.Exe: + // break; + //case Task2ExeType.SqlCommand: + // break; + case Task2ExeType.SqlStored: + answ = MLController.ExecuteSqlTask(TaskRec.TaskId, SchedNext); + break; + case Task2ExeType.RestCallGet: + DateTime dtStart = DateTime.Now; + // in primis testo la chiamata al servizio Health + string rAnsw = await RCallService.CheckServer(); + // se ok effettuo vera chiamata... + if (rAnsw.ToUpper() == "OK") { - DtEnd = dtEnd, - DtStart = dtStart, - IsError = callResp.StatusCode != System.Net.HttpStatusCode.OK, - TaskId = TaskRec.TaskId, - Result = $"{callResp.Content}".Replace("\"", ""), - }; - // salvo su DB - answ = MLController.TaskExecSaveExecuted(TaskRec.TaskId, SchedNext, tExeMod); - } - break; - default: - break; + var callResp = await RCallService.CallRestGet(TaskRec.Command, TaskRec.Args); + DateTime dtEnd = DateTime.Now; + TaskExecModel tExeMod = new TaskExecModel() + { + DtEnd = dtEnd, + DtStart = dtStart, + IsError = callResp.StatusCode != System.Net.HttpStatusCode.OK, + TaskId = TaskRec.TaskId, + Result = $"{callResp.Content}".Replace("\"", ""), + }; + // salvo su DB + answ = MLController.TaskExecSaveExecuted(TaskRec.TaskId, SchedNext, tExeMod); + } + break; + default: + break; + } + // svuoto cache! + await FlushCache(); } - // svuoto cache! - await FlushCache("Task"); return answ; } @@ -150,18 +155,18 @@ namespace MP.TaskMan.Services /// public async Task FlushCache() { - RedisValue pattern = new RedisValue($"{redisBaseKey}:*"); + RedisValue pattern = new RedisValue($"{RedisBaseKey}:*"); bool answ = await ExecFlushRedisPattern(pattern); return answ; } /// - /// Pulizia cache Redis per chiave specifica (da redisBaseKey...) + /// Pulizia cache Redis per chiave specifica (da RedisBaseKey...) /// /// public async Task FlushCache(string KeyReq) { - RedisValue pattern = new RedisValue($"{redisBaseKey}:{KeyReq}:*"); + RedisValue pattern = new RedisValue($"{RedisBaseKey}:{KeyReq}:*"); bool answ = await ExecFlushRedisPattern(pattern); return answ; } @@ -199,7 +204,7 @@ namespace MP.TaskMan.Services List result = new List(); // cerco in redis... DateTime adesso = DateTime.Now; - string currKey = $"{redisBaseKey}:Task:ExecList:{TaskId}:{adesso:yyMMdd}:{adesso:HHmm}:{maxRec}"; + string currKey = $"{RedisBaseKey}:Task:ExecList:{TaskId}:{adesso:yyMMdd}:{adesso:HHmm}:{maxRec}"; RedisValue rawData = await redisDb.StringGetAsync(currKey); if (rawData.HasValue) { @@ -237,7 +242,7 @@ namespace MP.TaskMan.Services List result = new List(); // cerco in redis... DateTime adesso = DateTime.Now; - string currKey = $"{redisBaseKey}:Task:List:{TType}"; + string currKey = $"{RedisBaseKey}:Task:List:{TType}"; RedisValue rawData = await redisDb.StringGetAsync(currKey); if (rawData.HasValue) { @@ -277,7 +282,7 @@ namespace MP.TaskMan.Services { bool dbResult = MLController.TaskListMove(rec2upd, moveUp); // svuoto cache! - await FlushCache("Task"); + await FlushCache(); return await Task.FromResult(dbResult); } @@ -290,7 +295,7 @@ namespace MP.TaskMan.Services { bool dbResult = MLController.TaskListUpsert(rec2upd); // svuoto cache! - await FlushCache("Task"); + await FlushCache(); return dbResult; } @@ -320,11 +325,11 @@ namespace MP.TaskMan.Services private Dictionary connStrParams = new Dictionary(); - private string DataBase = ""; + private string DataBase { get; set; } = ""; - private string DataSource = ""; + private string DataSource { get; set; } = ""; - private string redisBaseKey = "MP:TASK"; + private string RedisBaseKey { get; set; } = "MP:TASK"; #endregion Private Fields diff --git a/MP.TaskMan/TaskContext.cs b/MP.TaskMan/TaskContext.cs index 8ca738a2..122d1483 100644 --- a/MP.TaskMan/TaskContext.cs +++ b/MP.TaskMan/TaskContext.cs @@ -95,11 +95,19 @@ namespace MP.TaskMan #region Protected Methods + /// + /// Stringa di connessione impiegata + /// + private string connString { get; set; } = ""; + + /// + /// Ovewrride setup gestione stringa di connessione + /// + /// protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) { - string connString = ""; if (DesignTime) { connString = "Server=SQL2016DEV; Database=MoonPro_PROG; Trusted_Connection=True;"; diff --git a/MP.TaskMan/TaskEdit.razor b/MP.TaskMan/TaskEdit.razor index 566a5e22..59bd3a17 100644 --- a/MP.TaskMan/TaskEdit.razor +++ b/MP.TaskMan/TaskEdit.razor @@ -2,12 +2,61 @@ {
          +
          +
          + + +
          +
          +
          +
          +
          +
          + +
          +
          + +
          +
          +
          +
          + + +
          +
          +
          +
          + + +
          +
          +
          +
          + + +
          +
          +
          +
          + + +
          +
          +
          +
          - -
          -
          - @*
          -
          - - -
          -
          -
          -
          - - -
          -
          *@ -
          -
          -
          +
          -
          -
          -
          -
          - - -
          -
          -
          -
          - - -
          -
          -
          -
          - - -
          -
          -
          -
          - - -
          -
          -
          +
          +
          + + +
          } diff --git a/MP.TaskMan/TaskList.razor b/MP.TaskMan/TaskList.razor index 46aa46cd..6d44d575 100644 --- a/MP.TaskMan/TaskList.razor +++ b/MP.TaskMan/TaskList.razor @@ -82,7 +82,7 @@ @foreach (var record in ListRecords) { - + @if (detRecord == null) @@ -110,7 +110,7 @@ } } - @record.Ordinal + @record.Ordinal @if (detRecord == null) { @if (record.Ordinal == maxOrdinal) @@ -148,11 +148,18 @@
          @($"{record.DtNextExec:yyyy-MM-dd}")
          @($"{record.DtNextExec:ddd HH:mm:ss}")
          - + @($"{record.LastDuration:N3}") sec + @if(record.Enabled) + { + } + else + { + + } } diff --git a/MP.TaskMan/TaskList.razor.cs b/MP.TaskMan/TaskList.razor.cs index 5dda83fa..eaf54675 100644 --- a/MP.TaskMan/TaskList.razor.cs +++ b/MP.TaskMan/TaskList.razor.cs @@ -10,21 +10,21 @@ namespace MP.TaskMan { #region Public Methods - public string checkSelect(int TaskId) + public string checkSelect(TaskListModel selRec) { string answ = ""; if (currRecord != null) { - try - { - answ = (currRecord.TaskId == TaskId) ? "table-info" : ""; - } - catch - { } + answ = (currRecord.Equals(selRec)) ? "table-info" : ""; } else if (detRecord != null) { - answ = (detRecord.TaskId == TaskId) ? "table-info" : ""; + answ = detRecord.Equals(selRec) ? "table-info" : ""; + } + // verifico se sia disabilitato... + if(!selRec.Enabled) + { + answ += " text-secondary textStriked"; } return answ; }