Migliorata gestione e visualizzazione notifiche
This commit is contained in:
@@ -10,6 +10,7 @@ using salesbook.Shared.Core.Interface.IntegryApi;
|
||||
using salesbook.Shared.Core.Interface.System.Network;
|
||||
using Sentry.Protocol;
|
||||
using System.Linq.Expressions;
|
||||
using salesbook.Shared.Core.Helpers;
|
||||
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
@@ -159,6 +160,35 @@ public class ManageDataService(
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<ActivityDTO>> GetActivityTryLocalDb(WhereCondActivity whereCond)
|
||||
{
|
||||
List<StbActivity>? activities;
|
||||
|
||||
activities = await localDb.Get<StbActivity>(x =>
|
||||
(whereCond.ActivityId != null && x.ActivityId != null && whereCond.ActivityId.Equals(x.ActivityId)) ||
|
||||
(whereCond.Start != null && whereCond.End != null && x.EffectiveDate == null &&
|
||||
x.EstimatedDate >= whereCond.Start && x.EstimatedDate <= whereCond.End) ||
|
||||
(x.EffectiveDate >= whereCond.Start && x.EffectiveDate <= whereCond.End) ||
|
||||
(whereCond.ActivityId == null && (whereCond.Start == null || whereCond.End == null))
|
||||
);
|
||||
|
||||
if (activities.IsNullOrEmpty() && networkService.ConnectionAvailable)
|
||||
{
|
||||
activities = await integryApiService.RetrieveActivity(
|
||||
new CRMRetrieveActivityRequestDTO
|
||||
{
|
||||
StarDate = whereCond.Start,
|
||||
EndDate = whereCond.End,
|
||||
ActivityId = whereCond.ActivityId
|
||||
}
|
||||
);
|
||||
|
||||
_ = UpdateDb(activities);
|
||||
}
|
||||
|
||||
return await MapActivity(activities);
|
||||
}
|
||||
|
||||
public async Task<List<ActivityDTO>> GetActivity(WhereCondActivity whereCond, bool useLocalDb)
|
||||
{
|
||||
List<StbActivity>? activities;
|
||||
@@ -187,6 +217,11 @@ public class ManageDataService(
|
||||
);
|
||||
}
|
||||
|
||||
return await MapActivity(activities);
|
||||
}
|
||||
|
||||
private async Task<List<ActivityDTO>> MapActivity(List<StbActivity>? activities)
|
||||
{
|
||||
if (activities == null) return [];
|
||||
|
||||
var codJcomList = activities
|
||||
|
||||
Reference in New Issue
Block a user