diff --git a/MP.AppAuth/Controllers/MPController .cs b/MP.AppAuth/Controllers/MPController .cs index ef49774c..ad8fbaea 100644 --- a/MP.AppAuth/Controllers/MPController .cs +++ b/MP.AppAuth/Controllers/MPController .cs @@ -29,22 +29,7 @@ namespace MP.AppAuth.Controllers #region Public Methods /// - /// Elenco Record x AnagKeyValue - /// - /// - public List AnagKeyValuesGetAll() - { - List dbResult = new List(); - using (MoonProContext localDbCtx = new MoonProContext(_configuration)) - { - dbResult = localDbCtx - .DbSetAnagKeyValues - .ToList(); - } - return dbResult; - } - /// - /// Elenco Record x AnagKeyValue + /// Delete Record AnagKeyValue /// /// public bool AnagKeyValuesDelete(string NomeVar) @@ -65,6 +50,23 @@ namespace MP.AppAuth.Controllers } return fatto; } + + /// + /// Elenco Record x AnagKeyValue + /// + /// + public List AnagKeyValuesGetAll() + { + List dbResult = new List(); + using (MoonProContext localDbCtx = new MoonProContext(_configuration)) + { + dbResult = localDbCtx + .DbSetAnagKeyValues + .ToList(); + } + return dbResult; + } + /// /// Upsert AnagKeyValue /// @@ -96,6 +98,29 @@ namespace MP.AppAuth.Controllers return fatto; } + /// + /// Delete Record Config + /// + /// + public bool ConfigDelete(string Chiave) + { + bool fatto = false; + using (MoonProContext localDbCtx = new MoonProContext(_configuration)) + { + var rec2del = localDbCtx + .DbSetConfig + .Where(x => x.Chiave == Chiave) + .FirstOrDefault(); + if (rec2del != null) + { + localDbCtx.Remove(rec2del); + var res = localDbCtx.SaveChanges(); + fatto = res > 0; + } + } + return fatto; + } + /// /// Elenco Record x Config /// @@ -112,6 +137,36 @@ namespace MP.AppAuth.Controllers return dbResult; } + /// + /// Upsert Config + /// + /// + public bool ConfigUpsert(ConfigModel newRec) + { + bool fatto = false; + using (MoonProContext localDbCtx = new MoonProContext(_configuration)) + { + var currRec = localDbCtx + .DbSetConfig + .Where(x => x.Chiave == newRec.Chiave) + .FirstOrDefault(); + if (currRec != null) + { + currRec.Valore = newRec.Valore; + currRec.ValoreStd = newRec.ValoreStd; + currRec.Note = newRec.Note; + localDbCtx.Entry(currRec).State = EntityState.Modified; + } + else + { + localDbCtx.DbSetConfig.Add(newRec); + } + var res = localDbCtx.SaveChanges(); + fatto = res > 0; + } + return fatto; + } + public void Dispose() { if (dbController != null) @@ -121,6 +176,29 @@ namespace MP.AppAuth.Controllers } } + /// + /// Delete Record Vocabolario + /// + /// + public bool VocabolarioDelete(VocabolarioModel currRec) + { + bool fatto = false; + using (MoonProContext localDbCtx = new MoonProContext(_configuration)) + { + var rec2del = localDbCtx + .DbSetVocabolario + .Where(x => x.Lingua == currRec.Lingua && x.Lemma == currRec.Lemma) + .FirstOrDefault(); + if (rec2del != null) + { + localDbCtx.Remove(rec2del); + var res = localDbCtx.SaveChanges(); + fatto = res > 0; + } + } + return fatto; + } + /// /// Elenco Record x VocabolarioModel /// @@ -137,6 +215,34 @@ namespace MP.AppAuth.Controllers return dbResult; } + /// + /// Upsert Vocabolario + /// + /// + public bool VocabolarioUpsert(VocabolarioModel newRec) + { + bool fatto = false; + using (MoonProContext localDbCtx = new MoonProContext(_configuration)) + { + var currRec = localDbCtx + .DbSetVocabolario + .Where(x => x.Lingua == newRec.Lingua && x.Lemma == newRec.Lemma) + .FirstOrDefault(); + if (currRec != null) + { + currRec.Traduzione = newRec.Traduzione; + localDbCtx.Entry(currRec).State = EntityState.Modified; + } + else + { + localDbCtx.DbSetVocabolario.Add(newRec); + } + var res = localDbCtx.SaveChanges(); + fatto = res > 0; + } + return fatto; + } + #endregion Public Methods #region Private Fields diff --git a/MP.AppAuth/DTO/CompConfig.cs b/MP.AppAuth/DTO/CompConfig.cs new file mode 100644 index 00000000..76b69575 --- /dev/null +++ b/MP.AppAuth/DTO/CompConfig.cs @@ -0,0 +1,31 @@ +using MP.AppAuth.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MP.AppAuth.DTO +{ + public class CompConfig + { + public int Idx { get; set; } = 0; + public string NomeVar { get; set; } = ""; + public ConfigModel? Source { get; set; } = null; + public ConfigModel? Dest { get; set; } = null; + + public bool IsEqual + { + get => Source != null && Dest != null && Source.Equals(Dest); + } + + public bool SrcExist + { + get => Source != null; + } + public bool DestExist + { + get => Dest != null; + } + } +} diff --git a/MP.AppAuth/DTO/CompVocabolario.cs b/MP.AppAuth/DTO/CompVocabolario.cs new file mode 100644 index 00000000..c2b0698b --- /dev/null +++ b/MP.AppAuth/DTO/CompVocabolario.cs @@ -0,0 +1,31 @@ +using MP.AppAuth.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MP.AppAuth.DTO +{ + public class CompVocabolario + { + public int Idx { get; set; } = 0; + public string NomeVar { get; set; } = ""; + public VocabolarioModel? Source { get; set; } = null; + public VocabolarioModel? Dest { get; set; } = null; + + public bool IsEqual + { + get => Source != null && Dest != null && Source.Equals(Dest); + } + + public bool SrcExist + { + get => Source != null; + } + public bool DestExist + { + get => Dest != null; + } + } +} diff --git a/MP.AppAuth/Models/AnagKeyValueModel.cs b/MP.AppAuth/Models/AnagKeyValueModel.cs index 2142de28..efc37e43 100644 --- a/MP.AppAuth/Models/AnagKeyValueModel.cs +++ b/MP.AppAuth/Models/AnagKeyValueModel.cs @@ -29,9 +29,6 @@ namespace MP.AppAuth.Models [Column("descrizione")] public string Descrizione { get; set; } - - #endregion Public Properties - public override bool Equals(object obj) { if (!(obj is AnagKeyValueModel item)) @@ -55,5 +52,8 @@ namespace MP.AppAuth.Models { return base.GetHashCode(); } + + #endregion Public Properties + } } \ No newline at end of file diff --git a/MP.AppAuth/Models/ConfigModel.cs b/MP.AppAuth/Models/ConfigModel.cs index a5cc1553..0d2d07aa 100644 --- a/MP.AppAuth/Models/ConfigModel.cs +++ b/MP.AppAuth/Models/ConfigModel.cs @@ -2,11 +2,16 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations; +using System.Data.SqlTypes; #nullable disable namespace MP.AppAuth.Models { + // + // This is here so CodeMaid doesn't reorganize this document + // + [Table("Config")] public partial class ConfigModel { #region Public Properties @@ -23,6 +28,28 @@ namespace MP.AppAuth.Models [Column("note")] public string Note { get; set; } = ""; + public override bool Equals(object obj) + { + if (!(obj is ConfigModel item)) + return false; + + if (Chiave != item.Chiave) + return false; + if (Valore != item.Valore) + return false; + if (ValoreStd != item.ValoreStd) + return false; + if (Note != item.Note) + return false; + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + #endregion Public Properties } } \ No newline at end of file diff --git a/MP.AppAuth/Models/VocabolarioModel.cs b/MP.AppAuth/Models/VocabolarioModel.cs index 18dd28da..5a98df48 100644 --- a/MP.AppAuth/Models/VocabolarioModel.cs +++ b/MP.AppAuth/Models/VocabolarioModel.cs @@ -1,12 +1,16 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; +using System.Data.SqlTypes; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MP.AppAuth.Models { + // + // This is here so CodeMaid doesn't reorganize this document + // [Table("Vocabolario")] public partial class VocabolarioModel { @@ -16,6 +20,26 @@ namespace MP.AppAuth.Models public string Lingua { get; set; } = ""; public string Traduzione { get; set; } = ""; + public override bool Equals(object obj) + { + if (!(obj is VocabolarioModel item)) + return false; + + if (Lemma != item.Lemma) + return false; + if (Lingua != item.Lingua) + return false; + if (Traduzione != item.Traduzione) + return false; + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + #endregion Public Properties } } \ No newline at end of file diff --git a/MP.Land/Components/CmpCompType.razor.cs b/MP.Land/Components/CmpCompType.razor.cs index dd5e1124..92802d29 100644 --- a/MP.Land/Components/CmpCompType.razor.cs +++ b/MP.Land/Components/CmpCompType.razor.cs @@ -18,9 +18,9 @@ namespace MP.Land.Components { #region Public Properties + public bool Diff { get; set; } = true; public bool Dx { get; set; } = true; public bool Equal { get; set; } = true; - public bool Diff { get; set; } = true; public bool Sx { get; set; } = true; #endregion Public Properties @@ -30,6 +30,11 @@ namespace MP.Land.Components #region Protected Properties + protected string cssDiff + { + get => CurrDisp.Diff ? "btn-primary" : "btn-secondary"; + } + protected string cssDx { get => CurrDisp.Dx ? "btn-danger" : "btn-secondary"; @@ -39,10 +44,6 @@ namespace MP.Land.Components { get => CurrDisp.Equal ? "btn-info" : "btn-secondary"; } - protected string cssDiff - { - get => CurrDisp.Diff ? "btn-primary" : "btn-secondary"; - } protected string cssSx { @@ -60,6 +61,12 @@ namespace MP.Land.Components CurrDisp = new Display(); } + protected async Task ToggleDiff() + { + CurrDisp.Diff = !CurrDisp.Diff; + await EC_filtUpd.InvokeAsync(CurrDisp); + } + protected async Task ToggleDx() { CurrDisp.Dx = !CurrDisp.Dx; @@ -72,13 +79,6 @@ namespace MP.Land.Components await EC_filtUpd.InvokeAsync(CurrDisp); } - protected async Task ToggleDiff() - { - CurrDisp.Diff = !CurrDisp.Diff; - await EC_filtUpd.InvokeAsync(CurrDisp); - } - - protected async Task ToggleSx() { CurrDisp.Sx = !CurrDisp.Sx; diff --git a/MP.Land/Components/CompareAnagKeyVal.razor b/MP.Land/Components/CompareAnagKeyVal.razor index b75147ed..a5956899 100644 --- a/MP.Land/Components/CompareAnagKeyVal.razor +++ b/MP.Land/Components/CompareAnagKeyVal.razor @@ -24,13 +24,13 @@ - + - + @@ -98,21 +98,6 @@ { } - @* else - { - if (!item.DestExist) - { - - } - else if (!item.SrcExist) - { - - } - else - { - - } - } *@ } diff --git a/MP.Land/Components/CompareAnagKeyVal.razor.cs b/MP.Land/Components/CompareAnagKeyVal.razor.cs index bf492783..a4ed954f 100644 --- a/MP.Land/Components/CompareAnagKeyVal.razor.cs +++ b/MP.Land/Components/CompareAnagKeyVal.razor.cs @@ -42,6 +42,8 @@ namespace MP.Land.Components #region Protected Properties + protected CmpCompType.Display currFilt { get; set; } = new CmpCompType.Display(); + [Inject] protected AppAuthService DataService { get; set; } @@ -56,6 +58,22 @@ namespace MP.Land.Components #region Protected Methods + protected async Task AddLocal(CompAnagKeyVal currItem) + { + if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler aggiungere il record?")) + return; + + bool fatto = false; + if (currItem != null) + { + fatto = await DataService.AnagKeyValAdd(currItem.Source); + } + if (fatto) + { + await ReqReload(); + } + } + protected string genClass(CompAnagKeyVal currItem) { string answ = currItem.IsEqual ? "text-dark" : currItem.SrcExist && currItem.DestExist ? "text-warning" : currItem.SrcExist ? "text-success" : "text-danger"; @@ -68,6 +86,110 @@ namespace MP.Land.Components ForceReload(); } + protected async Task RemLocal(CompAnagKeyVal currItem) + { + if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler eliminare il record?")) + return; + + bool fatto = false; + if (currItem != null) + { + fatto = await DataService.AnagKeyValDelete(currItem.Dest.NomeVar); + } + if (fatto) + { + await ReqReload(); + } + } + + /// + /// Report evento richiesta confronto AnagKeyVal + /// + protected async Task ReqCompare() + { + await EC_reqAct.InvokeAsync("AnagKeyVal"); + } + + /// + /// Report evento richiesta confronto AnagKeyVal + /// + protected async Task ReqReload() + { + await EC_reqReload.InvokeAsync("AnagKeyVal"); + } + + /// + /// 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; + //isLoading = true; + //ListCompare = null; + await InvokeAsync(UpdPaging); + await Task.Delay(1); + isLoading = false; + } + + protected async Task SetPage(int newNum) + { + isLoading = true; + //ListCompare = null; + //await Task.Delay(1); + ////StateHasChanged(); + currPage = newNum; + //await Task.Delay(1); + //UpdPaging(); + //await Task.Delay(1); + await InvokeAsync(UpdPaging); + await Task.Delay(1); + isLoading = false; + } + + protected async Task UpdLocal(CompAnagKeyVal currItem) + { + if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler aggiungere il record?")) + return; + + bool fatto = false; + if (currItem != null) + { + fatto = await DataService.AnagKeyValUpd(currItem.Source); + } + if (fatto) + { + await ReqReload(); + } + } + + #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 = ListAnagKeyValLoc != null ? ListAnagKeyValLoc.Count : 0; @@ -160,124 +282,6 @@ namespace MP.Land.Components UpdPaging(); } - protected void SetFilter(CmpCompType.Display filtDisplay) - { - currFilt = filtDisplay; - ForceReload(); - } - - protected CmpCompType.Display currFilt { get; set; } = new CmpCompType.Display(); - - protected async Task RemLocal(CompAnagKeyVal currItem) - { - if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler eliminare il record?")) - return; - - bool fatto = false; - if (currItem != null) - { - fatto = await DataService.AnagKeyValDelete(currItem.Dest.NomeVar); - } - if (fatto) - { - await ReqReload(); - } - } - - protected async Task AddLocal(CompAnagKeyVal currItem) - { - if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler aggiungere il record?")) - return; - - bool fatto = false; - if (currItem != null) - { - fatto = await DataService.AnagKeyValAdd(currItem.Source); - } - if (fatto) - { - await ReqReload(); - } - } - protected async Task UpdLocal(CompAnagKeyVal currItem) - { - if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler aggiungere il record?")) - return; - - bool fatto = false; - if (currItem != null) - { - fatto = await DataService.AnagKeyValUpd(currItem.Source); - } - if (fatto) - { - await ReqReload(); - } - } - - /// - /// Report evento richiesta confronto AnagKeyVal - /// - protected async Task ReqCompare() - { - await EC_reqAct.InvokeAsync("AnagKeyVal"); - } - - /// - /// Report evento richiesta confronto AnagKeyVal - /// - protected async Task ReqReload() - { - await EC_reqReload.InvokeAsync("AnagKeyVal"); - } - - /// - /// Report evento richiesta reset confronto - /// - protected async Task ResetCompare() - { - await EC_reqAct.InvokeAsync(""); - } - - protected async Task SetNumRec(int newNum) - { - numRecord = newNum; - currPage = 1; - //isLoading = true; - //ListCompare = null; - await InvokeAsync(UpdPaging); - await Task.Delay(1); - isLoading = false; - } - - protected async Task SetPage(int newNum) - { - isLoading = true; - //ListCompare = null; - //await Task.Delay(1); - ////StateHasChanged(); - currPage = newNum; - //await Task.Delay(1); - //UpdPaging(); - //await Task.Delay(1); - 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 UpdPaging() { ListCompare = ListCompareAll.Skip((currPage - 1) * numRecord).Take(numRecord).ToList(); diff --git a/MP.Land/Components/CompareConfig.razor b/MP.Land/Components/CompareConfig.razor index f293f8dd..f99df2fc 100644 --- a/MP.Land/Components/CompareConfig.razor +++ b/MP.Land/Components/CompareConfig.razor @@ -1,23 +1,127 @@ -
    -
  • - Tabella Config -
  • -
  • -
    -
    Remote #
    -
    Record
    -
    Local #
    +@if (ShowDetail) +{ +
    +
    +
    +
    + Tabella AnagKeyVal - Confronto dati +
    +
    + +
    +
    + +
    +
    +
    + @if (isLoading) + { + + } + else + { +
Rem Nome Val. Int Val. Float Val. String DescrizioneActLoc
+ + + + + + + + + + + + @foreach (var item in ListCompare) + { + + + + + + + + + } + +
RemChiaveValoreValore StdNoteLoc
+ @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 #
    +
    -
  • -
  • -
    -
    @numRem
    -
    -
    @numLoc
    -
    -
  • -
  • - -
  • -
+ +
  • +
    +
    @numRem
    +
    +
    @numLoc
    +
    +
  • +
  • + +
  • + +} \ 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