From 68203768396e61729b8e8a998ac0878fcbc65521 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 28 Apr 2021 08:46:24 +0200 Subject: [PATCH] Aggiunto add/mod x Item (ma va cambiata primary key in INT) --- SHERPA.BBM.UI/Components/ItemsEditor.razor | 50 ++++-------- SHERPA.BBM.UI/Pages/Items.razor | 95 ++++++++++------------ SHERPA.BBM/Controllers/BBMController.cs | 2 +- 3 files changed, 60 insertions(+), 87 deletions(-) diff --git a/SHERPA.BBM.UI/Components/ItemsEditor.razor b/SHERPA.BBM.UI/Components/ItemsEditor.razor index 5bb2277..5e8dd64 100644 --- a/SHERPA.BBM.UI/Components/ItemsEditor.razor +++ b/SHERPA.BBM.UI/Components/ItemsEditor.razor @@ -17,15 +17,23 @@ +
+ + + @foreach (var value in Enum.GetValues(typeof(BbmResType))) + { + + } + +
+
+ + +
+
+ +
- @*
- - -
*@ - @*
- - -
*@
@@ -34,32 +42,6 @@
- @*
- - - @foreach (var item in basketList) - { - - } - -
-
- - - @foreach (var item in negotiationList) - { - - } - -
*@ -
- - -
-
- - -
diff --git a/SHERPA.BBM.UI/Pages/Items.razor b/SHERPA.BBM.UI/Pages/Items.razor index 22f2275..7cbaf8f 100644 --- a/SHERPA.BBM.UI/Pages/Items.razor +++ b/SHERPA.BBM.UI/Pages/Items.razor @@ -29,20 +29,19 @@ *@
- @*
-
- - - -
- -
*@ +
+
+ + + +
+ +
@@ -109,45 +108,37 @@ private DatabaseModels.ItemsModel currItem = null; private DatabaseModels.ItemsModel[] itemsList; -#if false -private DatabaseModels.BasketsModel[] basketList; + private BbmResType _SelResType { get; set; } = BbmResType.ND; + private string _SelUM { get; set; } = ""; -private DatabaseModels.NegotiationsModel[] negotiationList; - -private string _SelCodBasket { get; set; } = ""; -private string _SelCodNegotiation { get; set; } = ""; - -private string SelCodBasket -{ -get -{ -return _SelCodBasket; -} -set -{ -_SelCodBasket = value; -updateTable(); -} -} -private string SelCodNegotiation -{ -get -{ -return _SelCodNegotiation; -} -set -{ -_SelCodNegotiation = value; -updateTable(); -} -} -#endif + private BbmResType SelResType + { + get + { + return _SelResType; + } + set + { + _SelResType = value; + updateTable(); + } + } + private string SelUM + { + get + { + return _SelUM; + } + set + { + _SelUM = value; + updateTable(); + } + } protected async Task updateTable() { -#if false -itemsList = await BBMService.DocsGetAsync(SelCodBasket, SelCodNegotiation, numRecord); -#endif + itemsList = await BBMService.ItemsGetAsync(SelResType, SelUM, numRecord); } protected async Task ReloadAllData() @@ -185,7 +176,7 @@ negotiationList = await BBMService.NegotiationsGetAsync(0); protected void CreateNew() { // recupero counter - string newCode = BBMService.CounterGetNext($"ITEM."); + string newCode = BBMService.CounterGetNext($"ITEM"); DatabaseModels.ItemsModel newRecord = new DatabaseModels.ItemsModel() { CodItem = newCode, @@ -193,7 +184,7 @@ negotiationList = await BBMService.NegotiationsGetAsync(0); UM = "NR", UnitCost = 1, UnitPrice = 1, - Descript = "New Document" + Descript = "Nuovo Item" }; currItem = newRecord; } @@ -204,7 +195,7 @@ negotiationList = await BBMService.NegotiationsGetAsync(0); } protected async Task Delete(SHERPA.BBM.DatabaseModels.ItemsModel currRecord) { - if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voler eliminare l'Item '{currRecord.CodDoc}'?")) + if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voler eliminare l'Item '{currRecord.CodItem}'?")) return; BBMService.ItemDelete(currRecord); diff --git a/SHERPA.BBM/Controllers/BBMController.cs b/SHERPA.BBM/Controllers/BBMController.cs index f653d3a..e229079 100644 --- a/SHERPA.BBM/Controllers/BBMController.cs +++ b/SHERPA.BBM/Controllers/BBMController.cs @@ -411,7 +411,7 @@ namespace SHERPA.BBM.Controllers dbCtx.SaveChanges(); done = true; } - catch + catch (Exception exc) { } return done; }