Ancora modifica editing DOCS
This commit is contained in:
@@ -132,6 +132,17 @@ namespace SHERPA.BBM.UI.Data
|
||||
}
|
||||
}
|
||||
|
||||
public void DocSetActive(DatabaseModels.DocsModel currItem)
|
||||
{
|
||||
try
|
||||
{
|
||||
dbController.DocSetActive(currItem);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void ItemAdd(DatabaseModels.ItemsModel newItem)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
@foreach (var record in itemsList)
|
||||
{
|
||||
<tr>
|
||||
<td><button class="btn btn-sm btn-info" @onclick="() => Edit(record)"><span class="oi oi-pencil"></span></button> <button class="btn btn-sm btn-success" @onclick="() => ShowResources(record)" title="Vai al dettaglio risorse"><span class="oi oi-puzzle-piece"></span></button></td>
|
||||
<td><button class="btn btn-sm btn-info" @onclick="() => Edit(record)"><span class="oi oi-pencil"></span></button> <button class="btn btn-sm btn-warning" @onclick="() => NewRelease(record)" title="Clona"><span class="oi oi-wrench"></span></button> <button class="btn btn-sm btn-success" @onclick="() => ShowResources(record)" title="Vai al dettaglio risorse"><span class="oi oi-puzzle-piece"></span></button></td>
|
||||
<td><input type="checkbox" value="@record.IsActive" @onclick="() => SetActive(record)" /></td>
|
||||
<td>@record.DocType</td>
|
||||
<td>@record.CodDoc</td>
|
||||
@@ -125,7 +125,7 @@
|
||||
int.TryParse(NegtIdReq, out NegotiationIdReq);
|
||||
_SelCodNegotiation = NegotiationIdReq;
|
||||
}
|
||||
updateTable();
|
||||
updateTable().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private int numRecord { get; set; } = 10;
|
||||
@@ -150,7 +150,7 @@
|
||||
set
|
||||
{
|
||||
_SelBasketId = value;
|
||||
updateTable();
|
||||
updateTable().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
private int SelCodNegotiation
|
||||
@@ -162,7 +162,7 @@
|
||||
set
|
||||
{
|
||||
_SelCodNegotiation = value;
|
||||
updateTable();
|
||||
updateTable().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
{
|
||||
basketList = await BBMService.BasketsGetAsync(0);
|
||||
negotiationList = await BBMService.NegotiationsGetAsync(0);
|
||||
updateTable();
|
||||
await updateTable();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
@@ -219,15 +219,34 @@
|
||||
currItem = newRecord;
|
||||
}
|
||||
|
||||
protected void NewRelease(DatabaseModels.DocsModel currRecord)
|
||||
{
|
||||
// recupero counter
|
||||
string newCode = BBMService.CounterGetNext($"EGW.D.{DateTime.Today.Year}");
|
||||
DatabaseModels.DocsModel newRecord = new DatabaseModels.DocsModel()
|
||||
{
|
||||
CodDoc = newCode,
|
||||
DataIns = DateTime.Now,
|
||||
NegotiationId = currRecord.NegotiationId,
|
||||
BasketId = currRecord.BasketId,
|
||||
DocPath = currRecord.DocPath,
|
||||
NumDoc = currRecord.NumDoc + 1,
|
||||
DocType = currRecord.DocType,
|
||||
Descript = "COPIA di " + currRecord.Descript
|
||||
};
|
||||
currItem = newRecord;
|
||||
}
|
||||
|
||||
protected void Edit(SHERPA.BBM.DatabaseModels.DocsModel currRecord)
|
||||
{
|
||||
currItem = currRecord;
|
||||
}
|
||||
|
||||
protected void SetActive(SHERPA.BBM.DatabaseModels.DocsModel currRecord)
|
||||
protected async Task SetActive(SHERPA.BBM.DatabaseModels.DocsModel currRecord)
|
||||
{
|
||||
// imposto ad attivo SOLO il DOC corrente tra quelli della negoziazione
|
||||
BBMService.DocSetActive(currRecord);
|
||||
await UpdateData();
|
||||
}
|
||||
|
||||
protected void ShowResources(SHERPA.BBM.DatabaseModels.DocsModel currRecord)
|
||||
|
||||
@@ -323,12 +323,13 @@ namespace SHERPA.BBM.Controllers
|
||||
bool done = false;
|
||||
try
|
||||
{
|
||||
// attivo record corrente
|
||||
var currData = dbCtx
|
||||
.DbSetDocs
|
||||
.DbSetDocs
|
||||
.Where(x => x.DocId == updItem.DocId)
|
||||
.FirstOrDefault()
|
||||
.IsActive=true;
|
||||
|
||||
.FirstOrDefault();
|
||||
currData.IsActive=true;
|
||||
// altri record da disattivare
|
||||
var otherData = dbCtx
|
||||
.DbSetDocs
|
||||
.Where(x => x.NegotiationId == updItem.NegotiationId && x.DocId != updItem.DocId)
|
||||
@@ -336,8 +337,16 @@ namespace SHERPA.BBM.Controllers
|
||||
foreach (var item in otherData)
|
||||
{
|
||||
item.IsActive = false;
|
||||
|
||||
}
|
||||
dbCtx.SaveChanges();
|
||||
// rileggo
|
||||
dbCtx.Entry(currData).Reload();
|
||||
// anche altri valori
|
||||
foreach (var item in otherData)
|
||||
{
|
||||
dbCtx.Entry(item).Reload();
|
||||
}
|
||||
done = true;
|
||||
}
|
||||
catch
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace SHERPA.BBM.DatabaseModels
|
||||
public BbmDocType DocType { get; set; } = BbmDocType.Quote;
|
||||
|
||||
[Column("IsActive", Order = 9)]
|
||||
public bool IsActive { get; set; } = true;
|
||||
public bool IsActive { get; set; } = false;
|
||||
|
||||
[ForeignKey("NegotiationId")]
|
||||
public virtual NegotiationsModel Negotiation { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user