ok bulk add num porte

This commit is contained in:
zaccaria.majid
2023-05-19 10:46:39 +02:00
parent 725b847770
commit 5fb1f3a170
5 changed files with 27 additions and 15 deletions
@@ -216,7 +216,7 @@ namespace WebDoorCreator.Data.Controllers
/// <param name="doorId">Record id to edit or add</param>
/// <param name="isAdd">States if it has to be added or removing a door</param>
/// <returns></returns>
public async Task<bool> DoorModQty(int doorId, bool isAdd)
public async Task<bool> DoorModQty(int NewQty, int doorId, bool isAdd)
{
/* crea nuovo metodo per modifica singola quantità porta: DOORMODQTY */
bool fatto = false;
@@ -231,7 +231,11 @@ namespace WebDoorCreator.Data.Controllers
.FirstOrDefault();
if (currRec != null) //if is not null edit the record found
{
if (isAdd)
if (NewQty > 0)
{
currRec.Quantity = NewQty;
}
else if (isAdd)
{
currRec.Quantity = currRec.Quantity + 1;
}
@@ -31,6 +31,7 @@ namespace WebDoorCreator.UI.Components.Buttons
protected async Task addOrRemoveOneDoorNumber()
{
#if false
//var door = new DoorModel();
doorChange = false;
var done = await WDService.DoorModQty(OrderId, DoorId, isAdd);
@@ -38,7 +39,8 @@ namespace WebDoorCreator.UI.Components.Buttons
{
doorChange = true;
await E_isChange.InvokeAsync(doorChange);
}
}
#endif
}
}
}
@@ -13,8 +13,8 @@
<div class="d-flex justify-content-between mb-3">
@if (CurrDoorClone.Quantity != CurrDoor.Quantity)
{
<button class="btn btn-outline-danger" type="button">CANCEL</button>
<button class="btn btn-outline-success" type="button">SAVE</button>
<button class="btn btn-outline-danger" type="button" @onclick="()=>ReloadData()">CANCEL</button>
<button class="btn btn-outline-success" type="button" @onclick="()=>ChangeDoorNumber(true)">SAVE</button>
}
</div>
<label for="search">Add or Remove door</label>
@@ -9,12 +9,8 @@ using static System.Runtime.CompilerServices.RuntimeHelpers;
namespace WebDoorCreator.UI.Components.DoorMan
{
public partial class DoorModal : IDisposable
public partial class DoorModal
{
public void Dispose()
{
QDataServ.CalcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage;
}
[Parameter]
public int CurrDoorId { get; set; } = 0;
[Parameter]
@@ -76,7 +72,17 @@ namespace WebDoorCreator.UI.Components.DoorMan
protected async Task addOrRemoveOneDoorNumber(bool isAdd)
{
//var door = new DoorModel();
var done = await WDService.DoorModQty(CurrDoor.OrderId, CurrDoor.DoorId, isAdd);
var done = await WDService.DoorModQty(0, CurrDoor.OrderId, CurrDoor.DoorId, isAdd);
if (done)
{
//await E_isChange.InvokeAsync(true);
await ReloadData();
}
}
protected async Task ChangeDoorNumber(bool isAdd)
{
//var door = new DoorModel();
var done = await WDService.DoorModQty(doorQty, CurrDoor.OrderId, CurrDoor.DoorId, isAdd);
if (done)
{
//await E_isChange.InvokeAsync(true);
@@ -140,8 +146,8 @@ namespace WebDoorCreator.UI.Components.DoorMan
protected List<DoorOpModel> doorOps2Add = new List<DoorOpModel>();
protected int doorQty
{
get => CurrDoor.DoorId;
set => CurrDoor.DoorId = value;
get => CurrDoor.Quantity;
set => CurrDoor.Quantity = value;
}
[Inject]
@@ -672,9 +672,9 @@ namespace WebDoorCreator.UI.Data
/// <param name="DoorId">Record id to edit or add</param>
/// <param name="isAdd">States if it has to be added or removing a door</param>
/// <returns></returns>
public async Task<bool> DoorModQty(int OrderId, int DoorId, bool isAdd)
public async Task<bool> DoorModQty(int NewQty, int OrderId, int DoorId, bool isAdd)
{
var dbResult = await dbController.DoorModQty(DoorId, isAdd);
var dbResult = await dbController.DoorModQty(NewQty, DoorId, isAdd);
// svuoto cache
await DoorFlushCache(DoorId);
await DoorOpFlushCache(DoorId);