From 5fe58f9c50a853a4e792a5b3888b4830a3441260 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 12 Nov 2021 16:46:47 +0100 Subject: [PATCH] inizio fix duplicazione negoziazioni --- .../Components/NegotiationEditor.razor | 65 +++++++++++++------ SHERPA.BBM.UI/Pages/Negotiations.razor | 2 +- SHERPA.BBM.UI/Pages/Negotiations.razor.cs | 21 ++++++ 3 files changed, 68 insertions(+), 20 deletions(-) diff --git a/SHERPA.BBM.UI/Components/NegotiationEditor.razor b/SHERPA.BBM.UI/Components/NegotiationEditor.razor index 75c747d..01f88b8 100644 --- a/SHERPA.BBM.UI/Components/NegotiationEditor.razor +++ b/SHERPA.BBM.UI/Components/NegotiationEditor.razor @@ -13,32 +13,41 @@
-
-
- - -
+
+ + + @foreach (var item in companyList) + { + + } +
- - -
-
- - -
-
- - -
-
- + @foreach (var item in itemsList) { } +
+
+ + +
+
+
+ + +
+
+
+ + +
+
+ +
@@ -52,7 +61,8 @@
@code { - + + private List companyList; private List itemsList; protected int? SelectedCustomerId { @@ -70,6 +80,22 @@ _negotiation.CustomerId = value; } } + protected int SelectedCompanyId + { + get + { + int answ = 0; + if (_negotiation != null) + { + answ = _negotiation.CompanyId; + } + return answ; + } + set + { + _negotiation.CompanyId = value; + } + } protected DatabaseModels.NegotiationsModel _negotiation = new NegotiationsModel(); @@ -116,6 +142,7 @@ protected async Task ReloadAllData() { + companyList = await BBMService.CompanyGetAll(); itemsList = await BBMService.CustomersGetAll(""); } } \ No newline at end of file diff --git a/SHERPA.BBM.UI/Pages/Negotiations.razor b/SHERPA.BBM.UI/Pages/Negotiations.razor index 0dba6c5..60d0a1b 100644 --- a/SHERPA.BBM.UI/Pages/Negotiations.razor +++ b/SHERPA.BBM.UI/Pages/Negotiations.razor @@ -51,7 +51,7 @@ @foreach (var record in ListRecords) { -   +   ;
@record.CodNegotiation diff --git a/SHERPA.BBM.UI/Pages/Negotiations.razor.cs b/SHERPA.BBM.UI/Pages/Negotiations.razor.cs index 8321100..a37e983 100644 --- a/SHERPA.BBM.UI/Pages/Negotiations.razor.cs +++ b/SHERPA.BBM.UI/Pages/Negotiations.razor.cs @@ -108,6 +108,7 @@ namespace SHERPA.BBM.UI.Pages { CodNegotiation = newCode, DataIns = DateTime.Now, + CompanyId = SelCompanyId, CustomerId = 1, Descript = "Nuova Negoziazione", BasePath = "", @@ -125,6 +126,26 @@ namespace SHERPA.BBM.UI.Pages await UpdateData(); } + protected async Task Duplicate(DatabaseModels.NegotiationsModel currRecord) + { + if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voler clonare la trattativa/licenza corrente?")) + return; + + // recupero counter + string newCode = BBMService.CounterGetNext($"{SelectData.Company}.N.{DateTime.Today.Year}", 6); + DatabaseModels.NegotiationsModel newRecord = new DatabaseModels.NegotiationsModel() + { + CodNegotiation = newCode, + DataIns = DateTime.Now, + CompanyId = currRecord.CompanyId, + CustomerId = 1, + Descript = "COPIA di " + currRecord.Descript, + BasePath = currRecord.BasePath, + Refer = currRecord.Refer + }; + currItem = newRecord; + } + protected void Edit(SHERPA.BBM.DatabaseModels.NegotiationsModel currRecord) { currItem = currRecord;