From 895337468dae3ca8aa397e8da9cbd9d9be021b8c Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 26 Apr 2023 13:01:24 +0200 Subject: [PATCH 1/4] Spostato su BaseParamList --- WebDoorCreator.UI.sln | 2 +- .../Components/DoorDef/BaseParamList.razor | 16 +++++++ .../Components/DoorDef/BaseParamList.razor.cs | 41 ++++++++++++++++ .../Components/DoorDef/DoorDefSizingSI.razor | 2 +- WebDoorCreator.UI/Data/WDCUserService.cs | 2 + WebDoorCreator.UI/Pages/DoorDefinition.razor | 23 ++++----- .../Pages/DoorDefinition.razor.cs | 48 ++++++++++++------- WebDoorCreator.UI/temp/Conf.yaml | 24 ++-------- 8 files changed, 105 insertions(+), 53 deletions(-) create mode 100644 WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor create mode 100644 WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs diff --git a/WebDoorCreator.UI.sln b/WebDoorCreator.UI.sln index 56c570c..4650908 100644 --- a/WebDoorCreator.UI.sln +++ b/WebDoorCreator.UI.sln @@ -9,7 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebDoorCreator.Core", "WebD EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebDoorCreator.Data", "WebDoorCreator.Data\WebDoorCreator.Data.csproj", "{26466C0D-8946-466B-A38C-C1A9603DA2DC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebDoorCreator.API", "WebDoorCreator.API\WebDoorCreator.API.csproj", "{2DFE8045-2F56-43E2-9D2F-1180EF7AD721}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebDoorCreator.API", "WebDoorCreator.API\WebDoorCreator.API.csproj", "{2DFE8045-2F56-43E2-9D2F-1180EF7AD721}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor b/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor new file mode 100644 index 0000000..088c155 --- /dev/null +++ b/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor @@ -0,0 +1,16 @@ +@if (CurrBaseDoorOp == null) +{ + +} +else +{ + int numIdx = 1; + @foreach (var item in CurrBaseDoorOp) + { +
+

record @(numIdx++)

+ +
+
+ } +} \ No newline at end of file diff --git a/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs b/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs new file mode 100644 index 0000000..b39dd9f --- /dev/null +++ b/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using WebDoorCreator.UI; +using WebDoorCreator.UI.Components; +using WebDoorCreator.UI.Components.Buttons; +using WebDoorCreator.UI.Components.CompMan; +using WebDoorCreator.UI.Components.DoorMan; +using WebDoorCreator.UI.Components.DoorDef; +using WebDoorCreator.UI.Components.Gen; +using WebDoorCreator.UI.Components.Order; +using WebDoorCreator.UI.Components.Users; +using WebDoorCreator.UI.Components.Hardware; +using WebDoorCreator.UI.Shared; +using WebDoorCreator.Data.DbModels; + +namespace WebDoorCreator.UI.Components.DoorDef +{ + public partial class BaseParamList + { + /// + /// Elenco parametri di base + /// + [Parameter] + public List? CurrBaseDoorOp { get; set; } = null; + + + protected string userLang { get; set; } = "EN"; + + } +} \ No newline at end of file diff --git a/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor b/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor index ff96ed2..f51303f 100644 --- a/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor +++ b/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor @@ -1,6 +1,6 @@ @if (currVal == null) { - + } else { diff --git a/WebDoorCreator.UI/Data/WDCUserService.cs b/WebDoorCreator.UI/Data/WDCUserService.cs index 1af9414..58690c1 100644 --- a/WebDoorCreator.UI/Data/WDCUserService.cs +++ b/WebDoorCreator.UI/Data/WDCUserService.cs @@ -19,6 +19,8 @@ #region Public Properties + public Dictionary UserPref { get; set; } = new Dictionary(); + public string userId { get => _userId; diff --git a/WebDoorCreator.UI/Pages/DoorDefinition.razor b/WebDoorCreator.UI/Pages/DoorDefinition.razor index 4b0d31c..1c83fc2 100644 --- a/WebDoorCreator.UI/Pages/DoorDefinition.razor +++ b/WebDoorCreator.UI/Pages/DoorDefinition.razor @@ -16,25 +16,20 @@
- @if (currDefStep == Core.Enum.DoorDefStep.Door) - { - @if (ListBaseDoorOp != null) + + @if (currDefStep == Core.Enum.DoorDefStep.Door) { - @foreach (var item in ListBaseDoorOp) + @if (ListBaseDoorOp != null) { - - - + } + @**@ } - @**@ - } - else if (currDefStep == Core.Enum.DoorDefStep.Hardware) - { - + else if (currDefStep == Core.Enum.DoorDefStep.Hardware) + { - - } + } +
diff --git a/WebDoorCreator.UI/Pages/DoorDefinition.razor.cs b/WebDoorCreator.UI/Pages/DoorDefinition.razor.cs index 6f7e7f2..cea9212 100644 --- a/WebDoorCreator.UI/Pages/DoorDefinition.razor.cs +++ b/WebDoorCreator.UI/Pages/DoorDefinition.razor.cs @@ -15,6 +15,8 @@ namespace WebDoorCreator.UI.Pages public void Dispose() { + ListBaseDoorOp = null; + orderStatus = null; WDCUService.EA_CurrLanguage -= WDUService_EA_CurrLanguage; QDataServ.CalcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage; } @@ -81,10 +83,20 @@ namespace WebDoorCreator.UI.Pages protected async Task ReloadData() { + ListBaseDoorOp = null; + ListHwDoorOp = null; + orderStatus = null; + await Task.Delay(1); var ListRecordDoorOp = await WDService.DoorOpGetByDoorId(idDoor); if (ListRecordDoorOp != null) { + ListHwDoorOp = ListRecordDoorOp; ListBaseDoorOp = ListRecordDoorOp.Where(x => x.ObjectId == "Size" || x.ObjectId == "Profiles").ToList(); + // calcolo gli hw togliendo DoorOpBase + foreach (var item in ListBaseDoorOp) + { + ListHwDoorOp.Remove(item); + } } var domani = DateTime.Today.AddDays(1); ListOrdersStatus = null; @@ -97,22 +109,6 @@ namespace WebDoorCreator.UI.Pages await Task.Delay(1); } - #endregion Protected Methods - - #region Private Fields - - private static Logger Log = LogManager.GetCurrentClassLogger(); - - private List? ListBaseDoorOp = null; - private List? ListOrdersStatus = null; - - #endregion Private Fields - - #region Private Methods - - private Core.Enum.DoorDefStep currDefStep { get; set; } = Core.Enum.DoorDefStep.Door; - private bool setHwToNull { get; set; } = false; - /// /// gestione impostazione step /// @@ -129,6 +125,26 @@ namespace WebDoorCreator.UI.Pages } } + #endregion Protected Methods + + #region Private Fields + + private static Logger Log = LogManager.GetCurrentClassLogger(); + + #endregion Private Fields + + #region Private Properties + + private Core.Enum.DoorDefStep currDefStep { get; set; } = Core.Enum.DoorDefStep.Door; + private List? ListBaseDoorOp { get; set; } = null; + private List? ListHwDoorOp { get; set; } = null; + private List? ListOrdersStatus { get; set; } = null; + private bool setHwToNull { get; set; } = false; + + #endregion Private Properties + + #region Private Methods + private async void CalcDonePipe_EA_NewMessage(object? sender, EventArgs e) { DoorSvgContent = ""; diff --git a/WebDoorCreator.UI/temp/Conf.yaml b/WebDoorCreator.UI/temp/Conf.yaml index a900ed4..bedbbc1 100644 --- a/WebDoorCreator.UI/temp/Conf.yaml +++ b/WebDoorCreator.UI/temp/Conf.yaml @@ -12,7 +12,7 @@ order: project: pO: line: -date: 21-04-2023 +date: 2023-04-26T12:20:39.8125610+02:00 piece: DO_1 size: width: 33.8125 @@ -21,7 +21,7 @@ size: swing: RH secure: UP material: wood -profiles: +profiles: lockedge: type: BV machining: ON @@ -41,26 +41,8 @@ profiles: hardware: ept: - template: Generic\StdEPT - ToptoCL: 15 + ToptoCL: 16 FacetoCL: 0.875 - - template: Generic\StdEPT - ToptoCL: 15 - FacetoCL: 0.875 - - flush_bolts: - - template: Corner\8501 - type: corner - side: top - position: 5 - offset_WS: 0.0 - - groove: - - template: Generic\Groove - type: side - width: 0.6 - depth: 0.8 - offset_WS: 0 - side: bottom --- From 842849b35b90e8eecb6e618d908112ac9da038dd Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 26 Apr 2023 15:07:59 +0200 Subject: [PATCH 2/4] update x deserializzazione degli oggertti DOORS --- .../Components/DoorDef/BaseParamList.razor | 7 +- .../Components/DoorDef/BaseParamList.razor.cs | 1 + .../Components/DoorDef/DoorDataBlock.razor | 11 ++ .../Components/DoorDef/DoorDataBlock.razor.cs | 83 +++++++++++ .../DoorDef/DoorDefSizingSI.razor.cs | 140 ++++++++++-------- 5 files changed, 173 insertions(+), 69 deletions(-) create mode 100644 WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor create mode 100644 WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor.cs diff --git a/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor b/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor index 088c155..ea5ed0a 100644 --- a/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor +++ b/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor @@ -4,13 +4,8 @@ } else { - int numIdx = 1; @foreach (var item in CurrBaseDoorOp) { -
-

record @(numIdx++)

- -
-
+ } } \ No newline at end of file diff --git a/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs b/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs index b39dd9f..0efb11d 100644 --- a/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs +++ b/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs @@ -23,6 +23,7 @@ using WebDoorCreator.UI.Components.Users; using WebDoorCreator.UI.Components.Hardware; using WebDoorCreator.UI.Shared; using WebDoorCreator.Data.DbModels; +using Newtonsoft.Json; namespace WebDoorCreator.UI.Components.DoorDef { diff --git a/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor b/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor new file mode 100644 index 0000000..ca8b267 --- /dev/null +++ b/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor @@ -0,0 +1,11 @@ +

@BlockDoorOp.ObjectId

+ +@if (bdpList != null) +{ + foreach (var item in bdpList) + { + + } +
+
+} \ No newline at end of file diff --git a/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor.cs b/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor.cs new file mode 100644 index 0000000..e5dcb38 --- /dev/null +++ b/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using WebDoorCreator.UI; +using WebDoorCreator.UI.Components; +using WebDoorCreator.UI.Components.Buttons; +using WebDoorCreator.UI.Components.CompMan; +using WebDoorCreator.UI.Components.DoorMan; +using WebDoorCreator.UI.Components.DoorDef; +using WebDoorCreator.UI.Components.Gen; +using WebDoorCreator.UI.Components.Order; +using WebDoorCreator.UI.Components.Users; +using WebDoorCreator.UI.Components.Hardware; +using WebDoorCreator.UI.Shared; +using WebDoorCreator.Data.DbModels; +using Newtonsoft.Json; + +namespace WebDoorCreator.UI.Components.DoorDef +{ + public partial class DoorDataBlock + { + /// + /// Blocco parametri di base + /// + [Parameter] + public DoorOpModel BlockDoorOp { get; set; } = null!; + protected string userLang { get; set; } = "EN"; + + /// + /// spacchetto componenti + /// + protected override void OnParametersSet() + { + setupCurrValues(); + setupParamConfig(); + } + + protected Dictionary>? bdpList { get; set; } = new Dictionary>(); + protected Dictionary>? bdpList2Comp { get; set; } = new Dictionary>(); + protected Dictionary>>? bdpConfiglist { get; set; } = new Dictionary>>(); + + + + public void setupCurrValues() + { + //currVal = new Dictionary(); + if (!string.IsNullOrEmpty(BlockDoorOp.JsoncActVal)) + { + bdpList = JsonConvert.DeserializeObject>>(BlockDoorOp.JsoncActVal!); + + bdpList2Comp = JsonConvert.DeserializeObject>>(BlockDoorOp.JsoncActVal!); + } + } + + public void setupParamConfig() + { + bdpConfiglist = JsonConvert.DeserializeObject>>>(BlockDoorOp.JsoncConfigVal!); + } + + protected Dictionary> getParamsConfig(string paramName) + { + Dictionary> answ = new Dictionary>(); + if(bdpConfiglist!=null && bdpConfiglist.Count>0) + { + if(bdpConfiglist.ContainsKey(paramName)) + { + answ = bdpConfiglist[paramName]; + } + } + return answ; + } + } +} \ No newline at end of file diff --git a/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor.cs b/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor.cs index 9b8db0d..035c294 100644 --- a/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor.cs +++ b/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor.cs @@ -11,8 +11,10 @@ namespace WebDoorCreator.UI.Components.DoorDef { #region Public Properties +#if false [Parameter] - public DoorOpModel DoorOpInst { get; set; } = null!; + public DoorOpModel DoorOpInst { get; set; } = null!; +#endif [Parameter] public string HwCode { get; set; } = ""; @@ -33,6 +35,7 @@ namespace WebDoorCreator.UI.Components.DoorDef #region Public Methods +#if false public void setupCurrValues() { //currVal = new Dictionary(); @@ -71,10 +74,12 @@ namespace WebDoorCreator.UI.Components.DoorDef } } - } + } } +#endif - public void setupGraphicParams() +#if false + public void setupParamConfig() { var deserialized = JsonConvert.DeserializeObject>>>(DoorOpInst.JsoncConfigVal!); if (deserialized != null) @@ -82,14 +87,15 @@ namespace WebDoorCreator.UI.Components.DoorDef //graphicParamsTemp = deserialized; foreach (var kvp in deserialized) { - if (!graphicParams.ContainsKey(kvp.Key)) + if (!paramsConfig.ContainsKey(kvp.Key)) { - graphicParams.Add(kvp.Key, kvp.Value); + paramsConfig.Add(kvp.Key, kvp.Value); } } - } + } } +#endif #endregion Public Methods @@ -98,14 +104,20 @@ namespace WebDoorCreator.UI.Components.DoorDef /// /// Array dati /// - protected Dictionary currVal { get; set; } = new Dictionary(); + [Parameter] + public Dictionary currVal { get; set; } = new Dictionary(); - protected Dictionary currValToCompare { get; set; } = new Dictionary(); + /// + /// Array dati x comparazione + /// + [Parameter] + public Dictionary currValToCompare { get; set; } = new Dictionary(); - - //protected Dictionary> graphicParams { get; set; } = new Dictionary>(); - protected Dictionary>> graphicParams { get; set; } = new Dictionary>>(); - protected Dictionary>> graphicParamsTemp { get; set; } = null!; + /// + /// parametri di configurazione oggetto + /// + [Parameter] + public Dictionary> paramsConfig { get; set; } = new Dictionary>(); [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; @@ -126,7 +138,7 @@ namespace WebDoorCreator.UI.Components.DoorDef protected List comboSet(string pKey) { List answ = new List(); - foreach (var item in graphicParams) + foreach (var item in paramsConfig) { foreach (var param in item.Value) { @@ -164,59 +176,59 @@ namespace WebDoorCreator.UI.Components.DoorDef return answ; } - protected async Task doClone() - { - DateTime adesso = DateTime.Now; - DoorOpModel doorOpToAdd = new DoorOpModel() - { - DateIns = adesso, - DateMod = adesso, - UserIdIns = userId, - UserIdMod = userId, - ObjectId = DoorOpInst.ObjectId, - DoorId = DoorOpInst.DoorId, - JsoncConfigVal = DoorOpInst.JsoncConfigVal, - JsoncActVal = DoorOpInst.JsoncActVal, - userConfirm = DoorOpInst.userConfirm, - DtConfirm = DoorOpInst.DtConfirm - }; + // protected async Task doClone() + // { + // DateTime adesso = DateTime.Now; + // DoorOpModel doorOpToAdd = new DoorOpModel() + // { + // DateIns = adesso, + // DateMod = adesso, + // UserIdIns = userId, + // UserIdMod = userId, + // ObjectId = DoorOpInst.ObjectId, + // DoorId = DoorOpInst.DoorId, + // JsoncConfigVal = DoorOpInst.JsoncConfigVal, + // JsoncActVal = DoorOpInst.JsoncActVal, + // userConfirm = DoorOpInst.userConfirm, + // DtConfirm = DoorOpInst.DtConfirm + // }; - List doorOpAddList = new List() { doorOpToAdd }; - // salvo! - await WDCService.DoorOpInsert(DoorOpInst.DoorId, doorOpAddList); - await FullReloadData(true); - } + // List doorOpAddList = new List() { doorOpToAdd }; + // // salvo! + // await WDCService.DoorOpInsert(DoorOpInst.DoorId, doorOpAddList); + // await FullReloadData(true); + // } - protected async Task doConfirm() - { - DoorOpInst.userConfirm = userId; - DoorOpInst.DtConfirm = DateTime.Now; - // salvo! - await WDCService.DoorOpUpdate(DoorOpInst); - } + // protected async Task doConfirm() + // { + // DoorOpInst.userConfirm = userId; + // DoorOpInst.DtConfirm = DateTime.Now; + // // salvo! + // await WDCService.DoorOpUpdate(DoorOpInst); + // } - protected async Task doDeleteInst() - { - var done = await JSRuntime.InvokeAsync("confirm", "Delete PERMANENTLY the current record?"); + // protected async Task doDeleteInst() + // { + // var done = await JSRuntime.InvokeAsync("confirm", "Delete PERMANENTLY the current record?"); - if (done) - { - await WDCService.DoorOpDelete(DoorOpInst); - await FullReloadData(true); - } - } + // if (done) + // { + // await WDCService.DoorOpDelete(DoorOpInst); + // await FullReloadData(true); + // } + // } protected async Task doSave() { - // ri-serializzo i graphics parameters... - string serVal = JsonConvert.SerializeObject(currVal); - DoorOpInst.JsoncActVal = serVal; - // salvo! - await WDCService.DoorOpUpdate(DoorOpInst); - // invio msg dato "salvabile" -#if false - await QDataServ.sendCalcReq($"ORD{DoorOpInst.DoorId:00000}"); -#endif + // // ri-serializzo i graphics parameters... + // string serVal = JsonConvert.SerializeObject(currVal); + // DoorOpInst.JsoncActVal = serVal; + // // salvo! + // await WDCService.DoorOpUpdate(DoorOpInst); + // // invio msg dato "salvabile" + //#if false + // await QDataServ.sendCalcReq($"ORD{DoorOpInst.DoorId:00000}"); + //#endif // rileggo await FullReloadData(true); } @@ -224,9 +236,9 @@ namespace WebDoorCreator.UI.Components.DoorDef protected bool isCombo(string pKey) { bool answ = false; - if (graphicParams.ContainsKey(pKey)) + if (paramsConfig.ContainsKey(pKey)) { - answ = graphicParams[pKey].Count > 1; + answ = paramsConfig[pKey].Count > 1; } return answ; } @@ -251,11 +263,13 @@ namespace WebDoorCreator.UI.Components.DoorDef private async Task FullReloadData(bool isFirst) { +#if false if (DoorOpInst.ObjectId != "Size") { setupCurrValues(); - setupGraphicParams(); - } + setupParamConfig(); + } +#endif //await ReloadData(isFirst); } From 27e1fa5c0a4ea018719c5267112fac1575c64713 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 26 Apr 2023 15:21:01 +0200 Subject: [PATCH 3/4] Fix decodifica opzioni selettori a tendina --- .../Components/DoorDef/BaseParamList.razor.cs | 33 +-- .../Components/DoorDef/DoorDataBlock.razor | 5 +- .../Components/DoorDef/DoorDefSizingSI.razor | 5 +- .../DoorDef/DoorDefSizingSI.razor.cs | 197 +++--------------- 4 files changed, 40 insertions(+), 200 deletions(-) diff --git a/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs b/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs index 0efb11d..1d311f3 100644 --- a/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs +++ b/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs @@ -1,42 +1,27 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Components; -using System.Net.Http; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components.Authorization; -using Microsoft.AspNetCore.Components.Forms; -using Microsoft.AspNetCore.Components.Routing; -using Microsoft.AspNetCore.Components.Web; -using Microsoft.AspNetCore.Components.Web.Virtualization; -using Microsoft.JSInterop; -using WebDoorCreator.UI; -using WebDoorCreator.UI.Components; -using WebDoorCreator.UI.Components.Buttons; -using WebDoorCreator.UI.Components.CompMan; -using WebDoorCreator.UI.Components.DoorMan; -using WebDoorCreator.UI.Components.DoorDef; -using WebDoorCreator.UI.Components.Gen; -using WebDoorCreator.UI.Components.Order; -using WebDoorCreator.UI.Components.Users; -using WebDoorCreator.UI.Components.Hardware; -using WebDoorCreator.UI.Shared; using WebDoorCreator.Data.DbModels; -using Newtonsoft.Json; namespace WebDoorCreator.UI.Components.DoorDef { public partial class BaseParamList { + #region Public Properties + /// /// Elenco parametri di base /// [Parameter] public List? CurrBaseDoorOp { get; set; } = null; + #endregion Public Properties + #region Protected Properties + + /// + /// Lingua utente (FixMe !!!) + /// protected string userLang { get; set; } = "EN"; + #endregion Protected Properties } } \ No newline at end of file diff --git a/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor b/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor index ca8b267..e537e1f 100644 --- a/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor +++ b/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor @@ -1,4 +1,6 @@ -

@BlockDoorOp.ObjectId

+
+
@BlockDoorOp.ObjectId
+
@if (bdpList != null) { @@ -7,5 +9,4 @@ }
-
} \ No newline at end of file diff --git a/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor b/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor index f51303f..218a56f 100644 --- a/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor +++ b/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor @@ -6,8 +6,10 @@ else {
-
+
+ @HwCode +
@foreach (var item in currVal) { @if (isCombo(item.Key)) @@ -16,7 +18,6 @@ else
@translate(item.Key)
-
} @@ -52,6 +51,19 @@ else
} + else + { +
+
+ + +
+
+ }
diff --git a/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor.cs b/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor.cs index e99c2d3..cc2911a 100644 --- a/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor.cs +++ b/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; +using Newtonsoft.Json; using WebDoorCreator.Data.Services; using WebDoorCreator.UI.Data; @@ -9,21 +10,18 @@ namespace WebDoorCreator.UI.Components.DoorDef { #region Public Properties - /// - /// Array dati - /// - [Parameter] - public Dictionary currVal { get; set; } = new Dictionary(); - /// /// Array dati x comparazione /// [Parameter] - public Dictionary currValToCompare { get; set; } = new Dictionary(); + public Dictionary currValRef { get; set; } = new Dictionary(); [Parameter] public int DoorId { get; set; } = 0; + [Parameter] + public EventCallback>> E_ItemChanged { get; set; } + [Parameter] public string HwCode { get; set; } = ""; @@ -43,6 +41,11 @@ namespace WebDoorCreator.UI.Components.DoorDef #region Protected Properties + /// + /// Array dati effettivo x gestione modifiche + /// + protected Dictionary currVal { get; set; } = new Dictionary(); + [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; @@ -77,13 +80,13 @@ namespace WebDoorCreator.UI.Components.DoorDef protected bool doCheckVal() { bool answ = false; - if (currValToCompare != null) + if (currValRef != null) { foreach (var k in currVal) { - if (currValToCompare != null) + if (currValRef != null) { - if (k.Value != currValToCompare[k.Key]) + if (k.Value != currValRef[k.Key]) { answ = true; } @@ -95,8 +98,12 @@ namespace WebDoorCreator.UI.Components.DoorDef protected async Task doSave() { - // rileggo - await FullReloadData(true); + await Task.Delay(1); + // preparo i dati... + Dictionary> updSet = new Dictionary>(); + updSet.Add(HwCode, currVal); + // solleva evento con dizionario contentente chiave + valori current + await E_ItemChanged.InvokeAsync(updSet); } protected bool isCombo(string pKey) @@ -129,6 +136,17 @@ namespace WebDoorCreator.UI.Components.DoorDef private async Task FullReloadData(bool isFirst) { + // serializzo e deserializzo i valori current da quelli di riferimento + string serObj = JsonConvert.SerializeObject(currValRef); + if (!string.IsNullOrEmpty(serObj)) + { + var newObj = JsonConvert.DeserializeObject>(serObj); + if (newObj != null) + { + currVal = newObj; + } + } + await Task.Delay(1); } #endregion Private Methods diff --git a/WebDoorCreator.UI/Components/Hardware/HwSingleInstance.razor b/WebDoorCreator.UI/Components/Hardware/HwSingleInstance.razor index 72e41d8..b76f18e 100644 --- a/WebDoorCreator.UI/Components/Hardware/HwSingleInstance.razor +++ b/WebDoorCreator.UI/Components/Hardware/HwSingleInstance.razor @@ -99,8 +99,6 @@ else - - } } }