diff --git a/GPW.CORE.Data/Controllers/GPWController.cs b/GPW.CORE.Data/Controllers/GPWController.cs
index 07ad492..b3cbf9d 100644
--- a/GPW.CORE.Data/Controllers/GPWController.cs
+++ b/GPW.CORE.Data/Controllers/GPWController.cs
@@ -266,10 +266,19 @@ namespace GPW.CORE.Data.Controllers
currRec.Fine = currItem.Fine;
currRec.Descrizione = currItem.Descrizione;
- localDbCtx.DbSetRegAttivita.Update(currRec);
- localDbCtx.SaveChanges();
- answ = true;
+ localDbCtx
+ .DbSetRegAttivita
+ .Update(currRec);
}
+ // altrimenti aggiungo
+ else
+ {
+ localDbCtx
+ .DbSetRegAttivita
+ .Update(currItem);
+ }
+ localDbCtx.SaveChanges();
+ answ = true;
}
catch (Exception exc)
{
diff --git a/GPW.CORE.UI/Components/AddRA.razor b/GPW.CORE.UI/Components/AddRA.razor
index 001ebe8..9d97347 100644
--- a/GPW.CORE.UI/Components/AddRA.razor
+++ b/GPW.CORE.UI/Components/AddRA.razor
@@ -37,17 +37,11 @@
newItem = await GDataServ.RegAttLastByDip(1);
}
durata = newItem.Durata;
+ newItem.IdxRa = 0;
newItem.Inizio = InizioPer;
newItem.Fine = InizioPer.AddMinutes(durata.TotalMinutes);
- //// creo NUOVO record da dateStart...
- //newItem = new RegAttivitaModel()
- // {
- // Inizio = InizioPer,
- // IdxDipendente = IdxDip,
- // Fine = InizioPer.AddMinutes(30),
- // IdxFase=
- // };
- // riporto!
+ // salvo in AppMS
+ AppMServ.recordRA = newItem;
await NewItemCreated.InvokeAsync(newItem);
}
diff --git a/GPW.CORE.UI/Components/RegAtt.razor b/GPW.CORE.UI/Components/RegAtt.razor
index 7a76616..b9d9e0b 100644
--- a/GPW.CORE.UI/Components/RegAtt.razor
+++ b/GPW.CORE.UI/Components/RegAtt.razor
@@ -39,7 +39,7 @@
else
{
}
@@ -132,4 +132,12 @@
isSelected = true;
await ItemSelected.InvokeAsync(CurrData);
}
+
+ ///
+ /// Indico item selezionato
+ ///
+ protected async void ReportSelect(RegAttivitaModel selRecord)
+ {
+ await ItemSelected.InvokeAsync(selRecord);
+ }
}
diff --git a/GPW.CORE.UI/Components/RegAttEditor.razor b/GPW.CORE.UI/Components/RegAttEditor.razor
index 9d0ecb9..a9fa995 100644
--- a/GPW.CORE.UI/Components/RegAttEditor.razor
+++ b/GPW.CORE.UI/Components/RegAttEditor.razor
@@ -143,14 +143,6 @@
- @* *@
diff --git a/GPW.CORE.UI/Components/RegAttEditor.razor.cs b/GPW.CORE.UI/Components/RegAttEditor.razor.cs
index 978fe9a..cd77228 100644
--- a/GPW.CORE.UI/Components/RegAttEditor.razor.cs
+++ b/GPW.CORE.UI/Components/RegAttEditor.razor.cs
@@ -128,6 +128,8 @@ namespace GPW.CORE.UI.Components
{
// aggiorno
await GDataServ.RegAttUpdate(currRecord);
+ // resetto clone e record corrente...
+ AppMServ.clonedRA = null;
// registro fatto
await ItemUpdated.InvokeAsync(true);
}
diff --git a/GPW.CORE.UI/Pages/Planner.razor.cs b/GPW.CORE.UI/Pages/Planner.razor.cs
index 06afd94..f9d77c4 100644
--- a/GPW.CORE.UI/Pages/Planner.razor.cs
+++ b/GPW.CORE.UI/Pages/Planner.razor.cs
@@ -26,19 +26,13 @@ namespace GPW.CORE.UI.Pages
private int _endHour = 21;
private int _startHour = 7;
- private RegAttivitaModel currRecord;
+ private RegAttivitaModel currRecord = null;
private List weekStatList = new List();
private List ListRecords = new List();
private List ListFasi = new List();
-#if false
- private WeekPlanModel currRecord = null;
- private List PlantsList;
- private List SuppliersList;
- private List TransportersList;
-#endif
public RegAttivitaModel clonedRA
{
@@ -56,9 +50,6 @@ namespace GPW.CORE.UI.Pages
private int _currPage { get; set; } = 1;
private int _numRecord { get; set; } = 10;
-#if false
- private UserLevel _selLevel { get; set; } = UserLevel.ND;
-#endif
private int _selPlantId { get; set; } = 0;
private int _selSuppId { get; set; } = 0;
private int _selTraspId { get; set; } = 0;
@@ -109,22 +100,6 @@ namespace GPW.CORE.UI.Pages
}
}
-#if false
- private UserLevel SelLevel
- {
- get => _selLevel;
- set
- {
- if (_selLevel != value)
- {
- _selLevel = value;
- var pUpd = Task.Run(async () => await ReloadData());
- pUpd.Wait();
- }
- }
- }
-#endif
-
private int SelPlantId
{
get => _selPlantId;
@@ -200,11 +175,6 @@ namespace GPW.CORE.UI.Pages
}
}
-#if false
- [Inject]
- protected MessageService AppMService { get; set; }
-
-#endif
[Inject]
protected GpwDataService DataService { get; set; }
@@ -291,65 +261,20 @@ namespace GPW.CORE.UI.Pages
{
isLoading = true;
ListRecords = await DataService.DailyDetails(1, currWeekSel.inizio, currWeekSel.fine);
- //ListFasi = await DataService.AnagFasiAll();
-#if false
- ListRecords = await DataService.WeekPlanGet();
-#endif
// calcolo min/max...
checkHourRange();
isLoading = false;
}
- protected void CreateNew()
- {
-#if false
- // creo nuovo record
- WeekPlanModel newRecord = new WeekPlanModel()
- {
- DayNum = DayOfWeek.Sunday,
- DeliveryHour = 14,
- Note = "18K"
- };
- currRecord = newRecord;
-#endif
- }
-
-#if false
- protected void Edit(WeekPlanModel selRecord)
- {
- currRecord = selRecord;
- }
-
- protected void EditRecord(int WeekPlanId)
- {
- currRecord = null;
- var findRecord = ListRecords
- .Where(x => x.WeekPlanId == WeekPlanId)
- .FirstOrDefault();
- currRecord = findRecord;
- }
-#endif
-
protected override async Task OnInitializedAsync()
{
-#if false
- AppMService.ShowSearch = false;
- AppMService.PageName = "Planner Consegne";
- AppMService.PageIcon = "fas fa-calendar pr-2";
-#endif
await InitData();
await ReloadAllData();
-
}
protected async Task ReloadAllData()
{
-#if false
- PlantsList = await DataService.PlantsGetAll();
- SuppliersList = await DataService.SuppliersGetAll();
- TransportersList = await DataService.TransportersGetAll();
-#endif
await ReloadData();
}
@@ -364,38 +289,12 @@ namespace GPW.CORE.UI.Pages
await ReloadData();
}
-#if false
- protected void Select(WeekPlanModel selRecord)
- {
- // applico filtro da selezione
- currRecord = selRecord;
- }
-#endif
-
-
-
-#if false
- protected List SlotList(DayOfWeek Giorno, int Ora)
- {
- List result = new List();
-
- if (ListRecords != null && ListRecords.Count > 0)
- {
- result = ListRecords
- .Where(x => x.DayNum == Giorno && x.DeliveryHour == Ora)
- .ToList();
- }
-
- return result;
- }
-#endif
protected async Task UpdateData()
{
-#if false
- currRecord = null;
-#endif
await ReloadData();
+ //currRecord = null;
+ //clonedRA = null;
}