Merge branch 'feature/ExtendCache' into develop
This commit is contained in:
@@ -135,15 +135,27 @@ namespace MP.Data.Controllers
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.DdbTurni> StatDdbGetAll(int numRecord, string searchVal = "")
|
||||
public List<DatabaseModels.DdbTurni> StatDdbGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<DatabaseModels.DdbTurni> dbResult = new List<DatabaseModels.DdbTurni>();
|
||||
|
||||
//dbResult = dbCtx
|
||||
// .
|
||||
// .Where(x => x.Descrizione.Contains(searchVal) || x.IdxMacchina.Contains(searchVal) || x.CodArticolo.Contains(searchVal) || x.KeyRichiesta.Contains(searchVal) || string.IsNullOrEmpty(searchVal))
|
||||
// .OrderByDescending(x => x.InizioStato)
|
||||
// .Take(numRecord)
|
||||
// .ToList();
|
||||
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
var idxODL = new SqlParameter("@IdxODL", IdxODL);
|
||||
var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
|
||||
var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetDdbTurni
|
||||
.Where(x => x.Descrizione.Contains(searchVal) || x.IdxMacchina.Contains(searchVal) || x.CodArticolo.Contains(searchVal) || x.KeyRichiesta.Contains(searchVal) || string.IsNullOrEmpty(searchVal))
|
||||
.OrderByDescending(x => x.InizioStato)
|
||||
.Take(numRecord)
|
||||
.FromSqlRaw("EXEC stp_UI_DDBTurni_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
|
||||
.ToList();
|
||||
|
||||
return dbResult;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<div class="row">
|
||||
@inject Services.BlazorTimer Timer
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-10 text-left">
|
||||
<div class="row">
|
||||
<div class="col-9 small">
|
||||
@@ -7,10 +9,15 @@
|
||||
<Pagination>
|
||||
<PaginationItem>
|
||||
<PaginationLink Clicked="@HandlePaginationItemClick" Page="1">
|
||||
<span aria-hidden="true">«</span>
|
||||
<i class="fas fa-angle-double-left"></i>
|
||||
</PaginationLink>
|
||||
</PaginationItem>
|
||||
@for (int i = 1; i <= LastPage; ++i)
|
||||
<PaginationItem>
|
||||
<PaginationLink Clicked="@HandlePaginationItemClick" Page="@prevBlock.ToString()">
|
||||
<span aria-hidden="true"><i class="fas fa-angle-left"></i></span>
|
||||
</PaginationLink>
|
||||
</PaginationItem>
|
||||
@for (int i = @startPage; i <= endPage; ++i)
|
||||
{
|
||||
var pageNum = i;
|
||||
<PaginationItem Active="@(currPage.Equals(pageNum))">
|
||||
@@ -19,16 +26,34 @@
|
||||
</PaginationLink>
|
||||
</PaginationItem>
|
||||
}
|
||||
<PaginationItem>
|
||||
<PaginationLink Clicked="@HandlePaginationItemClick" Page="@nextBlock.ToString()">
|
||||
<i class="fas fa-angle-right"></i>
|
||||
</PaginationLink>
|
||||
</PaginationItem>
|
||||
<PaginationItem>
|
||||
<PaginationLink Clicked="@HandlePaginationItemClick" Page="@LastPage.ToString()">
|
||||
<span aria-hidden="true">»</span>
|
||||
<i class="fas fa-angle-double-right"></i>
|
||||
</PaginationLink>
|
||||
</PaginationItem>
|
||||
</Pagination>
|
||||
}
|
||||
</div>
|
||||
<div class="col-3">
|
||||
@totalCount records
|
||||
@if (!showLoading)
|
||||
{
|
||||
<span>@totalCount records</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 small">
|
||||
@if (showLoading)
|
||||
{
|
||||
<Progress>
|
||||
<ProgressBar Value="@percLoading" Striped="true" Animated="true" />
|
||||
</Progress>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -57,6 +82,47 @@
|
||||
reportChangePage();
|
||||
}
|
||||
|
||||
private int numPages { get; set; } = 10;
|
||||
|
||||
// calcola un set 1..numPOages centrato sulla pagina corrente...
|
||||
private int startPage
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = (int)(currPage / numPages) * numPages;
|
||||
answ = answ > 0 ? answ : 1;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
private int endPage
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = (int)(currPage / numPages) * numPages + numPages;
|
||||
answ = answ < LastPage ? answ : LastPage;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private int prevBlock
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = currPage - numPages;
|
||||
answ = answ > 0 ? answ : 1;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
private int nextBlock
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = currPage + numPages;
|
||||
answ = answ < LastPage ? answ : LastPage;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private int LastPage
|
||||
{
|
||||
get
|
||||
@@ -65,6 +131,38 @@
|
||||
}
|
||||
}
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
showLoading = false;
|
||||
return base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
protected int percLoading { get; set; } = 0;
|
||||
|
||||
protected bool _showLoading = false;
|
||||
|
||||
[Parameter]
|
||||
public bool showLoading
|
||||
{
|
||||
get
|
||||
{
|
||||
return _showLoading;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
Random random = new Random();
|
||||
percLoading = random.Next(30, 90);
|
||||
}
|
||||
else
|
||||
{
|
||||
percLoading = 5;
|
||||
}
|
||||
_showLoading = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public int totalCount { get; set; } = 0;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="row">
|
||||
<div class="col-12 text-center py-3">
|
||||
<div class="row py-5 my-5">
|
||||
<div class="col-12 text-center mt-5 py-5 alert alert-primary">
|
||||
<h3>loading data</h3>
|
||||
<i class="fas fa-spinner fa-spin fa-5x"></i>
|
||||
</div>
|
||||
|
||||
+108
-14
@@ -24,8 +24,6 @@ namespace MP.Stats.Data
|
||||
private readonly IDistributedCache distributedCache;
|
||||
private readonly IMemoryCache memoryCache;
|
||||
|
||||
private DistributedCacheEntryOptions cacheOpt;
|
||||
|
||||
/// <summary>
|
||||
/// Durata assoluta massima della cache
|
||||
/// </summary>
|
||||
@@ -42,6 +40,7 @@ namespace MP.Stats.Data
|
||||
#region Protected Fields
|
||||
|
||||
protected static string connStringBBM = "";
|
||||
|
||||
protected static string connStringFatt = "";
|
||||
|
||||
#endregion Protected Fields
|
||||
@@ -61,7 +60,6 @@ namespace MP.Stats.Data
|
||||
// conf cache
|
||||
this.memoryCache = memoryCache;
|
||||
this.distributedCache = distributedCache;
|
||||
cacheOpt = new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp)).SetSlidingExpiration(TimeSpan.FromMinutes(chSliExp));
|
||||
// conf DB
|
||||
string connStr = _configuration.GetConnectionString("Mp.Stats");
|
||||
if (string.IsNullOrEmpty(connStr))
|
||||
@@ -80,6 +78,18 @@ namespace MP.Stats.Data
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private DistributedCacheEntryOptions cacheOpt
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp)).SetSlidingExpiration(TimeSpan.FromMinutes(chSliExp));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string getCacheKey(string TableName, SelectData CurrFilter)
|
||||
@@ -92,9 +102,26 @@ namespace MP.Stats.Data
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public Task<MP.Data.DatabaseModels.AzioniUL[]> ActionsGetAll()
|
||||
public async Task<List<MP.Data.DatabaseModels.AzioniUL>> ActionsGetAll()
|
||||
{
|
||||
return Task.FromResult(dbController.ActionsGetAll().ToArray());
|
||||
//return Task.FromResult(dbController.ActionsGetAll());
|
||||
List<MP.Data.DatabaseModels.AzioniUL> dbResult = new List<MP.Data.DatabaseModels.AzioniUL>();
|
||||
string cacheKey = "MP:STATS:AZIONI_ALL";
|
||||
string rawData;
|
||||
var redisDataList = await distributedCache.GetAsync(cacheKey);
|
||||
if (redisDataList != null)
|
||||
{
|
||||
rawData = Encoding.UTF8.GetString(redisDataList);
|
||||
dbResult = JsonConvert.DeserializeObject<List<MP.Data.DatabaseModels.AzioniUL>>(rawData);
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbController.ActionsGetAll();
|
||||
rawData = JsonConvert.SerializeObject(dbResult);
|
||||
redisDataList = Encoding.UTF8.GetBytes(rawData);
|
||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt);
|
||||
}
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public void rollBackEdit(object item)
|
||||
@@ -107,14 +134,48 @@ namespace MP.Stats.Data
|
||||
return Task.FromResult(dbController.StatArticoliGetSearch(numRecord, searchVal).ToArray());
|
||||
}
|
||||
|
||||
public Task<MP.Data.DatabaseModels.ResControlli[]> StatControlliGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo, string searchVal = "")
|
||||
public async Task<List<MP.Data.DatabaseModels.ResControlli>> StatControlliGetAll(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
return Task.FromResult(dbController.StatControlliGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
//return Task.FromResult(dbController.StatControlliGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
List<MP.Data.DatabaseModels.ResControlli> dbResult = new List<MP.Data.DatabaseModels.ResControlli>();
|
||||
string cacheKey = getCacheKey("MP:STATS:CONTROLLI", CurrFilter);
|
||||
string rawData;
|
||||
var redisDataList = await distributedCache.GetAsync(cacheKey);
|
||||
if (redisDataList != null)
|
||||
{
|
||||
rawData = Encoding.UTF8.GetString(redisDataList);
|
||||
dbResult = JsonConvert.DeserializeObject<List<MP.Data.DatabaseModels.ResControlli>>(rawData);
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbController.StatControlliGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo);
|
||||
rawData = JsonConvert.SerializeObject(dbResult);
|
||||
redisDataList = Encoding.UTF8.GetBytes(rawData);
|
||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt);
|
||||
}
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public Task<MP.Data.DatabaseModels.DdbTurni[]> StatDdbGetAll(int numRecord, string searchVal = "")
|
||||
public async Task<List<MP.Data.DatabaseModels.DdbTurni>> StatDdbGetAll(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
return Task.FromResult(dbController.StatDdbGetAll(numRecord, searchVal).ToArray());
|
||||
//return Task.FromResult(dbController.StatDdbGetAll(numRecord, searchVal).ToArray());
|
||||
List<MP.Data.DatabaseModels.DdbTurni> dbResult = new List<MP.Data.DatabaseModels.DdbTurni>();
|
||||
string cacheKey = getCacheKey("MP:STATS:DDBT", CurrFilter);
|
||||
string rawData;
|
||||
var redisDataList = await distributedCache.GetAsync(cacheKey);
|
||||
if (redisDataList != null)
|
||||
{
|
||||
rawData = Encoding.UTF8.GetString(redisDataList);
|
||||
dbResult = JsonConvert.DeserializeObject<List<MP.Data.DatabaseModels.DdbTurni>>(rawData);
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbController.StatDdbGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo);
|
||||
rawData = JsonConvert.SerializeObject(dbResult);
|
||||
redisDataList = Encoding.UTF8.GetBytes(rawData);
|
||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt);
|
||||
}
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public Task<MP.Data.DatabaseModels.Macchine[]> StatMacchineGetAll()
|
||||
@@ -144,10 +205,26 @@ namespace MP.Stats.Data
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public Task<MP.Data.DatabaseModels.ResScarti[]> StatScartiGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo, string searchVal = "")
|
||||
public async Task<List<MP.Data.DatabaseModels.ResScarti>> StatScartiGetAll(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
// filtra e restituisce SOLO i primi record...
|
||||
return Task.FromResult(dbController.StatScartiGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
//return Task.FromResult(dbController.StatScartiGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
List<MP.Data.DatabaseModels.ResScarti> dbResult = new List<MP.Data.DatabaseModels.ResScarti>();
|
||||
string cacheKey = getCacheKey("MP:STATS:SCARTI", CurrFilter);
|
||||
string rawData;
|
||||
var redisDataList = await distributedCache.GetAsync(cacheKey);
|
||||
if (redisDataList != null)
|
||||
{
|
||||
rawData = Encoding.UTF8.GetString(redisDataList);
|
||||
dbResult = JsonConvert.DeserializeObject<List<MP.Data.DatabaseModels.ResScarti>>(rawData);
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbController.StatScartiGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo);
|
||||
rawData = JsonConvert.SerializeObject(dbResult);
|
||||
redisDataList = Encoding.UTF8.GetBytes(rawData);
|
||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt);
|
||||
}
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public async Task<List<MP.Data.DatabaseModels.TurniOee>> StatTurniOeeGetAllAsync(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo, string searchVal = "")
|
||||
@@ -186,9 +263,26 @@ namespace MP.Stats.Data
|
||||
return Task.FromResult(dbController.StatTurniParetoOdlGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
}
|
||||
|
||||
public Task<MP.Data.DatabaseModels.UserActionLog[]> StatUserLogGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo, string searchVal = "")
|
||||
public async Task<List<MP.Data.DatabaseModels.UserActionLog>> StatUserLogGetAll(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
return Task.FromResult(dbController.StatUserLogGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
//return Task.FromResult(dbController.StatUserLogGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
List<MP.Data.DatabaseModels.UserActionLog> dbResult = new List<MP.Data.DatabaseModels.UserActionLog>();
|
||||
string cacheKey = getCacheKey("MP:STATS:USRACTLOG", CurrFilter);
|
||||
string rawData;
|
||||
var redisDataList = await distributedCache.GetAsync(cacheKey);
|
||||
if (redisDataList != null)
|
||||
{
|
||||
rawData = Encoding.UTF8.GetString(redisDataList);
|
||||
dbResult = JsonConvert.DeserializeObject<List<MP.Data.DatabaseModels.UserActionLog>>(rawData);
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbController.StatUserLogGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo);
|
||||
rawData = JsonConvert.SerializeObject(dbResult);
|
||||
redisDataList = Encoding.UTF8.GetBytes(rawData);
|
||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt);
|
||||
}
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -1,31 +1,28 @@
|
||||
@page "/controlli"
|
||||
|
||||
@using MP.Stats.Components
|
||||
@using MP.Stats.Data
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-3 h2">Registro Controlli</div>
|
||||
<div class="col-6 col-lg-9">
|
||||
<div class="col-6 h2">Registro Controlli</div>
|
||||
<div class="col-6">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body py-0">
|
||||
@if (currRecord != null)
|
||||
<div class="row">
|
||||
<div class="col-12 table-secondary">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter"></SelectionFilter>
|
||||
</div>
|
||||
</div>
|
||||
@if (totalCount == 0 || ListRecords == null)
|
||||
{
|
||||
@*<BasketEditor Basket="@currBasket" DataReset="ResetData" DataUpdated="UpdateData"></BasketEditor>*@
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:70%"></div>
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12 table-secondary">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter"></SelectionFilter>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
@@ -61,6 +58,6 @@
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@SearchRecords.Count()" />
|
||||
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -2,6 +2,7 @@
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Stats.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -13,8 +14,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
private MP.Data.DatabaseModels.ResControlli currRecord = null;
|
||||
|
||||
private MP.Data.DatabaseModels.ResControlli[] ListRecords;
|
||||
private MP.Data.DatabaseModels.ResControlli[] SearchRecords;
|
||||
private List<MP.Data.DatabaseModels.ResControlli> ListRecords;
|
||||
private List<MP.Data.DatabaseModels.ResControlli> SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -22,6 +23,7 @@ namespace MP.Stats.Pages
|
||||
|
||||
private SelectData currFilter { get; set; } = new SelectData();
|
||||
private int currPage { get; set; } = 1;
|
||||
private bool isLoading { get; set; } = false;
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
#endregion Private Properties
|
||||
@@ -40,14 +42,29 @@ namespace MP.Stats.Pages
|
||||
[Inject]
|
||||
protected MpStatsService StatService { get; set; }
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
answ = SearchRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
SearchRecords = await StatService.StatControlliGetAll(currFilter.DateStart, currFilter.DateEnd, currFilter.IdxMacchina, currFilter.IdxOdl, currFilter.KeyRichiesta, currFilter.CodArticolo, MessageService.SearchVal);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToArray();
|
||||
isLoading = true;
|
||||
SearchRecords = await StatService.StatControlliGetAll(currFilter, MessageService.SearchVal);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
@@ -56,6 +73,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
protected async Task DoFilter(SelectData newFilter)
|
||||
{
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
currFilter = newFilter;
|
||||
await reloadData();
|
||||
}
|
||||
@@ -74,6 +93,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
numRecord = 10;
|
||||
currFilter = SelectData.Init(5, 7);
|
||||
MessageService.ShowSearch = false;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
await reloadData();
|
||||
|
||||
+32
-38
@@ -1,51 +1,45 @@
|
||||
@page "/diario"
|
||||
|
||||
@using MP.Stats.Components
|
||||
@using MP.Stats.Data
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-3 h2">Diario Produzione</div>
|
||||
<div class="col-6 col-lg-9">
|
||||
<div class="col-6 h2">Diario Produzione</div>
|
||||
<div class="col-6">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body py-0">
|
||||
@if (currRecord != null)
|
||||
<div class="row">
|
||||
<div class="col-12 table-secondary">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter"></SelectionFilter>
|
||||
</div>
|
||||
</div>
|
||||
@if (totalCount == 0 || ListRecords == null || ListRecords.Count() == 0)
|
||||
{
|
||||
@*<BasketEditor Basket="@currBasket" DataReset="ResetData" DataUpdated="UpdateData"></BasketEditor>*@
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:70%"></div>
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12 table-secondary">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter"></SelectionFilter>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
@*<th></th>*@
|
||||
<th>Macchina</th>
|
||||
<th>Data</th>
|
||||
<th>ODL/Commessa</th>
|
||||
<th>Articolo</th>
|
||||
<th class="text-right">Stato</th>
|
||||
<th class="text-right">Durata</th>
|
||||
<th class="text-right">Pezzi</th>
|
||||
@*<th>Operatore</th>*@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Macchina</th>
|
||||
<th>Data</th>
|
||||
<th>ODL/Commessa</th>
|
||||
<th>Articolo</th>
|
||||
<th class="text-right">Stato</th>
|
||||
<th class="text-right">Durata</th>
|
||||
<th class="text-right">Pezzi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.IdxMacchina, record.CodArticolo, record.InizioStato)">
|
||||
@*<td><button class="btn btn-sm btn-info" @onclick="() => Edit(record)"><span class="oi oi-pencil"></span></button> <button class="btn btn-sm btn-success" @onclick="() => ShowDocs(record)" title="Vai ai documenti"><span class="oi oi-document"></span></button></td>*@
|
||||
<td>
|
||||
<div>@record.CodMacchina</div>
|
||||
<div class="small">@record.IdxMacchina</div>
|
||||
@@ -60,14 +54,14 @@
|
||||
<td class="text-right">@record.DurataMin</td>
|
||||
<td class="text-right">@record.TotPzProd</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@SearchRecords.Count()" />
|
||||
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Stats.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -13,9 +14,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
private MP.Data.DatabaseModels.DdbTurni currRecord = null;
|
||||
|
||||
private MP.Data.DatabaseModels.DdbTurni[] ListRecords;
|
||||
|
||||
private MP.Data.DatabaseModels.DdbTurni[] SearchRecords;
|
||||
private List<MP.Data.DatabaseModels.DdbTurni> ListRecords;
|
||||
private List<MP.Data.DatabaseModels.DdbTurni> SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace MP.Stats.Pages
|
||||
|
||||
private SelectData currFilter { get; set; } = new SelectData();
|
||||
private int currPage { get; set; } = 1;
|
||||
private bool isLoading { get; set; } = false;
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
#endregion Private Properties
|
||||
@@ -41,16 +42,29 @@ namespace MP.Stats.Pages
|
||||
[Inject]
|
||||
protected MpStatsService StatService { get; set; }
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
answ = SearchRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
// fare VERO filtro periodo
|
||||
SearchRecords = await StatService.StatDdbGetAll(200, MessageService.SearchVal);
|
||||
// SearchRecords = await StatService.StatDdbGetAll(currFilter.DateStart, currFilter.DateEnd, currFilter.IdxMacchina, currFilter.IdxOdl, currFilter.KeyRichiesta, currFilter.CodArticolo, MessageService.SearchVal);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToArray();
|
||||
isLoading = true;
|
||||
SearchRecords = await StatService.StatDdbGetAll(currFilter, MessageService.SearchVal);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
@@ -59,6 +73,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
protected async Task DoFilter(SelectData newFilter)
|
||||
{
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
currFilter = newFilter;
|
||||
await reloadData();
|
||||
}
|
||||
@@ -78,6 +94,7 @@ namespace MP.Stats.Pages
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
numRecord = 10;
|
||||
currFilter = SelectData.Init(5, 3);
|
||||
MessageService.ShowSearch = false;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
await reloadData();
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<div class="card-body py-0">
|
||||
<HomeButton NavLink="oee" Icon="oi oi-monitor" Descript="TRS/OEE %" />
|
||||
<HomeButton NavLink="reportodl" Icon="oi oi-book" Descript="Report ODL" />
|
||||
<HomeButton NavLink="produzione" Icon="oi oi-clipboard" Descript="Diario Produzione" />
|
||||
<HomeButton NavLink="diario" Icon="oi oi-clipboard" Descript="Diario Produzione" />
|
||||
<HomeButton NavLink="userlog" Icon="oi oi-document" Descript="User ActionLog" />
|
||||
<HomeButton NavLink="controlli" Icon="oi oi-beaker" Descript="Controlli" />
|
||||
<HomeButton NavLink="scarti" Icon="oi oi-warning" Descript="Scarti" />
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-3 h2">TRS / OEE %</div>
|
||||
<div class="col-6 col-lg-9">
|
||||
<div class="col-6 h2">TRS / OEE %</div>
|
||||
<div class="col-6">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -16,7 +16,7 @@
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter"></SelectionFilter>
|
||||
</div>
|
||||
</div>
|
||||
@if (totalCount == 0 || ListRecords == null || ListRecords.Count() == 0)
|
||||
@if (totalCount == 0 || ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
@@ -61,6 +61,6 @@
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" />
|
||||
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -24,6 +24,7 @@ namespace MP.Stats.Pages
|
||||
|
||||
private SelectData currFilter { get; set; } = new SelectData();
|
||||
private int currPage { get; set; } = 1;
|
||||
private bool isLoading { get; set; } = false;
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
#endregion Private Properties
|
||||
@@ -61,8 +62,10 @@ namespace MP.Stats.Pages
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = await StatService.StatTurniOeeGetAllCached(currFilter, MessageService.SearchVal);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-3 h2">Report ODL/Comm.</div>
|
||||
<div class="col-6 col-lg-9">
|
||||
<div class="col-6 h2">Report ODL/Comm.</div>
|
||||
<div class="col-6">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+10
-12
@@ -5,26 +5,24 @@
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-3 h2">Registro Scarti</div>
|
||||
<div class="col-6 col-lg-9">
|
||||
<div class="col-6 h2">Registro Scarti</div>
|
||||
<div class="col-6">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body py-0">
|
||||
@if (currRecord != null)
|
||||
<div class="row">
|
||||
<div class="col-12 table-secondary">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter"></SelectionFilter>
|
||||
</div>
|
||||
</div>
|
||||
@if (totalCount == 0 || ListRecords == null)
|
||||
{
|
||||
@*<BasketEditor Basket="@currBasket" DataReset="ResetData" DataUpdated="UpdateData"></BasketEditor>*@
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:70%"></div>
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12 table-secondary">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter"></SelectionFilter>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
@@ -70,6 +68,6 @@
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@SearchRecords.Count()" />
|
||||
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -14,9 +14,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
private MP.Data.DatabaseModels.ResScarti currRecord = null;
|
||||
|
||||
private MP.Data.DatabaseModels.ResScarti[] ListRecords;
|
||||
|
||||
private MP.Data.DatabaseModels.ResScarti[] SearchRecords;
|
||||
private List<MP.Data.DatabaseModels.ResScarti> ListRecords;
|
||||
private List<MP.Data.DatabaseModels.ResScarti> SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -24,6 +23,7 @@ namespace MP.Stats.Pages
|
||||
|
||||
private SelectData currFilter { get; set; } = new SelectData();
|
||||
private int currPage { get; set; } = 1;
|
||||
private bool isLoading { get; set; } = false;
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
#endregion Private Properties
|
||||
@@ -42,14 +42,28 @@ namespace MP.Stats.Pages
|
||||
[Inject]
|
||||
protected MpStatsService StatService { get; set; }
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
answ = SearchRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
SearchRecords = await StatService.StatScartiGetAll(currFilter.DateStart, currFilter.DateEnd, currFilter.IdxMacchina, currFilter.IdxOdl, currFilter.KeyRichiesta, currFilter.CodArticolo, MessageService.SearchVal);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToArray();
|
||||
isLoading = true;
|
||||
SearchRecords = await StatService.StatScartiGetAll(currFilter, MessageService.SearchVal);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
@@ -58,6 +72,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
protected async Task DoFilter(SelectData newFilter)
|
||||
{
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
currFilter = newFilter;
|
||||
await reloadData();
|
||||
}
|
||||
@@ -76,6 +92,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
numRecord = 10;
|
||||
currFilter = SelectData.Init(5, 7);
|
||||
MessageService.ShowSearch = false;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
await reloadData();
|
||||
|
||||
@@ -1,31 +1,28 @@
|
||||
@page "/userlog"
|
||||
|
||||
@using MP.Stats.Components
|
||||
@using MP.Stats.Data
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-3 h2">User ActionLog</div>
|
||||
<div class="col-6 col-lg-9">
|
||||
<div class="col-6 h2">User ActionLog</div>
|
||||
<div class="col-6">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body py-0">
|
||||
@if (currRecord != null)
|
||||
<div class="row">
|
||||
<div class="col-12 table-secondary">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter"></SelectionFilter>
|
||||
</div>
|
||||
</div>
|
||||
@if (totalCount == 0 || ListRecords == null)
|
||||
{
|
||||
@*<BasketEditor Basket="@currBasket" DataReset="ResetData" DataUpdated="UpdateData"></BasketEditor>*@
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:70%"></div>
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12 table-secondary">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter"></SelectionFilter>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
@@ -75,6 +72,6 @@
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@SearchRecords.Count()" />
|
||||
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Stats.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -11,11 +12,11 @@ namespace MP.Stats.Pages
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private MP.Data.DatabaseModels.AzioniUL[] ActionsList;
|
||||
private List<MP.Data.DatabaseModels.AzioniUL> ActionsList;
|
||||
private MP.Data.DatabaseModels.UserActionLog currRecord = null;
|
||||
|
||||
private MP.Data.DatabaseModels.UserActionLog[] ListRecords;
|
||||
private MP.Data.DatabaseModels.UserActionLog[] SearchRecords;
|
||||
private List<MP.Data.DatabaseModels.UserActionLog> ListRecords;
|
||||
private List<MP.Data.DatabaseModels.UserActionLog> SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -23,6 +24,7 @@ namespace MP.Stats.Pages
|
||||
|
||||
private SelectData currFilter { get; set; } = new SelectData();
|
||||
private int currPage { get; set; } = 1;
|
||||
private bool isLoading { get; set; } = false;
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
#endregion Private Properties
|
||||
@@ -41,15 +43,30 @@ namespace MP.Stats.Pages
|
||||
[Inject]
|
||||
protected MpStatsService StatService { get; set; }
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
answ = SearchRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ActionsList = await StatService.ActionsGetAll();
|
||||
SearchRecords = await StatService.StatUserLogGetAll(currFilter.DateStart, currFilter.DateEnd, currFilter.IdxMacchina, currFilter.IdxOdl, currFilter.KeyRichiesta, currFilter.CodArticolo, MessageService.SearchVal);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToArray();
|
||||
SearchRecords = await StatService.StatUserLogGetAll(currFilter, MessageService.SearchVal);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
@@ -58,6 +75,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
protected async Task DoFilter(SelectData newFilter)
|
||||
{
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
currFilter = newFilter;
|
||||
await reloadData();
|
||||
}
|
||||
@@ -76,6 +95,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
numRecord = 10;
|
||||
currFilter = SelectData.Init(5, 7);
|
||||
MessageService.ShowSearch = false;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
await reloadData();
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
|
||||
namespace MP.Stats.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Timer a consumo
|
||||
/// https://wellsb.com/csharp/aspnet/blazor-timer-navigate-programmatically/
|
||||
/// (da verificare)
|
||||
/// </summary>
|
||||
public class BlazorTimer
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private Timer _timer;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Events
|
||||
|
||||
public event Action OnElapsed;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void NotifyTimerElapsed(Object source, ElapsedEventArgs e)
|
||||
{
|
||||
OnElapsed?.Invoke();
|
||||
_timer.Dispose();
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void SetTimer(double interval)
|
||||
{
|
||||
_timer = new Timer(interval);
|
||||
_timer.Elapsed += NotifyTimerElapsed;
|
||||
_timer.Enabled = true;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -95,6 +95,7 @@ namespace MP.Stats
|
||||
services.AddRazorPages();
|
||||
services.AddServerSideBlazor();
|
||||
services.AddSingleton<IConfiguration>(Configuration);
|
||||
services.AddTransient<Services.BlazorTimer>();
|
||||
|
||||
#if false
|
||||
services.AddDbContext<BloggingContext>(options =>
|
||||
|
||||
Reference in New Issue
Block a user