fix split page Customers
This commit is contained in:
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SHERPA.BBM.UI.Pages
|
||||
{
|
||||
public partial class Bills
|
||||
public partial class Bills: ComponentBase
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SHERPA.BBM.UI.Pages
|
||||
{
|
||||
public partial class Counters
|
||||
public partial class Counters: ComponentBase
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
@page "/Customers"
|
||||
|
||||
@using SHERPA.BBM.UI.Data
|
||||
@using SHERPA.BBM.UI.Components
|
||||
|
||||
@inject BBM_SelectData SelectData
|
||||
@inject IJSRuntime JSRuntime
|
||||
@inject BBM_EFService BBMService
|
||||
@inject MessageService MessageService
|
||||
@implements IDisposable
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="row">
|
||||
@@ -65,84 +58,3 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
private DatabaseModels.CustomersModel currItem = null;
|
||||
private DatabaseModels.CustomersModel[] itemsList;
|
||||
|
||||
protected void CreateNew()
|
||||
{
|
||||
DatabaseModels.CustomersModel newRecord = new DatabaseModels.CustomersModel()
|
||||
{
|
||||
RagSoc = "RAG SOC",
|
||||
CF = "ABCDEF12G34H567I",
|
||||
PI = "IT000000000000",
|
||||
Descript = "Nuovo Cliente"
|
||||
};
|
||||
currItem = newRecord;
|
||||
}
|
||||
|
||||
protected async Task updateTable()
|
||||
{
|
||||
itemsList = await BBMService.CustomersGetAll(MessageService.SearchVal);
|
||||
}
|
||||
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
await updateTable();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
MessageService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
}
|
||||
|
||||
public void OnSeachUpdated()
|
||||
{
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
MessageService.ShowSearch = true;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
BBMService.rollBackEdit(currItem);
|
||||
currItem = null;
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currItem = null;
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected void Edit(SHERPA.BBM.DatabaseModels.CustomersModel currRecord)
|
||||
{
|
||||
currItem = currRecord;
|
||||
}
|
||||
|
||||
public string checkSelect(int CustomerId)
|
||||
{
|
||||
string answ = "";
|
||||
if (currItem != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currItem.CustomerId == CustomerId) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using SHERPA.BBM.UI.Data;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SHERPA.BBM.UI.Pages
|
||||
{
|
||||
public partial class Customers : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private DatabaseModels.CustomersModel currItem = null;
|
||||
|
||||
private DatabaseModels.CustomersModel[] itemsList;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
[Inject]
|
||||
private BBM_EFService BBMService { get; set; }
|
||||
|
||||
[Inject]
|
||||
private IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
private MessageService MessageService { get; set; }
|
||||
|
||||
[Inject]
|
||||
private BBM_SelectData SelectData { get; set; }
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int CustomerId)
|
||||
{
|
||||
string answ = "";
|
||||
if (currItem != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currItem.CustomerId == CustomerId) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
MessageService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
}
|
||||
|
||||
public void OnSeachUpdated()
|
||||
{
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void CreateNew()
|
||||
{
|
||||
DatabaseModels.CustomersModel newRecord = new DatabaseModels.CustomersModel()
|
||||
{
|
||||
RagSoc = "RAG SOC",
|
||||
CF = "ABCDEF12G34H567I",
|
||||
PI = "IT000000000000",
|
||||
Descript = "Nuovo Cliente"
|
||||
};
|
||||
currItem = newRecord;
|
||||
}
|
||||
|
||||
protected void Edit(SHERPA.BBM.DatabaseModels.CustomersModel currRecord)
|
||||
{
|
||||
currItem = currRecord;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
MessageService.ShowSearch = true;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
await updateTable();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
BBMService.rollBackEdit(currItem);
|
||||
currItem = null;
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currItem = null;
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected async Task updateTable()
|
||||
{
|
||||
itemsList = await BBMService.CustomersGetAll(MessageService.SearchVal);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<UserSecretsId>60fcdaab-6c1e-4bec-9d88-f7727ef1c12c</UserSecretsId>
|
||||
<ApplicationIcon>wwwroot\favicon.ico</ApplicationIcon>
|
||||
<Version>1.0.2105.2230</Version>
|
||||
<Version>1.0.2105.2235</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user