Aggiunto add/mod x Item (ma va cambiata primary key in INT)

This commit is contained in:
Samuele Locatelli
2021-04-28 08:46:24 +02:00
parent afde95e55a
commit 6820376839
3 changed files with 60 additions and 87 deletions
+16 -34
View File
@@ -17,15 +17,23 @@
<label for="codNeg">Codice:</label>
<InputText id="codNeg" @bind-Value="_currItem.CodItem" class="form-control form-control-sm" />
</div>
</div><div class="col-6 col-lg-3">
<label for="dataIns">Tipo:</label>
<InputSelect @bind-Value="@_currItem.ResType" class="form-control form-control-sm">
@foreach (var value in Enum.GetValues(typeof(BbmResType)))
{
<option>@value</option>
}
</InputSelect>
</div>
<div class="col-6 col-lg-3">
<label for="dataIns">UM:</label>
<InputText id="DocPath" @bind-Value="_currItem.UM" class="form-control form-control-sm" />
</div>
<div class="col-12 col-lg-6">
<label for="descript">Descrizione:</label>
<InputTextArea id="descript" @bind-Value="_currItem.Descript" class="form-control form-control-sm" />
</div>
@*<div class="col-6 col-lg-3">
<label for="dataIns">Inserita:</label>
<InputDate id="dataIns" @bind-Value="_currItem.DataIns" class="form-control form-control-sm" />
</div>*@
@*<div class="col-6 col-lg-3">
<label for="dataIns">Tipo:</label>
<InputText id="Type" @bind-Value="_currItem.DocType.ToString()" class="form-control form-control-sm" />
</div>*@
<div class="col-6 col-lg-3">
<label for="dataIns">Unit Cost:</label>
<InputNumber id="NumDoc" @bind-Value="_currItem.UnitCost" class="form-control form-control-sm" />
@@ -34,32 +42,6 @@
<label for="dataIns">Unit Price:</label>
<InputNumber id="NumDoc" @bind-Value="_currItem.UnitPrice" class="form-control form-control-sm" />
</div>
@*<div class="col-6 col-lg-3">
<label for="dataIns">Basket:</label>
<InputSelect @bind-Value="@_currItem.CodBasket" class="form-control form-control-sm">
@foreach (var item in basketList)
{
<option value="@item.CodBasket">@item.CodBasket</option>
}
</InputSelect>
</div>
<div class="col-6 col-lg-3">
<label for="dataIns">Negoziazione:</label>
<InputSelect @bind-Value="@_currItem.CodNegotiation" class="form-control form-control-sm">
@foreach (var item in negotiationList)
{
<option value="@item.CodNegotiation">@item.CodNegotiation</option>
}
</InputSelect>
</div>*@
<div class="col-6 col-lg-3">
<label for="dataIns">UM:</label>
<InputText id="DocPath" @bind-Value="_currItem.UM" class="form-control form-control-sm" />
</div>
<div class="col-12 col-lg-6">
<label for="descript">Tipo:</label>
<InputText id="descript" @bind-Value="_currItem.ResType.ToString()" class="form-control form-control-sm" />
</div>
<div class="col-6 col-lg-3">
<input type="submit" class="btn btn-success btn-block" value="Save" @onclick="saveUpdate" />
</div>
+43 -52
View File
@@ -29,20 +29,19 @@
</div>*@
</div>
<div class="col-6 col-lg-3">
@*<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<span class="oi oi-cart" aria-hidden="true"></span>
</span>
</div>
<select @bind="@SelCodNegotiation" class="form-control form-control-sm">
<option value="">--- Tutti ---</option>
@foreach (var item in negotiationList)
{
<option value="@item.CodNegotiation">@item.CodNegotiation</option>
}
</select>
</div>*@
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<span class="oi oi-tag" aria-hidden="true"></span>
</span>
</div>
<select @bind="@SelResType" class="form-control form-control-sm">
@foreach (var value in Enum.GetValues(typeof(BbmResType)))
{
<option>@value</option>
}
</select>
</div>
</div>
<div class="col-6 col-lg-3">
<button class="btn btn-block btn-success btn-sm" @onclick="CreateNew">NUOVO</button>
@@ -109,45 +108,37 @@
private DatabaseModels.ItemsModel currItem = null;
private DatabaseModels.ItemsModel[] itemsList;
#if false
private DatabaseModels.BasketsModel[] basketList;
private BbmResType _SelResType { get; set; } = BbmResType.ND;
private string _SelUM { get; set; } = "";
private DatabaseModels.NegotiationsModel[] negotiationList;
private string _SelCodBasket { get; set; } = "";
private string _SelCodNegotiation { get; set; } = "";
private string SelCodBasket
{
get
{
return _SelCodBasket;
}
set
{
_SelCodBasket = value;
updateTable();
}
}
private string SelCodNegotiation
{
get
{
return _SelCodNegotiation;
}
set
{
_SelCodNegotiation = value;
updateTable();
}
}
#endif
private BbmResType SelResType
{
get
{
return _SelResType;
}
set
{
_SelResType = value;
updateTable();
}
}
private string SelUM
{
get
{
return _SelUM;
}
set
{
_SelUM = value;
updateTable();
}
}
protected async Task updateTable()
{
#if false
itemsList = await BBMService.DocsGetAsync(SelCodBasket, SelCodNegotiation, numRecord);
#endif
itemsList = await BBMService.ItemsGetAsync(SelResType, SelUM, numRecord);
}
protected async Task ReloadAllData()
@@ -185,7 +176,7 @@ negotiationList = await BBMService.NegotiationsGetAsync(0);
protected void CreateNew()
{
// recupero counter
string newCode = BBMService.CounterGetNext($"ITEM.");
string newCode = BBMService.CounterGetNext($"ITEM");
DatabaseModels.ItemsModel newRecord = new DatabaseModels.ItemsModel()
{
CodItem = newCode,
@@ -193,7 +184,7 @@ negotiationList = await BBMService.NegotiationsGetAsync(0);
UM = "NR",
UnitCost = 1,
UnitPrice = 1,
Descript = "New Document"
Descript = "Nuovo Item"
};
currItem = newRecord;
}
@@ -204,7 +195,7 @@ negotiationList = await BBMService.NegotiationsGetAsync(0);
}
protected async Task Delete(SHERPA.BBM.DatabaseModels.ItemsModel currRecord)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler eliminare l'Item '{currRecord.CodDoc}'?"))
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler eliminare l'Item '{currRecord.CodItem}'?"))
return;
BBMService.ItemDelete(currRecord);
+1 -1
View File
@@ -411,7 +411,7 @@ namespace SHERPA.BBM.Controllers
dbCtx.SaveChanges();
done = true;
}
catch
catch (Exception exc)
{ }
return done;
}