fix naming x refresh

This commit is contained in:
Samuele Locatelli
2023-06-01 12:35:40 +02:00
parent f3c76418eb
commit 253f3aefac
@@ -110,6 +110,20 @@ namespace WebDoorCreator.UI.Components.DoorMan
}
}
/// <summary>
/// Clona la porta selezionata con annesse door operations
/// </summary>
/// <returns></returns>
protected async Task CloneDoor()
{
var newDoorId = await WDService.DoorCloneToOrder(CurrDoor.DoorId, CurrDoor.OrderId, UserName, true);
if (newDoorId > 0)
{
await RequestRefreshSvg(newDoorId);
await closeModal();
}
}
protected async Task closeModal()
{
await Task.Delay(1);
@@ -137,75 +151,6 @@ namespace WebDoorCreator.UI.Components.DoorMan
}
}
/// <summary>
/// Clona la porta selezionata con annesse door operations
/// </summary>
/// <returns></returns>
protected async Task CloneDoor()
{
var newDoorId = await WDService.DoorCloneToOrder(CurrDoor.DoorId, CurrDoor.OrderId, UserName, true);
if (newDoorId > 0)
{
await doSave(newDoorId);
await closeModal();
}
}
/// <summary>
/// Effettua salvataggio record e generazione DDF
/// </summary>
/// <returns></returns>
protected async Task doSave(int newDoorId)
{
List<DoorOpModel>? listOpAll = await WDService.DoorOpGetByDoorId(newDoorId);
if (listOpAll != null)
{
List<DoorOpModel> listOp = listOpAll.Where(x => x.userConfirm != "" && x.DtConfirm != null).ToList();
if (listOp != null)
{
// chiamo metodo x avewre DDF serializzato
var CurrentCompoOrder = await WDService.ListValuesGetAll("*", "Hardware");
if (CurrentCompoOrder != null)
{
foreach (var item in CurrentCompoOrder.OrderBy(x => x.Ordinal).ToList())
{
ordListVal.Add(item.TableName);
}
}
listOp = listOp.OrderBy(d => ordListVal.IndexOf(d.ObjectId)).ToList();
string currDdf = currDdfConv.GetSerialized(listOp);
// FIXME TODO: si potrebbe eliminare in futuro che va su REDIS versione corrente
// del DDF generato
int currVers = await QDataServ.SendCalcReq(newDoorId, currDdf);
if (currVers > 0)
{
IsErr = false;
}
}
}
}
/// <summary>
/// Clona la porta selezionata con annesse door operations nel template selezionato...
/// </summary>
/// <returns></returns>
protected async Task SaveToTemplate()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Are you sure? this operation will copy current door to selected template order?"))
return;
// prendo ord templ dest...
var newDoorId = await WDService.DoorCloneToOrder(CurrDoor.DoorId, OrderIdTplSel, UserName, false);
if (newDoorId > 0)
{
await doSave(newDoorId);
await closeModal();
}
}
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
@@ -274,6 +219,61 @@ namespace WebDoorCreator.UI.Components.DoorMan
}
}
/// <summary>
/// Effettua salvataggio record e generazione DDF
/// </summary>
/// <returns></returns>
protected async Task RequestRefreshSvg(int newDoorId)
{
List<DoorOpModel>? listOpAll = await WDService.DoorOpGetByDoorId(newDoorId);
if (listOpAll != null)
{
List<DoorOpModel> listOp = listOpAll.Where(x => x.userConfirm != "" && x.DtConfirm != null).ToList();
if (listOp != null)
{
// chiamo metodo x avewre DDF serializzato
var CurrentCompoOrder = await WDService.ListValuesGetAll("*", "Hardware");
if (CurrentCompoOrder != null)
{
foreach (var item in CurrentCompoOrder.OrderBy(x => x.Ordinal).ToList())
{
ordListVal.Add(item.TableName);
}
}
listOp = listOp.OrderBy(d => ordListVal.IndexOf(d.ObjectId)).ToList();
string currDdf = currDdfConv.GetSerialized(listOp);
// FIXME TODO: si potrebbe eliminare in futuro che va su REDIS versione corrente
// del DDF generato
int currVers = await QDataServ.SendCalcReq(newDoorId, currDdf);
if (currVers > 0)
{
IsErr = false;
}
}
}
}
/// <summary>
/// Clona la porta selezionata con annesse door operations nel template selezionato...
/// </summary>
/// <returns></returns>
protected async Task SaveToTemplate()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Are you sure? this operation will copy current door to selected template order?"))
return;
// prendo ord templ dest...
var newDoorId = await WDService.DoorCloneToOrder(CurrDoor.DoorId, OrderIdTplSel, UserName, false);
if (newDoorId > 0)
{
await RequestRefreshSvg(newDoorId);
await closeModal();
}
}
#endregion Protected Methods
}
}