Fix sync utenti
This commit is contained in:
@@ -126,15 +126,29 @@ public class ManageDataService(
|
||||
FilterDate = lastSync
|
||||
}
|
||||
);
|
||||
|
||||
_ = UpdateDbUsers(new UsersSyncResponseDTO
|
||||
|
||||
if (lastSync == null)
|
||||
{
|
||||
AnagClie = clienti.AnagClie,
|
||||
VtbDest = clienti.VtbDest,
|
||||
VtbCliePersRif = clienti.VtbCliePersRif,
|
||||
PtbPros = prospect.PtbPros,
|
||||
PtbProsRif = prospect.PtbProsRif
|
||||
});
|
||||
await InsertDbUsers(new UsersSyncResponseDTO
|
||||
{
|
||||
AnagClie = clienti.AnagClie,
|
||||
VtbDest = clienti.VtbDest,
|
||||
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)
|
||||
{
|
||||
@@ -325,6 +339,24 @@ public class ManageDataService(
|
||||
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)
|
||||
{
|
||||
return Task.Run(async () =>
|
||||
|
||||
Reference in New Issue
Block a user