diff --git a/MP-STATS.sln b/MP-STATS.sln index c8630043..3b5b6475 100644 --- a/MP-STATS.sln +++ b/MP-STATS.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31229.75 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP-STATS", "MP.Stats\MP.Stats.csproj", "{D9901B50-E61C-400C-B62C-FA060CF72C29}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Stats", "MP.Stats\MP.Stats.csproj", "{D9901B50-E61C-400C-B62C-FA060CF72C29}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Data", "MP.Data\MP.Data.csproj", "{10BA8450-301D-49C7-8E1E-21B7469C225C}" EndProject diff --git a/MP.Data/Controllers/MpStatsController.cs b/MP.Data/Controllers/MpStatsController.cs index 0b1d43eb..b8f59321 100644 --- a/MP.Data/Controllers/MpStatsController.cs +++ b/MP.Data/Controllers/MpStatsController.cs @@ -43,7 +43,7 @@ namespace MP.Data.Controllers /// /// /// - public bool rollBackEntity(object item) + public bool RollBackEntity(object item) { bool answ = false; try @@ -60,13 +60,33 @@ namespace MP.Data.Controllers return answ; } + /// + /// Elenco tabella controlli da filtro + /// + /// + /// + /// + public List StatControlliGetAll(int numRecord, string searchVal = "") + { + List dbResult = new List(); + + dbResult = dbCtx + .DbSetControlli + .Where(x => x.Note.Contains(searchVal) || x.IdxMacchina.Contains(searchVal) || x.CodArticolo.Contains(searchVal) || string.IsNullOrEmpty(searchVal)) + .OrderByDescending(x => x.DataOra) + .Take(numRecord) + .ToList(); + + return dbResult; + } + /// /// Elenco tabella scarti da filtro /// /// /// /// - public List ScartiGetAll(int numRecord, string searchVal = "") + public List StatScartiGetAll(int numRecord, string searchVal = "") { List dbResult = new List(); @@ -80,6 +100,26 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Elenco tabella UserLog da filtro + /// + /// + /// + /// + public List StatUserLogGetAll(int numRecord, string searchVal = "") + { + List dbResult = new List(); + + dbResult = dbCtx + .DbSetUserLog + .Where(x => x.Valore.Contains(searchVal) || x.Cognome.Contains(searchVal) || x.CodArticolo.Contains(searchVal) || string.IsNullOrEmpty(searchVal)) + .OrderByDescending(x => x.DataOraRif) + .Take(numRecord) + .ToList(); + + return dbResult; + } + #endregion Public Methods } } \ No newline at end of file diff --git a/MP.Stats/Data/MpStatsService.cs b/MP.Stats/Data/MpStatsService.cs index 5c0c2570..34b74b1a 100644 --- a/MP.Stats/Data/MpStatsService.cs +++ b/MP.Stats/Data/MpStatsService.cs @@ -59,12 +59,22 @@ namespace MP.Stats.Data public void rollBackEdit(object item) { - dbController.rollBackEntity(item); + dbController.RollBackEntity(item); } - public Task ScartiGetAll(int numRecord, string searchVal = "") + public Task StatControlliGetAll(int numRecord, string searchVal = "") { - return Task.FromResult(dbController.ScartiGetAll(numRecord, searchVal).ToArray()); + return Task.FromResult(dbController.StatControlliGetAll(numRecord, searchVal).ToArray()); + } + + public Task StatScartiGetAll(int numRecord, string searchVal = "") + { + return Task.FromResult(dbController.StatScartiGetAll(numRecord, searchVal).ToArray()); + } + + public Task StatUserLogGetAll(int numRecord, string searchVal = "") + { + return Task.FromResult(dbController.StatUserLogGetAll(numRecord, searchVal).ToArray()); } #endregion Public Methods diff --git a/MP.Stats/Pages/Controlli.razor b/MP.Stats/Pages/Controlli.razor index 0c0fb7b2..0aea2bac 100644 --- a/MP.Stats/Pages/Controlli.razor +++ b/MP.Stats/Pages/Controlli.razor @@ -6,10 +6,54 @@
Controlli
- elenco controlli + @if (currRecord != null) + { + @**@ + } + @if (ListRecords == null) + { +
+ } + else + { + + + + @**@ + + + + + + + + + + + @foreach (var record in ListRecords) + { + + @**@ + + + + + + + + + } + +
MacchinaDataODL/CommessaArticoloEsitoNoteOperatore
 @record.IdxMacchina@record.DataOra@record.IdxOdl@record.CodArticolo@record.EsitoOk@record.Note@record.MatrOpr
+ }
-
- -@code { - -} \ No newline at end of file + + \ No newline at end of file diff --git a/MP.Stats/Pages/Controlli.razor.cs b/MP.Stats/Pages/Controlli.razor.cs new file mode 100644 index 00000000..53842097 --- /dev/null +++ b/MP.Stats/Pages/Controlli.razor.cs @@ -0,0 +1,104 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.Stats.Data; +using System; +using System.Threading.Tasks; + +namespace MP.Stats.Pages +{ + public partial class Controlli : ComponentBase, IDisposable + { + #region Private Fields + + private MP.Data.DatabaseModels.ResControlli currRecord = null; + + private MP.Data.DatabaseModels.ResControlli[] ListRecords; + + #endregion Private Fields + + #region Private Properties + + private int numRecord { get; set; } = 10; + + #endregion Private Properties + + #region Protected Properties + + [Inject] + protected IJSRuntime JSRuntime { get; set; } + + [Inject] + protected MessageService MessageService { get; set; } + + [Inject] + protected NavigationManager NavManager { get; set; } + + [Inject] + protected MpStatsService StatService { get; set; } + + #endregion Protected Properties + + #region Protected Methods + + protected async Task ForceReload(int newNum) + { + numRecord = newNum; + ListRecords = await StatService.StatControlliGetAll(numRecord, MessageService.SearchVal); + } + + protected override async Task OnInitializedAsync() + { + numRecord = 10; + MessageService.ShowSearch = true; + MessageService.EA_SearchUpdated += OnSeachUpdated; + ListRecords = await StatService.StatControlliGetAll(numRecord, MessageService.SearchVal); + } + + protected void ResetData() + { + StatService.rollBackEdit(currRecord); + currRecord = null; + } + + protected async Task UpdateData() + { + currRecord = null; + ListRecords = await StatService.StatControlliGetAll(numRecord, MessageService.SearchVal); + } + + #endregion Protected Methods + + #region Public Methods + + public string checkSelect(int IdxControllo) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.IdxControllo == IdxControllo) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + public void Dispose() + { + MessageService.EA_SearchUpdated -= OnSeachUpdated; + } + + public void OnSeachUpdated() + { + InvokeAsync(() => + { + UpdateData(); + StateHasChanged(); + }); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Pages/Index.razor b/MP.Stats/Pages/Index.razor index 91a38f96..14365445 100644 --- a/MP.Stats/Pages/Index.razor +++ b/MP.Stats/Pages/Index.razor @@ -27,7 +27,7 @@
Main Topics
- + @**@ diff --git a/MP.Stats/Pages/Scarti.razor b/MP.Stats/Pages/Scarti.razor index c6503e13..513ece02 100644 --- a/MP.Stats/Pages/Scarti.razor +++ b/MP.Stats/Pages/Scarti.razor @@ -12,7 +12,7 @@ } @if (ListRecords == null) { -

Loading...

+
} else { diff --git a/MP.Stats/Pages/Scarti.razor.cs b/MP.Stats/Pages/Scarti.razor.cs index 2a8a3d36..2f95202e 100644 --- a/MP.Stats/Pages/Scarti.razor.cs +++ b/MP.Stats/Pages/Scarti.razor.cs @@ -43,7 +43,7 @@ namespace MP.Stats.Pages protected async Task ForceReload(int newNum) { numRecord = newNum; - ListRecords = await StatService.ScartiGetAll(numRecord, MessageService.SearchVal); + ListRecords = await StatService.StatScartiGetAll(numRecord, MessageService.SearchVal); } protected override async Task OnInitializedAsync() @@ -51,7 +51,7 @@ namespace MP.Stats.Pages numRecord = 10; MessageService.ShowSearch = true; MessageService.EA_SearchUpdated += OnSeachUpdated; - ListRecords = await StatService.ScartiGetAll(numRecord, MessageService.SearchVal); + ListRecords = await StatService.StatScartiGetAll(numRecord, MessageService.SearchVal); } protected void ResetData() @@ -63,7 +63,7 @@ namespace MP.Stats.Pages protected async Task UpdateData() { currRecord = null; - ListRecords = await StatService.ScartiGetAll(numRecord, MessageService.SearchVal); + ListRecords = await StatService.StatScartiGetAll(numRecord, MessageService.SearchVal); } #endregion Protected Methods @@ -100,48 +100,5 @@ namespace MP.Stats.Pages } #endregion Public Methods - -#if false - [Inject] - protected BBM_SelectData SelectData { get; set; } - - protected void CreateNew() - { - // recupero counter - string newCode = BBMService.CounterGetNext("EGW.B", 6); - DatabaseModels.BasketsModel newRecord = new DatabaseModels.BasketsModel() - { - CodBasket = newCode, - DataIns = DateTime.Now, - CustomerId = 1, - Descript = "New Basket" - }; - currBasket = newRecord; - } - - protected async Task Delete(SHERPA.BBM.DatabaseModels.BasketsModel currRecord) - { - if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voler eliminare il Basket '{currRecord.CodBasket}'?")) - return; - - BBMService.BasketsDelete(currRecord); - await UpdateData(); - } - - protected void Edit(SHERPA.BBM.DatabaseModels.BasketsModel currRecord) - { - currBasket = currRecord; - } - - protected void ShowDocs(SHERPA.BBM.DatabaseModels.BasketsModel currRecord) - { - // salvo - SelectData.BasketId = currRecord.BasketId; - SelectData.NegotiationId = 0; - // rimando... - NavManager.NavigateTo("docs"); - } - -#endif } } \ No newline at end of file diff --git a/MP.Stats/Pages/UserLog.razor b/MP.Stats/Pages/UserLog.razor new file mode 100644 index 00000000..cd9a068c --- /dev/null +++ b/MP.Stats/Pages/UserLog.razor @@ -0,0 +1,59 @@ +@page "/userlog" + +@using MP.Stats.Components +@using MP.Stats.Data + +
+
User Log
+
+ @if (currRecord != null) + { + @**@ + } + @if (ListRecords == null) + { +
+ } + else + { + + + + @**@ + + + + + + + + + + + @foreach (var record in ListRecords) + { + + @**@ + + + + + + + + + } + +
MacchinaDataODL/CommessaArticoloAzioneDescrizioneOperatore
 @record.IdxMacchina@record.DataOraRif-@record.CodArticolo@record.Azione@record.Valore@record.Cognome @record.Nome
+ } +
+ +
\ No newline at end of file diff --git a/MP.Stats/Pages/UserLog.razor.cs b/MP.Stats/Pages/UserLog.razor.cs new file mode 100644 index 00000000..a343b2dd --- /dev/null +++ b/MP.Stats/Pages/UserLog.razor.cs @@ -0,0 +1,104 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.Stats.Data; +using System; +using System.Threading.Tasks; + +namespace MP.Stats.Pages +{ + public partial class UserLog : ComponentBase, IDisposable + { + #region Private Fields + + private MP.Data.DatabaseModels.UserActionLog currRecord = null; + + private MP.Data.DatabaseModels.UserActionLog[] ListRecords; + + #endregion Private Fields + + #region Private Properties + + private int numRecord { get; set; } = 10; + + #endregion Private Properties + + #region Protected Properties + + [Inject] + protected IJSRuntime JSRuntime { get; set; } + + [Inject] + protected MessageService MessageService { get; set; } + + [Inject] + protected NavigationManager NavManager { get; set; } + + [Inject] + protected MpStatsService StatService { get; set; } + + #endregion Protected Properties + + #region Protected Methods + + protected async Task ForceReload(int newNum) + { + numRecord = newNum; + ListRecords = await StatService.StatUserLogGetAll(numRecord, MessageService.SearchVal); + } + + protected override async Task OnInitializedAsync() + { + numRecord = 10; + MessageService.ShowSearch = true; + MessageService.EA_SearchUpdated += OnSeachUpdated; + ListRecords = await StatService.StatUserLogGetAll(numRecord, MessageService.SearchVal); + } + + protected void ResetData() + { + StatService.rollBackEdit(currRecord); + currRecord = null; + } + + protected async Task UpdateData() + { + currRecord = null; + ListRecords = await StatService.StatUserLogGetAll(numRecord, MessageService.SearchVal); + } + + #endregion Protected Methods + + #region Public Methods + + public string checkSelect(int IdxLog) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.IdxLog == IdxLog) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + public void Dispose() + { + MessageService.EA_SearchUpdated -= OnSeachUpdated; + } + + public void OnSeachUpdated() + { + InvokeAsync(() => + { + UpdateData(); + StateHasChanged(); + }); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Shared/NavMenu.razor b/MP.Stats/Shared/NavMenu.razor index a2d36f59..78ef73f4 100644 --- a/MP.Stats/Shared/NavMenu.razor +++ b/MP.Stats/Shared/NavMenu.razor @@ -18,7 +18,7 @@