Cambiata visualizzazione calendario e aggiunto formAttività
This commit is contained in:
@@ -5,8 +5,11 @@ namespace Template.Maui
|
||||
public App()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
MainPage = new MainPage();
|
||||
protected override Window CreateWindow(IActivationState? activationState)
|
||||
{
|
||||
return new Window(new MainPage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Linq.Expressions;
|
||||
using SQLite;
|
||||
using SQLite;
|
||||
using System.Linq.Expressions;
|
||||
using Template.Shared.Core.Entity;
|
||||
|
||||
namespace Template.Maui.Core.Services;
|
||||
|
||||
public class LocalDbService
|
||||
@@ -13,7 +12,6 @@ public class LocalDbService
|
||||
{
|
||||
_connection = new SQLiteAsyncConnection(Path.Combine(FileSystem.AppDataDirectory, DB_NAME));
|
||||
|
||||
//Creazione tabelle database
|
||||
_connection.CreateTableAsync<AnagClie>();
|
||||
_connection.CreateTableAsync<JtbComt>();
|
||||
_connection.CreateTableAsync<PtbPros>();
|
||||
@@ -52,9 +50,24 @@ public class LocalDbService
|
||||
}
|
||||
}
|
||||
|
||||
public Task Insert<T>(List<T> entityList) =>
|
||||
public Task InsertAll<T>(List<T> entityList) =>
|
||||
_connection.InsertAllAsync(entityList, typeof(T));
|
||||
|
||||
public async Task Insert<T>(List<T> entityList)
|
||||
{
|
||||
foreach (var entity in entityList)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _connection.InsertAsync(entity, typeof(T));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Errore db su {entity}: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task InsertOrUpdate<T>(List<T> entityList)
|
||||
{
|
||||
foreach (var entity in entityList)
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -10,7 +10,7 @@ public class SyncDbService(IIntegryApiService integryApiService, LocalDbService
|
||||
|
||||
if (allActivity is not null)
|
||||
if (dateFilter is null)
|
||||
await localDb.Insert(allActivity);
|
||||
await localDb.InsertAll(allActivity);
|
||||
else
|
||||
await localDb.InsertOrUpdate(allActivity);
|
||||
}
|
||||
@@ -21,49 +21,50 @@ public class SyncDbService(IIntegryApiService integryApiService, LocalDbService
|
||||
|
||||
if (allCommesse is not null)
|
||||
if (dateFilter is null)
|
||||
await localDb.Insert(allCommesse);
|
||||
await localDb.InsertAll(allCommesse);
|
||||
else
|
||||
await localDb.InsertOrUpdate(allCommesse);
|
||||
}
|
||||
|
||||
public async Task GetAndSaveProspect(string? dateFilter)
|
||||
{
|
||||
var tasks = new List<Task>();
|
||||
var taskSyncResponseDto = await integryApiService.GetProspect(dateFilter);
|
||||
|
||||
if (taskSyncResponseDto.PtbPros is not null)
|
||||
if (dateFilter is null)
|
||||
await localDb.Insert(taskSyncResponseDto.PtbPros);
|
||||
else
|
||||
await localDb.InsertOrUpdate(taskSyncResponseDto.PtbPros);
|
||||
tasks.Add(dateFilter is null
|
||||
? localDb.InsertAll(taskSyncResponseDto.PtbPros)
|
||||
: localDb.InsertOrUpdate(taskSyncResponseDto.PtbPros));
|
||||
|
||||
if (taskSyncResponseDto.PtbProsRif is not null)
|
||||
if (dateFilter is null)
|
||||
await localDb.Insert(taskSyncResponseDto.PtbProsRif);
|
||||
else
|
||||
await localDb.InsertOrUpdate(taskSyncResponseDto.PtbProsRif);
|
||||
tasks.Add(dateFilter is null
|
||||
? localDb.Insert(taskSyncResponseDto.PtbProsRif)
|
||||
: localDb.InsertOrUpdate(taskSyncResponseDto.PtbProsRif));
|
||||
|
||||
await Task.WhenAll(tasks.AsEnumerable());
|
||||
}
|
||||
|
||||
public async Task GetAndSaveClienti(string? dateFilter)
|
||||
{
|
||||
var tasks = new List<Task>();
|
||||
var taskSyncResponseDto = await integryApiService.GetAnagClie(dateFilter);
|
||||
|
||||
if (taskSyncResponseDto.AnagClie is not null)
|
||||
if (dateFilter is null)
|
||||
await localDb.Insert(taskSyncResponseDto.AnagClie);
|
||||
else
|
||||
await localDb.InsertOrUpdate(taskSyncResponseDto.AnagClie);
|
||||
tasks.Add(dateFilter is null
|
||||
? localDb.InsertAll(taskSyncResponseDto.AnagClie)
|
||||
: localDb.InsertOrUpdate(taskSyncResponseDto.AnagClie));
|
||||
|
||||
if (taskSyncResponseDto.VtbDest is not null)
|
||||
if (dateFilter is null)
|
||||
await localDb.Insert(taskSyncResponseDto.VtbDest);
|
||||
else
|
||||
await localDb.InsertOrUpdate(taskSyncResponseDto.VtbDest);
|
||||
tasks.Add(dateFilter is null
|
||||
? localDb.Insert(taskSyncResponseDto.VtbDest)
|
||||
: localDb.InsertOrUpdate(taskSyncResponseDto.VtbDest));
|
||||
|
||||
if (taskSyncResponseDto.VtbCliePersRif is not null)
|
||||
if (dateFilter is null)
|
||||
await localDb.Insert(taskSyncResponseDto.VtbCliePersRif);
|
||||
else
|
||||
await localDb.InsertOrUpdate(taskSyncResponseDto.VtbCliePersRif);
|
||||
tasks.Add(dateFilter is null
|
||||
? localDb.Insert(taskSyncResponseDto.VtbCliePersRif)
|
||||
: localDb.InsertOrUpdate(taskSyncResponseDto.VtbCliePersRif));
|
||||
|
||||
await Task.WhenAll(tasks.AsEnumerable());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using CommunityToolkit.Maui;
|
||||
using IntegryApiClient.MAUI;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -22,11 +23,12 @@ namespace Template.Maui
|
||||
var builder = MauiApp.CreateBuilder();
|
||||
builder
|
||||
.UseMauiApp<App>()
|
||||
.UseLoginAzienda(AppToken)
|
||||
.UseMauiCommunityToolkit()
|
||||
.ConfigureFonts(fonts =>
|
||||
{
|
||||
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
|
||||
});
|
||||
})
|
||||
.UseLoginAzienda(AppToken);
|
||||
|
||||
builder.Services.AddMauiBlazorWebView();
|
||||
builder.Services.AddMudServices();
|
||||
@@ -46,7 +48,7 @@ namespace Template.Maui
|
||||
|
||||
#if DEBUG
|
||||
builder.Services.AddBlazorWebViewDeveloperTools();
|
||||
builder.Logging.AddDebug();
|
||||
builder.Logging.AddDebug();
|
||||
#endif
|
||||
|
||||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using ObjCRuntime;
|
||||
using UIKit;
|
||||
|
||||
namespace Template.Maui
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net9.0-ios;net9.0-android</TargetFrameworks>
|
||||
<TargetFrameworks>$(TargetFrameworks);net9.0-android</TargetFrameworks>
|
||||
<TargetFrameworks>$(TargetFrameworks);net9.0-ios</TargetFrameworks>
|
||||
<!--<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>-->
|
||||
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
|
||||
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
|
||||
@@ -112,12 +113,12 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Maui" Version="11.2.0" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="IntegryApiClient.MAUI" Version="1.1.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.60" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.60" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.60" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.4" />
|
||||
<PackageReference Include="IntegryApiClient.MAUI" Version="1.1.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.70" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.70" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.70" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.5" />
|
||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
</div>
|
||||
|
||||
<script src="_framework/blazor.webview.js" autostart="false"></script>
|
||||
<script src="_content/Template.Shared/js/bootstrap/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
<script src="_content/Template.Shared/js/bootstrap/bootstrap.bundle.min.js"></script>
|
||||
<!-- Add chart.js reference if chart components are used in your application. -->
|
||||
<!--<script src="_content/Template.Shared/js/bootstrap/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
|
||||
<!-- Add chartjs-plugin-datalabels.min.js reference if chart components with data label feature is used in your application. -->
|
||||
@@ -43,6 +43,7 @@
|
||||
<!--<script src="_content/Template.Shared/js/bootstrap/Sortable.min.js"></script>-->
|
||||
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
|
||||
<script src="_content/Template.Shared/js/main.js"></script>
|
||||
<script src="_content/Template.Shared/js/calendar.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user