diff --git a/MP.AppAuth/Controllers/AppAuthController.cs b/MP.AppAuth/Controllers/AppAuthController.cs index 316d3743..69f0fd1f 100644 --- a/MP.AppAuth/Controllers/AppAuthController.cs +++ b/MP.AppAuth/Controllers/AppAuthController.cs @@ -34,19 +34,21 @@ namespace MP.AppAuth.Controllers public List AnagOpGetAll(string searchVal) { List dbResult = new List(); - - if (!string.IsNullOrEmpty(searchVal)) + using (AppAuthContext localDbCtx = new AppAuthContext(_configuration)) { - dbResult = dbCtx - .DbSetAnagOpr - .Where(x => x.Cognome.Contains(searchVal) || x.Nome.Contains(searchVal)) - .ToList(); - } - else - { - dbResult = dbCtx - .DbSetAnagOpr - .ToList(); + if (!string.IsNullOrEmpty(searchVal)) + { + dbResult = localDbCtx + .DbSetAnagOpr + .Where(x => x.Cognome.Contains(searchVal) || x.Nome.Contains(searchVal)) + .ToList(); + } + else + { + dbResult = localDbCtx + .DbSetAnagOpr + .ToList(); + } } // ritorno return dbResult; @@ -93,11 +95,12 @@ namespace MP.AppAuth.Controllers public List UpdManGetAll() { List dbResult = new List(); - - dbResult = dbCtx + using (AppAuthContext localDbCtx = new AppAuthContext(_configuration)) + { + dbResult = localDbCtx .DbSetUpdMan .ToList(); - + } return dbResult; } @@ -108,11 +111,12 @@ namespace MP.AppAuth.Controllers public List VocabolarioGetAll() { List dbResult = new List(); - - dbResult = dbCtx + using (AppAuthContext localDbCtx = new AppAuthContext(_configuration)) + { + dbResult = localDbCtx .DbSetVocabolario .ToList(); - + } return dbResult; } diff --git a/MP.AppAuth/HwSwInfo.cs b/MP.AppAuth/HwSwInfo.cs new file mode 100644 index 00000000..c08ebfbe --- /dev/null +++ b/MP.AppAuth/HwSwInfo.cs @@ -0,0 +1,276 @@ +using NLog; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace MP.AppAuth +{ + /// + /// Helper x estrarre dati sintetici su HW, Software, librerie installate... + /// + public class HwSwInfo + { + #region Private Fields + + private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + + #endregion Private Fields + + #region Protected Fields + + /// + /// Assembly di base + /// + protected Assembly assembly = Assembly.GetExecutingAssembly(); + + #endregion Protected Fields + + #region Public Constructors + + /// + /// Istanza base + /// + public HwSwInfo() + { + assembly = Assembly.GetExecutingAssembly(); + } + + public HwSwInfo(Assembly targetAssembly) + { + assembly = targetAssembly; + } + + #endregion Public Constructors + +#if false + /// + /// Singleton! + /// + public static HwSwInfo man = new HwSwInfo(); +#endif + + #region Public Properties + + /// + /// Statistiche IIS + /// + public string IISStats + { + get + { + StringBuilder sb = new StringBuilder(); + using (var iis = Process.GetCurrentProcess()) + { + //Process iis = Process.GetCurrentProcess(); + sb.AppendLine(string.Format("UPTIME: {0}", ToDateString(DateTime.Now - iis.StartTime))); + sb.AppendLine(string.Format("Priority: {0}", iis.PriorityClass)); + sb.AppendLine(string.Format("Physical Memory Used: {0}", memFormat(iis.WorkingSet64))); + sb.AppendLine(string.Format("Virtual Memory Used: {0}", memFormat(iis.VirtualMemorySize64))); + } + return sb.ToString(); + } + } + + /// + /// Versioni di ogni libreria compresa + /// + public string librariesVers + { + get + { + string answ = ""; + try + { + AssemblyName[] referencedAssemblyNames = assembly.GetReferencedAssemblies(); + foreach (AssemblyName referencedAssemblyName in referencedAssemblyNames.OrderBy(n => n.Name)) + { + answ += referencedAssemblyName.FullName + Environment.NewLine; + } + } + catch + { } + return answ; + } + } + + /// + /// Nome MainAssembly + /// + public string mainAssembly + { + get + { + string answ = ""; + try + { + answ = assembly.FullName; + } + catch + { } + return answ; + } + } + + /// + /// Num di librerie inserite + /// + public int numLibraries + { + get + { + int numLib = 0; ; + try + { + AssemblyName[] referencedAssemblyNames = assembly.GetReferencedAssemblies(); + foreach (AssemblyName referencedAssemblyName in referencedAssemblyNames.OrderBy(n => n.Name)) + { + numLib++; + } + } + catch + { } + return numLib; + } + } + + ///// + ///// Dati sui server redis... + ///// + //public string redisServersData + //{ + // get + // { + // StringBuilder sb = new StringBuilder(); + // try + // { + // var servData = memLayer.ML.redServInfo(); + // foreach (var item in servData) + // { + // sb.AppendLine(string.Format("Server: {0} | {1} | {2}", item, item.Version, item.ServerType)); + // // da completare con altre info?!? + // var srvInfo = item.Info(); + // // esporto un pò di info x gruppo... + // foreach (IGrouping> capitolo in srvInfo) + // { + // sb.AppendLine("----------------------------------------------"); + // sb.AppendLine(string.Format("Capitolo: {0}", capitolo.Key)); + // sb.AppendLine("----------------------------------------------"); + // foreach (var kvp in capitolo) + // { + // sb.AppendLine(string.Format("{0}:{1}", kvp.Key, kvp.Value)); + // } + + // sb.AppendLine(); + // } + // } + // } + // catch (Exception exc) + // { + // Log.Error($"Errore in redisServersData{Environment.NewLine}{exc}"); + // } + // return sb.ToString(); + // } + //} + + /// + /// Runtime assembly + /// + public string runtimeImg + { + get + { + string answ = ""; + try + { + answ = assembly.ImageRuntimeVersion; + } + catch + { } + return answ; + } + } + + /// + /// Statistiche server + /// + public string ServerStats + { + get + { + StringBuilder sb = new StringBuilder(); + try + { + // calcoli preliminari + + // compongo output + sb.AppendLine(string.Format("NAME: {0}", Environment.MachineName)); + sb.AppendLine(System.Runtime.InteropServices.RuntimeInformation.OSDescription); + sb.AppendLine(System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription); + sb.AppendLine(string.Format("OS 64bit: {0} | PROC 64bit: {1}", Environment.Is64BitOperatingSystem, Environment.Is64BitProcess)); + //sb.AppendLine(string.Format("SYS UPTIME: {0}", ToDateString(uptime))); + sb.AppendLine(string.Format("CPU: {0}", Environment.ProcessorCount)); + //sb.AppendLine(string.Format("RAM: {0}", memFormat(computer.TotalPhysicalMemory))); + //sb.AppendLine(string.Format("Virtual Memory: {0}", memFormat(computer.TotalVirtualMemory))); + //sb.AppendLine(string.Format("Available RAM: {0}", memFormat(computer.AvailablePhysicalMemory))); + //sb.AppendLine(string.Format("Available Virtual Memory: {0}", memFormat(computer.AvailableVirtualMemory))); + sb.AppendLine(string.Format("DIR: {0}", Environment.CurrentDirectory)); + sb.AppendLine(string.Format("USER: {0} | USER: {1}", Environment.UserDomainName, Environment.UserName)); + } + catch (Exception exc) + { + Log.Error($"Errore in ServerStats{Environment.NewLine}{exc}"); + } + return sb.ToString(); + } + } + + #endregion Public Properties + + #region Public Methods + + /// + /// Singleton! + /// + public static HwSwInfo man(Assembly targetAssembly) + { + HwSwInfo answ = new HwSwInfo(targetAssembly); + return answ; + } + + /// + /// Formatta un numero da int a size in Kb/Mb/Gb/Tb + /// + /// + /// + public string memFormat(double rawSize) + { + string[] sizes = { "B", "KB", "MB", "GB", "TB" }; + int order = 0; + while (rawSize >= 1024 && order < sizes.Length - 1) + { + order++; + rawSize = rawSize / 1024; + } + + // Adjust the format string to your preferences. For example "{0:0.#}{1}" would + // show a single decimal place, and no space. + return String.Format("{0:0.##} {1}", rawSize, sizes[order]); + } + + /// + /// Stringa timing in gg, ore, ... da timespan + /// + /// + /// + public string ToDateString(TimeSpan time) + { + return string.Format("{0}gg, {1:00}:{2:00}:{3:00} (h:m:s)", time.Days, time.Hours, time.Minutes, time.Seconds); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.Land/Components/DataPager.razor b/MP.Land/Components/DataPager.razor index 3d577d19..111f1ae0 100644 --- a/MP.Land/Components/DataPager.razor +++ b/MP.Land/Components/DataPager.razor @@ -42,11 +42,9 @@ {
} diff --git a/MP.Land/Components/DataPager.razor.cs b/MP.Land/Components/DataPager.razor.cs index 4ba7dcee..3b6266a8 100644 --- a/MP.Land/Components/DataPager.razor.cs +++ b/MP.Land/Components/DataPager.razor.cs @@ -71,7 +71,7 @@ namespace MP.Land.Components protected int _numPage { get; set; } = 1; - protected int _numRecord { get; set; } = 10; + protected int _numRecord { get; set; } = 4; protected int percLoading { get; set; } = 0; diff --git a/MP.Land/Components/SearchMod.razor b/MP.Land/Components/SearchMod.razor index b20dc6a1..1eba65ea 100644 --- a/MP.Land/Components/SearchMod.razor +++ b/MP.Land/Components/SearchMod.razor @@ -5,7 +5,7 @@ @inject MessageService MessageService
- +
@@ -14,8 +14,8 @@ @code { private string _searchVal = ""; - private int _debMsec = 200; - private int _minChar = 2; + private int _debMsec = 300; + private int _minChar = 0; private DebounceInput debInput; [Parameter] diff --git a/MP.Land/Components/UserCard.razor b/MP.Land/Components/UserCard.razor index 247d9bbf..e5dffaa3 100644 --- a/MP.Land/Components/UserCard.razor +++ b/MP.Land/Components/UserCard.razor @@ -2,18 +2,17 @@ @inject IJSRuntime JSRuntime -
-
+
+
-
+
EgalWare
- @* EgalWare*@
-
+

@Environment

@@ -29,9 +28,9 @@
- + @**@
@code { @@ -41,7 +40,11 @@ protected override async Task OnAfterRenderAsync(bool firstRender) { - await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{CurrItem.MatrOpr}", rawCode); + if (!firstRender) + { + await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{CurrItem.MatrOpr}"); + await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{CurrItem.MatrOpr}", rawCode); + } } [Parameter] diff --git a/MP.Land/Data/AppAuthService.cs b/MP.Land/Data/AppAuthService.cs index fb255c02..2d9b5d23 100644 --- a/MP.Land/Data/AppAuthService.cs +++ b/MP.Land/Data/AppAuthService.cs @@ -127,12 +127,12 @@ namespace MP.Land.Data #region Public Methods - public async Task> AnagOperList() + public async Task> AnagOperList(string searchVal) { List dbResult = new List(); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - dbResult = dbController.AnagOpGetAll(""); + dbResult = dbController.AnagOpGetAll(searchVal); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; Log.Trace($"Effettuata lettura da DB per AnagOperList: {ts.TotalMilliseconds} ms"); diff --git a/MP.Land/Data/FileArchDataService.cs b/MP.Land/Data/FileArchDataService.cs deleted file mode 100644 index 8169cfe7..00000000 --- a/MP.Land/Data/FileArchDataService.cs +++ /dev/null @@ -1,341 +0,0 @@ -using Microsoft.Extensions.Caching.Distributed; -using Microsoft.Extensions.Caching.Memory; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; -using MP.FileData; -using Newtonsoft.Json; -using NLog; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Diagnostics; -using MP.FileData.Controllers; -using MP.FileData.DTO; - -namespace MP.Land.Data -{ - public class FileArchDataService : IDisposable - { - #region Private Fields - - private static IConfiguration _configuration; - - private static ILogger _logger; - - private static List ElencoMacchine = new List(); - - private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); - - private readonly IDistributedCache distributedCache; - - private readonly IMemoryCache memoryCache; - - /// - /// Durata assoluta massima della cache - /// - private int chAbsExp = 15; - - /// - /// Durata della cache in modalità inattiva (non acceduta) prima di venire rimossa - /// NON estende oltre il tempo massimo di validità della cache (chAbsExp) - /// - private int chSliExp = 5; - - #endregion Private Fields - - #region Protected Fields - - protected static string connStringBBM = ""; - - protected static string connStringFatt = ""; - - #endregion Protected Fields - - #region Public Fields - - public static FileData.Controllers.FileController dbController; - - #endregion Public Fields - - #region Public Constructors - - public FileArchDataService(IConfiguration configuration, ILogger logger, IMemoryCache memoryCache, IDistributedCache distributedCache) - { - _logger = logger; - _configuration = configuration; - // conf cache - this.memoryCache = memoryCache; - this.distributedCache = distributedCache; - // conf DB - string connStr = _configuration.GetConnectionString("MP.Land"); - if (string.IsNullOrEmpty(connStr)) - { - _logger.LogError("ConnString empty!"); - } - else - { - dbController = new FileData.Controllers.FileController(configuration); - _logger.LogInformation("DbController OK"); - } - } - - #endregion Public Constructors - - #region Private Properties - - private DistributedCacheEntryOptions cacheOpt - { - get - { - return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp)).SetSlidingExpiration(TimeSpan.FromMinutes(chSliExp)); - } - } - - private DistributedCacheEntryOptions cacheOptLong - { - get - { - return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp * 10)).SetSlidingExpiration(TimeSpan.FromMinutes(chSliExp)); - } - } - - #endregion Private Properties - - #region Internal Methods - - internal Task FileApprove(FileData.DatabaseModels.FileModel currItem) - { - return Task.FromResult(dbController.FileModApprove(currItem)); - } - - internal Task FileDelete(FileData.DatabaseModels.FileModel currItem) - { - return Task.FromResult(dbController.FileDelete(currItem)); - } - - internal Task FileReject(FileData.DatabaseModels.FileModel currItem) - { - return Task.FromResult(dbController.FileModReject(currItem)); - } - - internal Task FileUpdate(FileData.DatabaseModels.FileModel updItem) - { - return Task.FromResult(dbController.FileUpdate(updItem)); - } - - internal void ResetController() - { - dbController.ResetController(); - } - - #endregion Internal Methods - - #region Public Methods - - public void Dispose() - { - // Clear database controller - dbController.Dispose(); - } - - public async Task FileCountFilt(SelectData CurrFilter) - { - int numCount = 0; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - numCount = dbController.FileCountFilt(CurrFilter.IdxMacchina, CurrFilter.OnlyActive, CurrFilter.OnlyMod, CurrFilter.OnlyNoTag, CurrFilter.FileName, CurrFilter.Tag, CurrFilter.SearchVal); - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB per FileCountFilt: {ts.TotalMilliseconds} ms"); - return await Task.FromResult(numCount); - } - - public Task FileGetByKey(int FileId) - { - return Task.FromResult(dbController.FileGetByKey(FileId)); - } - - public async Task> FileGetFilt(SelectData CurrFilter) - { - List dbResult = new List(); - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - dbResult = dbController.FileGetFilt(CurrFilter.IdxMacchina, CurrFilter.OnlyActive, CurrFilter.OnlyMod, CurrFilter.OnlyNoTag, CurrFilter.FileName, CurrFilter.Tag, CurrFilter.SearchVal, CurrFilter.NumSkip, CurrFilter.PageSize).ToList(); - //dbResult = dbController.FileGetFilt(CurrFilter.IdxMacchina, CurrFilter.OnlyActive, CurrFilter.OnlyMod, CurrFilter.FirstRecord, CurrFilter.PageSize * 10, CurrFilter.SearchVal).ToList(); - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB per FileGetFilt: {ts.TotalMilliseconds} ms"); - return await Task.FromResult(dbResult); - } - - public async Task> GetArchiveStatus() - { - List dbResult = new List(); - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - dbResult = dbController.GetArchiveStatus(); - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB per GetArchiveStatus: {ts.TotalMilliseconds} ms"); - return await Task.FromResult(dbResult); - } - - public Task MacchinaGetByKey(string idxMacchina) - { - return Task.FromResult(dbController.MacchinaGetByKey(idxMacchina)); - } - - public Task> MacchineGetAll() - { - return Task.FromResult(dbController.MacchineGetAll().ToList()); - } - - public async Task> MachineList() - { - List answ = new List(); - answ.Add(new AutocompleteModel { LabelField = "--- TUTTE ---", ValueField = "*" }); - answ.AddRange(dbController.MacchineGetAll().Select(x => new AutocompleteModel { LabelField = $"{x.IdxMacchina} | {x.Nome} {x.Descrizione} ", ValueField = x.IdxMacchina }).ToList()); - return await Task.FromResult(answ); - } - - public void rollBackEdit(object item) - { - dbController.RollBackEntity(item); - } - - public async Task> TagGetFilt(string SearchVal) - { - return await Task.FromResult(dbController.TagGetFilt(SearchVal, 200).ToList()); - } - - public Task> TagGetSearch(string searchVal, int numRecord) - { - List answ = new List(); - answ.Add(new AutocompleteModel { LabelField = "--- TUTTE ---", ValueField = "*" }); - if (numRecord > -1) - { - answ.AddRange(dbController.TagGetFilt(searchVal, numRecord).Select(x => new AutocompleteModel { LabelField = $"{x.TagId}", ValueField = x.TagId }).ToList()); - } - return Task.FromResult(answ); - } - -#if false - protected string getCacheKey(string TableName, SelectData CurrFilter) - { - string answ = $"{TableName}:M_{CurrFilter.IdxMacchina}:A_{CurrFilter.CodArticolo}:K_{CurrFilter.KeyRichiesta}:O_{CurrFilter.IdxOdl}:D_{CurrFilter.DateStart:yyyyMMddHHmm}_{CurrFilter.DateEnd:yyyyMMddHHmm}"; - return answ; - } - - protected string getCacheKeyPaged(string TableName, SelectData CurrFilter) - { - string answ = $"{TableName}:M_{CurrFilter.IdxMacchina}:A_{CurrFilter.CodArticolo}:K_{CurrFilter.KeyRichiesta}:O_{CurrFilter.IdxOdl}:D_{CurrFilter.DateStart:yyMMddHHmm}_{CurrFilter.DateEnd:yyMMddHHmm}:R_{CurrFilter.FirstRecord}_{CurrFilter.FirstRecord + CurrFilter.NumRecord}"; - return answ; - } -#endif - - /// - /// Aggiorna intero archivio scansionando dati x tutte le macchine che hanno un path valido - /// - /// Numero giorni x ricerca all'indietro da data corrente / 0 = nessun limite - /// - public async Task updateAllArchive(int numDayPre, bool forceTag) - { - int checkDone = 0; - var listaMacchine = await MacchineGetAll(); - foreach (var item in listaMacchine.Where(x => !string.IsNullOrEmpty(x.BasePath)).ToList()) - { - checkDone += await updateMachineArchive(item.IdxMacchina, numDayPre, forceTag, false); - } - - return await Task.FromResult(checkDone); - } - - /// - /// Aggiorna archivio di una amcchina scansionando path relativo - /// - /// Codice macchina - /// Numero giorni x ricerca all'indietro da data corrente / 0 = nessun limite - /// Forza la riverifica dei tags (x update da setup) - /// Scrittura log verboso macchina - /// - public async Task updateMachineArchive(string idxMacchina, int numDayPre, bool forceTag, bool fullLog) - { - int checkDone = 0; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - string ruleName = "Rule00.json"; - try - { - var macchina = MacchinaGetByKey(idxMacchina).Result; - if (macchina != null && !string.IsNullOrEmpty(macchina.BasePath)) - { - if (!string.IsNullOrEmpty(macchina.RuleName)) - { - ruleName = macchina.RuleName; - // gestione confRule... - SearchRules currRule = new SearchRules(); - try - { - string rawData = File.ReadAllText(FileController.rulePath(ruleName)); - currRule = JsonConvert.DeserializeObject(rawData); - //Log.Info($"Conf rule acquisito da file {ruleName}:{Environment.NewLine}{rawData}"); - } - catch (Exception exc) - { - Log.Error($"Eccezione in deserializzazione conf rule{Environment.NewLine}{exc}"); - } - - // se NON deserializzato inizializzo hard-coded - if (currRule.Name == "ND") - { - // fare: lettura conf rule x recupero tag x singola macchina - //$"\\b{fileName}" + @".{0,2}\([\w\d\s.]+\)"; - - Dictionary confReplace = new Dictionary(); - confReplace.Add("(", " "); - confReplace.Add(")", " "); - - Dictionary fileExtReplace = new Dictionary(); - fileExtReplace.Add(".P-2", ""); - // hard coded + salvataggio conf x creare json - currRule = new SearchRules() - { - Name = "Commento Filename", - Mode = SearchMode.StringOnFile, - MaxChar2Search = 100, - ReplaceCR = true, - RegExPattern = "\\b{{fileName}}" + @".{0,2}\([\w\d\s./]+\)", - RegExRepFileName = true, - FileNameExtReplace = fileExtReplace, - ExcludedTags = new List() { "M4", "M5", "M4+A", "M4+B", "M5+A", "M5+B" }, - OutReplace = confReplace, - OutExcludeFileName = true - }; - if (fullLog) - { - // serializzo - string rawRule = JsonConvert.SerializeObject(currRule, Formatting.Indented); - Log.Trace($"Conf rule generato:{Environment.NewLine}{rawRule}"); - } - } - checkDone = dbController.CheckFileArchived(macchina.IdxMacchina, macchina.BasePath, numDayPre, "*.*", forceTag, currRule); - } - } - } - catch (Exception exc) - { - Log.Error($"Eccezione in updateMachineArchive{Environment.NewLine}{exc}{Environment.NewLine}{exc.InnerException}"); - } - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Info($"Effettuato update archivio file MACCHINA | last {numDayPre} days | {checkDone} checked | {ts.TotalMilliseconds} ms"); - - return await Task.FromResult(checkDone); - } - - #endregion Public Methods - } -} \ No newline at end of file diff --git a/MP.Land/Data/MessageService.cs b/MP.Land/Data/MessageService.cs index ce03b7b2..4f03d7ae 100644 --- a/MP.Land/Data/MessageService.cs +++ b/MP.Land/Data/MessageService.cs @@ -10,10 +10,10 @@ namespace MP.Land.Data { #region Private Fields - private SelectData _fileFilter = SelectData.Init(5, 15); private string _pageIcon; private string _pageName; private string _searchVal = ""; + private SelectData _selFilter = SelectData.Init(4, 15); private bool showSearch; #endregion Private Fields @@ -34,19 +34,6 @@ namespace MP.Land.Data #region Public Properties - public SelectData File_Filter - { - get => _fileFilter; - set - { - if (_fileFilter != value) - { - _fileFilter = value; - ReportFilter(); - } - } - } - public string PageIcon { get => _pageIcon; @@ -86,6 +73,19 @@ namespace MP.Land.Data } } + public SelectData SelFilter + { + get => _selFilter; + set + { + if (_selFilter != value) + { + _selFilter = value; + ReportFilter(); + } + } + } + public bool ShowSearch { get => showSearch; diff --git a/MP.Land/Data/SelectData.cs b/MP.Land/Data/SelectData.cs index c771a85f..a54fd4a3 100644 --- a/MP.Land/Data/SelectData.cs +++ b/MP.Land/Data/SelectData.cs @@ -44,7 +44,7 @@ namespace MP.Land.Data public bool OnlyMod { get; set; } = false; public bool OnlyNoTag { get; set; } = false; public int PageNum { get; set; } = 1; - public int PageSize { get; set; } = 10; + public int PageSize { get; set; } = 4; public string SearchVal { get; set; } = ""; public string Tag { get; set; } = ""; diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index d27dfb30..243ca7f5 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -3,7 +3,7 @@ net5.0 MP.Land - 1.1.2109.2020 + 1.1.2109.2117 diff --git a/MP.Land/Pages/About.razor b/MP.Land/Pages/About.razor index b0593084..893dd040 100644 --- a/MP.Land/Pages/About.razor +++ b/MP.Land/Pages/About.razor @@ -3,23 +3,37 @@ @inject MessageService AppMService -
-
+
+
-

@Titolo

-
-
-
-
- +
+
+
+

@Titolo

+
+
-
-

@Messaggio

-

MoonPro / MAPO sono una suite di applicazioni e dispositivi hw dedicati per l'IOT,l'industry 4.0 e la gestione automatizzata dei processi produttivi.

-

Per maggiori informazioni visita il link sul nostro sito.

+
+
+
+ +
+
+
+

@Messaggio

+

MoonPro / MAPO sono una suite di applicazioni e dispositivi hw dedicati per l'IOT,l'industry 4.0 e la gestione automatizzata dei processi produttivi.

+

Per maggiori informazioni visita il link sul nostro sito.

+
+
diff --git a/MP.Land/Pages/Contacts.razor b/MP.Land/Pages/Contacts.razor index 7a811d88..22c72416 100644 --- a/MP.Land/Pages/Contacts.razor +++ b/MP.Land/Pages/Contacts.razor @@ -3,8 +3,8 @@ @inject MessageService AppMService -
-
+
+
@@ -21,17 +21,16 @@
-
-
-
- -
-
-
-
-

@Messaggio

- +
+
+
+ +
+
+
+

@Messaggio

+

Sede Operativa

diff --git a/MP.Land/Pages/SysInfo.razor b/MP.Land/Pages/SysInfo.razor new file mode 100644 index 00000000..5b5c2c2a --- /dev/null +++ b/MP.Land/Pages/SysInfo.razor @@ -0,0 +1,161 @@ +@page "/SysInfo" +@using MP.AppAuth +@using MP.Land.Data +@using Microsoft.Extensions.Configuration + +@inject MessageService AppMService +@inject IConfiguration Configuration + +
+
+
+
+
+
+
+

@Titolo

+
+ +
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
Environment
+
+

@Environment

+
+
+
+
Main DB Conf
+
+

@DbNameExample

+
+
+
+
.net framework
+
+

@currHwSwInfo.runtimeImg

+
+
+
+
Main Assembly
+
+

@currHwSwInfo.mainAssembly

+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
Server Stats
+
+

+

@currHwSwInfo.ServerStats
+

+
+
+
+
IIS Stats
+
+

+

@currHwSwInfo.IISStats
+

+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
Elenco librerie
+ @currHwSwInfo.numLibraries +
+

+

@currHwSwInfo.librariesVers
+

+
+
+
+
+
+
+
+
+
+
+
+
+@code { + + // imposto i vari dati da mostrare a video senza indicare come bypassare... + protected string Titolo = "MAPO System Info"; + protected string Messaggio = "HW & SW details"; + protected HwSwInfo currHwSwInfo = HwSwInfo.man(System.Reflection.Assembly.GetExecutingAssembly()); + protected string DbNameExample + { + get + { + string answ = Configuration["ConnectionStrings:DefaultConnection"]; + if (answ.IndexOf(";User ID=") > 0) + { + answ = answ.Substring(0, answ.IndexOf(";User ID=")); + } + return answ; + } + } + protected string Environment + { + get + { + string answ = Configuration["Environment"]; + return answ; + } + } + + //string connStr = memLayer.ML.confReadString("DbConfConnectionString"); + //currHwSwInfo = currHwSwInfo; +} \ No newline at end of file diff --git a/MP.Land/Pages/UserQr.razor b/MP.Land/Pages/UserQr.razor index caf322d9..26899bab 100644 --- a/MP.Land/Pages/UserQr.razor +++ b/MP.Land/Pages/UserQr.razor @@ -25,4 +25,7 @@
}
+
\ No newline at end of file diff --git a/MP.Land/Pages/UserQr.razor.cs b/MP.Land/Pages/UserQr.razor.cs index 6e3041c7..9f88e4e6 100644 --- a/MP.Land/Pages/UserQr.razor.cs +++ b/MP.Land/Pages/UserQr.razor.cs @@ -9,11 +9,12 @@ using System.Threading.Tasks; namespace MP.Land.Pages { - public partial class UserQr + public partial class UserQr : IDisposable { #region Private Fields private List ListRecords; + private List SearchRecords; #endregion Private Fields @@ -29,8 +30,32 @@ namespace MP.Land.Pages [Inject] private IConfiguration Configuration { get; set; } + private int currPage + { + get + { + return AppMService.SelFilter.PageNum; + } + set + { + AppMService.SelFilter.PageNum = value; + } + } + private bool isLoading { get; set; } = false; + private int numRecord + { + get + { + return AppMService.SelFilter.PageSize; + } + set + { + AppMService.SelFilter.PageSize = value; + } + } + #endregion Private Properties #region Protected Properties @@ -53,27 +78,43 @@ namespace MP.Land.Pages #endregion Protected Properties - #region Protected Methods + #region Private Methods - protected override void OnInitialized() + private async void OnSeachUpdated() { - AppMService.ShowSearch = false; - AppMService.PageName = "User Card"; - AppMService.PageIcon = "fas fa-qrcode pr-2"; - //AppMService.EA_SearchUpdated += OnSeachUpdated; - //AppMService.EA_FilterUpdated += OnFilterUpdated; + ListRecords = null; + currPage = 1; + await Task.Delay(1); + await ReloadData(); } + #endregion Private Methods + + #region Protected Methods + protected override async Task OnInitializedAsync() { - await ReloadAllData(); + AppMService.ShowSearch = true; + AppMService.PageName = "User Card"; + AppMService.PageIcon = "fas fa-qrcode pr-2"; + await ReloadData(); + AppMService.EA_SearchUpdated += OnSeachUpdated; } - protected async Task ReloadAllData() + protected async Task PagerReloadNum(int newNum) { - isLoading = true; - //MacList = await DataService.MacchineGetAll(); + ListRecords = null; + numRecord = newNum; await ReloadData(); + isLoading = false; + } + + protected async Task PagerReloadPage(int newNum) + { + ListRecords = null; + currPage = newNum; + await ReloadData(); + isLoading = false; } protected async Task ReloadData() @@ -81,9 +122,12 @@ namespace MP.Land.Pages isLoading = true; // importante altrimenti NON mostra update UI await Task.Delay(1); - ListRecords = await DataService.AnagOperList(); - totalCount = ListRecords.Count(); + SearchRecords = await DataService.AnagOperList(AppMService.SearchVal); + ListRecords = SearchRecords.Skip((currPage - 1) * numRecord).Take(numRecord).ToList(); + totalCount = SearchRecords.Count(); await Task.Delay(1); + isLoading = false; + StateHasChanged(); } protected MarkupString traduci(string lemma) @@ -97,5 +141,14 @@ namespace MP.Land.Pages } #endregion Protected Methods + + #region Public Methods + + public void Dispose() + { + AppMService.EA_SearchUpdated -= OnSeachUpdated; + } + + #endregion Public Methods } } \ No newline at end of file diff --git a/MP.Land/Pages/_Host.cshtml b/MP.Land/Pages/_Host.cshtml index 51a0d53f..c7cb0e9b 100644 --- a/MP.Land/Pages/_Host.cshtml +++ b/MP.Land/Pages/_Host.cshtml @@ -23,7 +23,7 @@ - +
@@ -46,18 +46,24 @@