Cambiata visualizzazione calendario e aggiunto formAttività

This commit is contained in:
2025-06-11 10:11:20 +02:00
parent d462e9faca
commit d8f2588e0e
52 changed files with 1308 additions and 4734 deletions

View File

@@ -37,12 +37,21 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
var codJcomList = activities
.Select(x => x.CodJcom)
.Where(x => !string.IsNullOrEmpty(x))
.Distinct()
.ToList();
.Distinct().ToList();
var jtbComtList = await localDb.Get<JtbComt>(x => codJcomList.Contains(x.CodJcom));
var commesseDict = jtbComtList.ToDictionary(x => x.CodJcom, x => x.Descrizione);
var codAnagList = activities
.Select(x => x.CodAnag)
.Where(x => !string.IsNullOrEmpty(x))
.Distinct().ToList();
var clientList = await localDb.Get<AnagClie>(x => codAnagList.Contains(x.CodAnag));
var distinctClient = clientList.ToDictionary(x => x.CodAnag, x => x.RagSoc);
var prospectList = await localDb.Get<PtbPros>(x => codAnagList.Contains(x.CodPpro));
var distinctProspect = prospectList.ToDictionary(x => x.CodPpro, x => x.RagSoc);
var returnDto = activities
.Select(activity =>
{
@@ -57,6 +66,16 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
dto.Category = activity.CodAnag != null ? ActivityCategoryEnum.Interna : ActivityCategoryEnum.Memo;
}
if (dto.Category == ActivityCategoryEnum.Interna && activity.CodAnag != null)
{
string? ragSoc;
if (distinctClient.TryGetValue(activity.CodAnag, out ragSoc) || distinctProspect.TryGetValue(activity.CodAnag, out ragSoc))
{
dto.Cliente = ragSoc;
}
}
dto.Commessa = activity.CodJcom != null && commesseDict.TryGetValue(activity.CodJcom, out var descr)
? descr
: null;
@@ -67,6 +86,6 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
return returnDto;
}
public async Task ClearDb() =>
await localDb.ResetDb();
public Task ClearDb() =>
localDb.ResetDb();
}