Ok clona + insert!
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
else
|
||||
{
|
||||
<div class="px-1 small textTrim">
|
||||
<AddRA IdxDip="@IdxDipSel" NewItemCreated="() => Edit()" InizioPer="@CurrData.Inizio"></AddRA>
|
||||
<AddRA IdxDip="@IdxDipSel" NewItemCreated="ReportSelect" InizioPer="@CurrData.Inizio"></AddRA>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -132,4 +132,12 @@
|
||||
isSelected = true;
|
||||
await ItemSelected.InvokeAsync(CurrData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indico item selezionato
|
||||
/// </summary>
|
||||
protected async void ReportSelect(RegAttivitaModel selRecord)
|
||||
{
|
||||
await ItemSelected.InvokeAsync(selRecord);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,14 +143,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* <div class="col-3 pl-0">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><span class="fas fa-calendar" aria-hidden="true"></span></span>
|
||||
</div>
|
||||
<InputDate class="form-control" @bind-bind-Value="@currRecord.Inizio" />
|
||||
</div>
|
||||
</div>*@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<WeekStatDTO> weekStatList = new List<WeekStatDTO>();
|
||||
|
||||
private List<DailyDataDTO> ListRecords = new List<DailyDataDTO>();
|
||||
|
||||
private List<AnagFasiModel> ListFasi = new List<AnagFasiModel>();
|
||||
#if false
|
||||
private WeekPlanModel currRecord = null;
|
||||
private List<PlantDTO> PlantsList;
|
||||
private List<SupplierModel> SuppliersList;
|
||||
private List<TransporterModel> 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<WeekPlanModel> SlotList(DayOfWeek Giorno, int Ora)
|
||||
{
|
||||
List<WeekPlanModel> result = new List<WeekPlanModel>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user