Update comportamento modifica modale della porta

This commit is contained in:
Samuele Locatelli
2023-06-14 09:58:38 +02:00
parent 82c118c4c0
commit 8adf4583ea
6 changed files with 22 additions and 89 deletions
@@ -286,52 +286,6 @@ namespace WebDoorCreator.Data.Controllers
return newId;
}
/// <summary>
/// Adding or removing a single door
/// </summary>
/// <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 NewQty, int doorId, bool isAdd)
{
/* crea nuovo metodo per modifica singola quantità porta: DOORMODQTY */
bool fatto = false;
//List<ItemModel> dbResult = new List<ItemModel>();
using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
{
try
{
var currRec = localDbCtx
.DbSetDoor
.Where(x => x.DoorId == doorId)
.FirstOrDefault();
if (currRec != null) //if is not null edit the record found
{
if (NewQty > 0)
{
currRec.Quantity = NewQty;
}
else if (isAdd)
{
currRec.Quantity = currRec.Quantity + 1;
}
else
{
currRec.Quantity = currRec.Quantity - 1;
}
localDbCtx.Entry(currRec).State = EntityState.Modified;
}
await localDbCtx.SaveChangesAsync();
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante DoorModQty: {Environment.NewLine}{exc}");
}
}
return fatto;
}
/// <summary>
/// Delete doorOp instance
/// </summary>
@@ -1242,22 +1242,6 @@ namespace WebDoorCreator.Data.Services
return dbResult;
}
/// <summary>
/// Adding or removing a single door
/// </summary>
/// <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 NewQty, int OrderId, int DoorId, bool isAdd)
{
var dbResult = await dbController.DoorModQty(NewQty, DoorId, isAdd);
// svuoto cache
await DoorFlushCache(DoorId);
await DoorOpFlushCache(DoorId);
await OrderDetailFlushCache(OrderId);
await OrdersFlushCache();
return dbResult;
}
/// <summary>
/// Eliminazione DoorOP
@@ -28,7 +28,7 @@
</div>
<div class="d-flex justify-content-between mb-2 small">
<div class="form-floating mb-1">
<input type="text" @bind="@CurrDoor.DoorDescript" class="form-control" placeholder="Enter Description">
<input type="text" @bind="@CurrDoor.DoorDescript" class="form-control" placeholder="Enter Description">
<label>Description</label>
</div>
</div>
@@ -37,15 +37,9 @@
<label class="form-label">Add or Remove door</label>
</div>
<div class="input-group">
@if (CurrDoorClone.Quantity == CurrDoor.Quantity && CurrDoor.Quantity > 1)
{
<button class="btn btn-outline-danger" type="button" @onclick="()=>addOrRemoveOneDoorNumber(false)">-1</button>
}
<button class="btn btn-outline-danger" type="button" @onclick="()=>modDoorQty(false)">-1</button>
<input type="number" @bind="@DoorQty" class="form-control text-center">
@if (CurrDoorClone.Quantity == CurrDoor.Quantity)
{
<button class="btn btn-outline-success" type="button" @onclick="()=>addOrRemoveOneDoorNumber(true)">+1</button>
}
<button class="btn btn-outline-success" type="button" @onclick="()=>modDoorQty(true)">+1</button>
</div>
</div>
</div>
@@ -102,14 +102,15 @@ namespace WebDoorCreator.UI.Components.DoorMan
#region Protected Methods
protected async Task addOrRemoveOneDoorNumber(bool isAdd)
protected void modDoorQty(bool isAdd)
{
//var door = new DoorModel();
var done = await WDService.DoorModQty(0, CurrDoor.OrderId, CurrDoor.DoorId, isAdd);
if (done)
if (isAdd)
{
//await E_isChange.InvokeAsync(true);
await ReloadData();
DoorQty++;
}
else
{
DoorQty--;
}
}
@@ -3,7 +3,7 @@
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow">
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
<div class="d-flex justify-content-between w-100 px-4">
<div class="d-flex justify-content-between" style="width: 80%;">
<div class="d-flex justify-content-between small" style="width: 80%;">
<NavLink class="navbar-brand" href="Home">
<img src="images/DCALogoCut.png" style="width: 7.5rem;height: 3rem;" />
</NavLink>
@@ -11,11 +11,11 @@
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="w-100 d-flex justify-content-start">
<div class="w-100 d-flex flex-nowrap justify-content-start">
<AuthorizeView Roles="SuperAdmin, Admin, CompAdmin, CompUser, User" Context="MenuHide">
<Authorized>
<div class="nav-item px-3 d-flex flex-warp align-items-center">
<NavLink class="nav-link" href="OrdersHomePage">
<div class="nav-item px-1 align-items-center">
<NavLink class="nav-link text-nowrap" href="OrdersHomePage">
<span class="oi oi-cart" aria-hidden="true"></span> @translate("UI_01")
</NavLink>
</div>
@@ -24,8 +24,8 @@
<!--Hiding to non-SuperAdmin users the option to manage the application -->
<AuthorizeView Roles="SuperAdmin, Admin, CompAdmin" Context="MenuHide">
<Authorized>
<div class="nav-item px-3 d-flex flex-warp align-items-center">
<NavLink class="nav-link" href="UserAdmin">
<div class="nav-item px-1 align-items-center">
<NavLink class="nav-link text-nowrap" href="UserAdmin">
<span class="bi bi-people pe-2" aria-hidden="true"></span> @translate("UI_02")
</NavLink>
</div>
@@ -33,8 +33,8 @@
</AuthorizeView>
<AuthorizeView Roles="SuperAdmin" Context="MenuHide">
<Authorized>
<div class="nav-item px-3 d-flex flex-warp align-items-center">
<NavLink class="nav-link" href="SuperAdmin">
<div class="nav-item px-1 align-items-center">
<NavLink class="nav-link text-nowrap" href="SuperAdmin">
<span class="oi oi-list-rich" aria-hidden="true"></span> @translate("UI_03")
</NavLink>
</div>
@@ -42,8 +42,8 @@
</AuthorizeView>
<AuthorizeView Roles="SuperAdmin" Context="MenuHide">
<Authorized>
<div class="nav-item px-3 d-flex flex-warp align-items-center">
<NavLink class="nav-link" href="TemplateMan">
<div class="nav-item px-1 align-items-center">
<NavLink class="nav-link text-nowrap" href="TemplateMan">
<span class="fa-solid fa-paint-roller pe-2" aria-hidden="true"></span> Template Management
</NavLink>
</div>
@@ -98,7 +98,7 @@
<ul class="dropdown-menu p-2">
<li>
<div class="">
<NavLink class="nav-link" href="/Identity/Account/Manage">
<NavLink class="nav-link text-nowrap" href="/Identity/Account/Manage">
<button class="btn btn-sm btn-success w-100 fw-bold text-light text-decoration-none text-dark" style="">@translate("UI_06")</button>
</NavLink>
</div>
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>0.9.2306.1317</Version>
<Version>0.9.2306.1409</Version>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId>
</PropertyGroup>