Fix sync utenti
This commit is contained in:
@@ -126,15 +126,29 @@ public class ManageDataService(
|
|||||||
FilterDate = lastSync
|
FilterDate = lastSync
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
_ = UpdateDbUsers(new UsersSyncResponseDTO
|
if (lastSync == null)
|
||||||
{
|
{
|
||||||
AnagClie = clienti.AnagClie,
|
await InsertDbUsers(new UsersSyncResponseDTO
|
||||||
VtbDest = clienti.VtbDest,
|
{
|
||||||
VtbCliePersRif = clienti.VtbCliePersRif,
|
AnagClie = clienti.AnagClie,
|
||||||
PtbPros = prospect.PtbPros,
|
VtbDest = clienti.VtbDest,
|
||||||
PtbProsRif = prospect.PtbProsRif
|
VtbCliePersRif = clienti.VtbCliePersRif,
|
||||||
});
|
PtbPros = prospect.PtbPros,
|
||||||
|
PtbProsRif = prospect.PtbProsRif
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_ = UpdateDbUsers(new UsersSyncResponseDTO
|
||||||
|
{
|
||||||
|
AnagClie = clienti.AnagClie,
|
||||||
|
VtbDest = clienti.VtbDest,
|
||||||
|
VtbCliePersRif = clienti.VtbCliePersRif,
|
||||||
|
PtbPros = prospect.PtbPros,
|
||||||
|
PtbProsRif = prospect.PtbProsRif
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (lastSync != null)
|
if (lastSync != null)
|
||||||
{
|
{
|
||||||
@@ -325,6 +339,24 @@ public class ManageDataService(
|
|||||||
return returnDto;
|
return returnDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task InsertDbUsers(UsersSyncResponseDTO response)
|
||||||
|
{
|
||||||
|
if (response.AnagClie != null)
|
||||||
|
{
|
||||||
|
await localDb.InsertAll(response.AnagClie);
|
||||||
|
|
||||||
|
if (response.VtbDest != null) await localDb.InsertAll(response.VtbDest);
|
||||||
|
if (response.VtbCliePersRif != null) await localDb.InsertAll(response.VtbCliePersRif);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.PtbPros != null)
|
||||||
|
{
|
||||||
|
await localDb.InsertAll(response.PtbPros);
|
||||||
|
|
||||||
|
if (response.PtbProsRif != null) await localDb.InsertAll(response.PtbProsRif);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Task UpdateDbUsers(UsersSyncResponseDTO response)
|
private Task UpdateDbUsers(UsersSyncResponseDTO response)
|
||||||
{
|
{
|
||||||
return Task.Run(async () =>
|
return Task.Run(async () =>
|
||||||
|
|||||||
@@ -3,12 +3,14 @@
|
|||||||
@using salesbook.Shared.Components.Layout
|
@using salesbook.Shared.Components.Layout
|
||||||
@using salesbook.Shared.Components.SingleElements
|
@using salesbook.Shared.Components.SingleElements
|
||||||
@using salesbook.Shared.Core.Authorization.Enum
|
@using salesbook.Shared.Core.Authorization.Enum
|
||||||
|
@using salesbook.Shared.Core.Dto.PageState
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@using salesbook.Shared.Core.Interface.System.Network
|
@using salesbook.Shared.Core.Interface.System.Network
|
||||||
@using salesbook.Shared.Core.Services
|
@using salesbook.Shared.Core.Services
|
||||||
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
||||||
@inject INetworkService NetworkService
|
@inject INetworkService NetworkService
|
||||||
@inject IFormFactor FormFactor
|
@inject IFormFactor FormFactor
|
||||||
|
@inject UserListState UserState
|
||||||
|
|
||||||
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="Profilo" ShowProfile="false"/>
|
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="Profilo" ShowProfile="false"/>
|
||||||
|
|
||||||
@@ -155,18 +157,10 @@
|
|||||||
private void UpdateDb(bool withData = false)
|
private void UpdateDb(bool withData = false)
|
||||||
{
|
{
|
||||||
LocalStorage.Remove("last-user-sync");
|
LocalStorage.Remove("last-user-sync");
|
||||||
|
UserState.IsLoaded = false;
|
||||||
var absoluteUri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
|
UserState.IsLoading = false;
|
||||||
var pathAndQuery = absoluteUri.Segments.Length > 1 ? absoluteUri.PathAndQuery : null;
|
|
||||||
|
|
||||||
string path;
|
NavigationManager.NavigateTo(withData ? $"/sync/{DateTime.Today:yyyy-MM-dd}" : "/sync", replace: true);
|
||||||
|
|
||||||
if (withData)
|
|
||||||
path = pathAndQuery == null ? $"/sync/{DateTime.Today:yyyy-MM-dd}" : $"/sync/{DateTime.Today:yyyy-MM-dd}?path=" + System.Web.HttpUtility.UrlEncode(pathAndQuery);
|
|
||||||
else
|
|
||||||
path = pathAndQuery == null ? "/sync" : "/sync?path=" + System.Web.HttpUtility.UrlEncode(pathAndQuery);
|
|
||||||
|
|
||||||
NavigationManager.NavigateTo(path, replace: true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,8 +3,10 @@
|
|||||||
@using salesbook.Shared.Components.Layout.Spinner
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
@using salesbook.Shared.Components.SingleElements
|
@using salesbook.Shared.Components.SingleElements
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
|
@using salesbook.Shared.Core.Services
|
||||||
@inject ISyncDbService SyncDb
|
@inject ISyncDbService SyncDb
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
|
@inject PreloadService PreloadService
|
||||||
|
|
||||||
<SyncSpinner Elements="@Elements"/>
|
<SyncSpinner Elements="@Elements"/>
|
||||||
|
|
||||||
@@ -55,6 +57,11 @@
|
|||||||
var originalPath = pathQuery["path"] ?? null;
|
var originalPath = pathQuery["path"] ?? null;
|
||||||
var path = originalPath ?? "/Calendar";
|
var path = originalPath ?? "/Calendar";
|
||||||
|
|
||||||
|
if (path.Equals("/Calendar") && DateFilter is null)
|
||||||
|
{
|
||||||
|
_ = Task.Run(() => { _ = PreloadService.PreloadUsersAsync(); });
|
||||||
|
}
|
||||||
|
|
||||||
NavigationManager.NavigateTo(path, replace: true);
|
NavigationManager.NavigateTo(path, replace: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
OnSave="() => OpenUserForm(Anag)"
|
OnSave="() => OpenUserForm(Anag)"
|
||||||
Back="true"
|
Back="true"
|
||||||
BackOnTop="true"
|
BackOnTop="true"
|
||||||
Title=""
|
Title="@Anag.CodContact"
|
||||||
ShowProfile="false"/>
|
ShowProfile="false"/>
|
||||||
|
|
||||||
@if (IsLoading)
|
@if (IsLoading)
|
||||||
@@ -111,7 +111,7 @@ else
|
|||||||
<label class="tab-trigger" for="tab2" @onclick="() => SwitchTab(1)">Commesse</label>
|
<label class="tab-trigger" for="tab2" @onclick="() => SwitchTab(1)">Commesse</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="tab-item">
|
<li class="tab-item">
|
||||||
<label class="tab-trigger" for="tab3" @onclick="() => SwitchTab(2)">Attivit<EFBFBD></label>
|
<label class="tab-trigger" for="tab3" @onclick="() => SwitchTab(2)">Attività</label>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -219,7 +219,7 @@ else
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tab Attivit<EFBFBD> -->
|
<!-- Tab Attività -->
|
||||||
<div class="tab-content" style="display: @(ActiveTab == 2 ? "block" : "none")">
|
<div class="tab-content" style="display: @(ActiveTab == 2 ? "block" : "none")">
|
||||||
@if (ActivityIsLoading)
|
@if (ActivityIsLoading)
|
||||||
{
|
{
|
||||||
@@ -227,7 +227,7 @@ else
|
|||||||
}
|
}
|
||||||
else if (ActivityList?.Count == 0)
|
else if (ActivityList?.Count == 0)
|
||||||
{
|
{
|
||||||
<NoDataAvailable Text="Nessuna attivit<EFBFBD> presente"/>
|
<NoDataAvailable Text="Nessuna attività presente"/>
|
||||||
}
|
}
|
||||||
else if (ActivityList != null)
|
else if (ActivityList != null)
|
||||||
{
|
{
|
||||||
@@ -309,7 +309,7 @@ else
|
|||||||
private string _searchTermCommesse = string.Empty;
|
private string _searchTermCommesse = string.Empty;
|
||||||
private List<JtbComt> _filteredCommesse = [];
|
private List<JtbComt> _filteredCommesse = [];
|
||||||
|
|
||||||
// Paginazione e filtri per ATTIVIT<EFBFBD>
|
// Paginazione e filtri per attività
|
||||||
private int _currentPageActivity = 1;
|
private int _currentPageActivity = 1;
|
||||||
private int _selectedPageSizeActivity = 5;
|
private int _selectedPageSizeActivity = 5;
|
||||||
private string _searchTermActivity = string.Empty;
|
private string _searchTermActivity = string.Empty;
|
||||||
@@ -381,7 +381,7 @@ else
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties per Attivit<EFBFBD>
|
#region Properties per Attività
|
||||||
|
|
||||||
private int CurrentPageActivityIndex
|
private int CurrentPageActivityIndex
|
||||||
{
|
{
|
||||||
@@ -445,7 +445,7 @@ else
|
|||||||
{
|
{
|
||||||
_loadingCts = new CancellationTokenSource();
|
_loadingCts = new CancellationTokenSource();
|
||||||
|
|
||||||
if (UserState.CodUser?.Equals(CodContact) == true)
|
if (UserState.CodUser != null && UserState.CodUser.Equals(CodContact))
|
||||||
{
|
{
|
||||||
LoadDataFromSession();
|
LoadDataFromSession();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user