-
Remote #
-
Record
-
Local #
+@if (ShowDetail)
+{
+
+
+
+ @if (isLoading)
+ {
+
+ }
+ else
+ {
+
+
+
+ | Rem |
+ Chiave |
+ Valore |
+ Valore Std |
+ Note |
+ Loc |
+
+
+
+ @foreach (var item in ListCompare)
+ {
+
+ |
+ @if (!item.IsEqual)
+ {
+ if (!item.DestExist)
+ {
+
+ }
+ else if (item.SrcExist)
+ {
+
+ }
+ }
+ |
+
+ @item.NomeVar
+ |
+
+ @if (item.SrcExist)
+ {
+ @item.Source.Valore
+ }
+ @if (!item.IsEqual && item.DestExist)
+ {
+ @item.Dest.Valore
+ }
+ |
+
+ @if (item.SrcExist)
+ {
+ @item.Source.ValoreStd
+ }
+ @if (!item.IsEqual && item.DestExist)
+ {
+ @item.Dest.ValoreStd
+ }
+ |
+
+ @if (item.SrcExist)
+ {
+ @item.Source.Note
+ }
+ @if (!item.IsEqual && item.DestExist)
+ {
+ @item.Dest.Note
+ }
+ |
+
+ @if (item.DestExist)
+ {
+
+ }
+ |
+
+ }
+
+
+ }
+
+
+
+}
+else
+{
+
+ -
+ Tabella Config
+
+ -
+
+
Remote #
+
Record
+
Local #
+
-
- -
-
-
- -
-
-
-
+
+
+
+
+
+
+
+
+}
\ No newline at end of file
diff --git a/MP.Land/Components/CompareConfig.razor.cs b/MP.Land/Components/CompareConfig.razor.cs
index 2efa8026..d700bd39 100644
--- a/MP.Land/Components/CompareConfig.razor.cs
+++ b/MP.Land/Components/CompareConfig.razor.cs
@@ -1,6 +1,10 @@
using Microsoft.AspNetCore.Components;
+using Microsoft.JSInterop;
+using MP.AppAuth.DTO;
using MP.AppAuth.Models;
+using MP.Land.Data;
using System.Collections.Generic;
+using System.Linq;
using System.Threading.Tasks;
namespace MP.Land.Components
@@ -12,6 +16,9 @@ namespace MP.Land.Components
[Parameter]
public EventCallback
EC_reqAct { get; set; }
+ [Parameter]
+ public EventCallback EC_reqReload { get; set; }
+
[Parameter]
public List ListConfigLoc { get; set; } = new List();
@@ -23,8 +30,23 @@ namespace MP.Land.Components
#endregion Public Properties
+ #region Protected Fields
+
+ protected List ListCompare = new List();
+ protected List ListCompareAll = new List();
+
+ #endregion Protected Fields
+
#region Protected Properties
+ protected CmpCompType.Display currFilt { get; set; } = new CmpCompType.Display();
+
+ [Inject]
+ protected AppAuthService DataService { get; set; }
+
+ [Inject]
+ protected IJSRuntime JSRuntime { get; set; } = null!;
+
protected int numLoc { get; set; } = 0;
protected int numRem { get; set; } = 0;
@@ -33,10 +55,66 @@ namespace MP.Land.Components
#region Protected Methods
+ protected string genClass(CompConfig currItem)
+ {
+ string answ = currItem.IsEqual ? "text-dark" : currItem.SrcExist && currItem.DestExist ? "text-warning" : currItem.SrcExist ? "text-success" : "text-danger";
+ //string answ = currItem.IsEqual ? "far fa-thumbs-up text-success" : "far fa-thumbs-down text-danger";
+ return answ;
+ }
+
+ protected async Task LocalAdd(CompConfig currItem)
+ {
+ if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler aggiungere il record?"))
+ return;
+
+ bool fatto = false;
+ if (currItem != null)
+ {
+ // modifico Source: valore = valStd...
+ currItem.Source.Valore = currItem.Source.ValoreStd;
+ fatto = await DataService.ConfigAdd(currItem.Source);
+ }
+ if (fatto)
+ {
+ await ReqReload();
+ }
+ }
+
+ protected async Task LocalDelete(CompConfig currItem)
+ {
+ if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler eliminare il record?"))
+ return;
+
+ bool fatto = false;
+ if (currItem != null)
+ {
+ fatto = await DataService.ConfigDelete(currItem.Dest.Chiave);
+ }
+ if (fatto)
+ {
+ await ReqReload();
+ }
+ }
+
+ protected async Task LocalUpdate(CompConfig currItem)
+ {
+ if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler aggiungere il record?"))
+ return;
+
+ bool fatto = false;
+ if (currItem != null)
+ {
+ fatto = await DataService.ConfigUpd(currItem.Source);
+ }
+ if (fatto)
+ {
+ await ReqReload();
+ }
+ }
+
protected override void OnParametersSet()
{
- numLoc = ListConfigLoc != null ? ListConfigLoc.Count : 0;
- numRem = ListConfigRem != null ? ListConfigRem.Count : 0;
+ ForceReload();
}
///
@@ -47,6 +125,159 @@ namespace MP.Land.Components
await EC_reqAct.InvokeAsync("Config");
}
+ ///
+ /// Report evento richiesta confronto AnagKeyVal
+ ///
+ protected async Task ReqReload()
+ {
+ await EC_reqReload.InvokeAsync("Config");
+ }
+
+ ///
+ /// Report evento richiesta reset confronto
+ ///
+ protected async Task ResetCompare()
+ {
+ await EC_reqAct.InvokeAsync("");
+ }
+
+ protected void SetFilter(CmpCompType.Display filtDisplay)
+ {
+ currFilt = filtDisplay;
+ ForceReload();
+ }
+
+ protected async Task SetNumRec(int newNum)
+ {
+ numRecord = newNum;
+ currPage = 1;
+ await InvokeAsync(UpdPaging);
+ await Task.Delay(1);
+ isLoading = false;
+ }
+
+ protected async Task SetPage(int newNum)
+ {
+ isLoading = true;
+ currPage = newNum;
+ await InvokeAsync(UpdPaging);
+ await Task.Delay(1);
+ isLoading = false;
+ }
+
#endregion Protected Methods
+
+ #region Private Properties
+
+ private int currPage { get; set; } = 1;
+
+ private bool isLoading { get; set; } = false;
+
+ private int numRecord { get; set; } = 10;
+
+ private int totalCount { get; set; } = 0;
+
+ #endregion Private Properties
+
+ #region Private Methods
+
+ private void ForceReload()
+ {
+ numLoc = ListConfigLoc != null ? ListConfigLoc.Count : 0;
+ numRem = ListConfigRem != null ? ListConfigRem.Count : 0;
+ // predispongo lista comparazione...
+ ListCompareAll = new List();
+ int cIdx = 0;
+ // filtro EQUAL
+ if (currFilt.Equal)
+ {
+ foreach (var item in ListConfigRem)
+ {
+ CompConfig newRec = new CompConfig()
+ {
+ Idx = cIdx++,
+ NomeVar = item.Chiave,
+ Source = item,
+ Dest = ListConfigLoc.Find(x => x.Chiave == item.Chiave)
+ };
+ if (newRec.IsEqual)
+ {
+ ListCompareAll.Add(newRec);
+ }
+ }
+ }
+
+ // ciclo valori src...
+ if (currFilt.Diff)
+ {
+ foreach (var item in ListConfigRem)
+ {
+ CompConfig newRec = new CompConfig()
+ {
+ Idx = cIdx++,
+ NomeVar = item.Chiave,
+ Source = item,
+ Dest = ListConfigLoc.Find(x => x.Chiave == item.Chiave)
+ };
+ if (!newRec.IsEqual && currFilt.Diff && newRec.SrcExist && newRec.DestExist)
+ {
+ ListCompareAll.Add(newRec);
+ }
+ }
+ }
+
+ if (currFilt.Sx)
+ {
+ foreach (var item in ListConfigRem)
+ {
+ // se non c'è...
+ if (ListConfigLoc.Where(x => x.Chiave == item.Chiave).Count() == 0)
+ {
+ CompConfig newRec = new CompConfig()
+ {
+ Idx = cIdx++,
+ NomeVar = item.Chiave,
+ Source = item,
+ Dest = ListConfigLoc.Find(x => x.Chiave == item.Chiave)
+ };
+ if (!newRec.IsEqual)
+ {
+ ListCompareAll.Add(newRec);
+ }
+ }
+ }
+ }
+ if (currFilt.Dx)
+ {
+ // cerco eventuali record SOLO locali...
+ foreach (var item in ListConfigLoc)
+ {
+ // se non c'è...
+ if (ListConfigRem.Where(x => x.Chiave == item.Chiave).Count() == 0)
+ {
+ CompConfig newRec = new CompConfig()
+ {
+ Idx = cIdx++,
+ NomeVar = item.Chiave,
+ Source = null,
+ Dest = item
+ };
+ ListCompareAll.Add(newRec);
+ }
+ }
+ }
+ totalCount = ListCompareAll.Count;
+ // riordino...
+ ListCompareAll = ListCompareAll.OrderBy(x => x.NomeVar).ToList();
+ // ciclo eventuali record locali rimasti
+ UpdPaging();
+ }
+
+ private void UpdPaging()
+ {
+ ListCompare = ListCompareAll.Skip((currPage - 1) * numRecord).Take(numRecord).ToList();
+ }
+
+ #endregion Private Methods
}
}
\ No newline at end of file
diff --git a/MP.Land/Data/AppAuthService.cs b/MP.Land/Data/AppAuthService.cs
index e85dae56..a4c803b7 100644
--- a/MP.Land/Data/AppAuthService.cs
+++ b/MP.Land/Data/AppAuthService.cs
@@ -75,16 +75,16 @@ namespace MP.Land.Data
return await Task.FromResult(dbResult);
}
- public async Task> AnagKeyValList()
+ public async Task AnagKeyValAdd(AnagKeyValueModel currRec)
{
- List dbResult = new List();
+ bool answ = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- dbResult = MpDbController.AnagKeyValuesGetAll();
+ answ = MpDbController.AnagKeyValuesUpsert(currRec);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
- Log.Trace($"Effettuata lettura da DB per AnagKeyValList: {ts.TotalMilliseconds} ms");
- return await Task.FromResult(dbResult);
+ Log.Trace($"AnagKeyValAdd | Aggiunto rec | NomeVar: {currRec.NomeVar} | durata: {ts.TotalMilliseconds} ms");
+ return await Task.FromResult(answ);
}
public async Task AnagKeyValDelete(string NomeVar)
@@ -99,16 +99,16 @@ namespace MP.Land.Data
return await Task.FromResult(answ);
}
- public async Task AnagKeyValAdd(AnagKeyValueModel currRec)
+ public async Task> AnagKeyValList()
{
- bool answ = false;
+ List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- answ = MpDbController.AnagKeyValuesUpsert(currRec);
+ dbResult = MpDbController.AnagKeyValuesGetAll();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
- Log.Trace($"AnagKeyValAdd | Aggiunto rec | NomeVar: {currRec.NomeVar} | durata: {ts.TotalMilliseconds} ms");
- return await Task.FromResult(answ);
+ Log.Trace($"Effettuata lettura da DB per AnagKeyValList: {ts.TotalMilliseconds} ms");
+ return await Task.FromResult(dbResult);
}
public async Task AnagKeyValUpd(AnagKeyValueModel currRec)
@@ -152,6 +152,30 @@ namespace MP.Land.Data
return await Task.FromResult(dbResult);
}
+ public async Task ConfigAdd(ConfigModel currRec)
+ {
+ bool answ = false;
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ answ = MpDbController.ConfigUpsert(currRec);
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Trace($"ConfigAdd | Aggiunto rec | Chiave: {currRec.Chiave} | durata: {ts.TotalMilliseconds} ms");
+ return await Task.FromResult(answ);
+ }
+
+ public async Task ConfigDelete(string Chiave)
+ {
+ bool answ = false;
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ answ = MpDbController.ConfigDelete(Chiave);
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Trace($"ConfigDelete | Effettuata cancellazione | Chiave: {Chiave} | durata: {ts.TotalMilliseconds} ms");
+ return await Task.FromResult(answ);
+ }
+
public async Task> ConfigList()
{
List dbResult = new List();
@@ -164,6 +188,18 @@ namespace MP.Land.Data
return await Task.FromResult(dbResult);
}
+ public async Task ConfigUpd(ConfigModel currRec)
+ {
+ bool answ = false;
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ answ = MpDbController.ConfigUpsert(currRec);
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Trace($"ConfigUpd | Effettuata modifica | Chiave: {currRec.Chiave} | durata: {ts.TotalMilliseconds} ms");
+ return await Task.FromResult(answ);
+ }
+
public void Dispose()
{
// Clear database controller
@@ -205,6 +241,30 @@ namespace MP.Land.Data
return await Task.FromResult(dbResult);
}
+ public async Task VocabolarioAdd(VocabolarioModel currRec)
+ {
+ bool answ = false;
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ answ = MpDbController.VocabolarioUpsert(currRec);
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Trace($"VocabolarioAdd | Aggiunto rec | lingua: {currRec.Lingua} | lemma: {currRec.Lemma} | durata: {ts.TotalMilliseconds} ms");
+ return await Task.FromResult(answ);
+ }
+
+ public async Task VocabolarioDelete(VocabolarioModel currRec)
+ {
+ bool answ = false;
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ answ = MpDbController.VocabolarioDelete(currRec);
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Trace($"VocabolarioDelete | Effettuata cancellazione | lingua: {currRec.Lingua} | lemma: {currRec.Lemma} | durata: {ts.TotalMilliseconds} ms");
+ return await Task.FromResult(answ);
+ }
+
public async Task> VocabolarioList()
{
List dbResult = new List();
@@ -217,6 +277,18 @@ namespace MP.Land.Data
return await Task.FromResult(dbResult);
}
+ public async Task VocabolarioUpd(VocabolarioModel currRec)
+ {
+ bool answ = false;
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ answ = MpDbController.VocabolarioUpsert(currRec);
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Trace($"VocabolarioUpd | Effettuata modifica | lingua: {currRec.Lingua} | lemma: {currRec.Lemma} | durata: {ts.TotalMilliseconds} ms");
+ return await Task.FromResult(answ);
+ }
+
#endregion Public Methods
#region Protected Methods
diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj
index b6b84ef3..dfc5b6ac 100644
--- a/MP.Land/MP.Land.csproj
+++ b/MP.Land/MP.Land.csproj
@@ -3,7 +3,7 @@
net6.0
MP.Land
- 6.16.2407.2219
+ 6.16.2407.2220
diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html
index e5506560..6293f49c 100644
--- a/MP.Land/Resources/ChangeLog.html
+++ b/MP.Land/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo Tablet MAPO - DotNet6
- Versione: 6.16.2407.2219
+ Versione: 6.16.2407.2220
Note di rilascio:
diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt
index 53adf15e..3ed3596a 100644
--- a/MP.Land/Resources/VersNum.txt
+++ b/MP.Land/Resources/VersNum.txt
@@ -1 +1 @@
-6.16.2407.2219
+6.16.2407.2220
diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml
index 8c0610fb..8f92a788 100644
--- a/MP.Land/Resources/manifest.xml
+++ b/MP.Land/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 6.16.2407.2219
+ 6.16.2407.2220
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