generated from Integry/Template_NetMauiBlazorHybrid
Fix vari
This commit is contained in:
@@ -22,7 +22,7 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
|
||||
|
||||
// Mappa i prospects
|
||||
var prospectMapper = mapper.Map<List<ContactDTO>>(prospectList);
|
||||
|
||||
|
||||
contactMapper.AddRange(prospectMapper);
|
||||
|
||||
return contactMapper;
|
||||
@@ -32,13 +32,15 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
|
||||
{
|
||||
if (isContact)
|
||||
{
|
||||
var contact = (await localDb.Get<AnagClie>(x => x.CodAnag != null && x.CodAnag.Equals(codAnag))).LastOrDefault();
|
||||
var contact = (await localDb.Get<AnagClie>(x => x.CodAnag != null && x.CodAnag.Equals(codAnag)))
|
||||
.LastOrDefault();
|
||||
|
||||
return contact == null ? null : mapper.Map<ContactDTO>(contact);
|
||||
}
|
||||
else
|
||||
{
|
||||
var contact = (await localDb.Get<PtbPros>(x => x.CodPpro != null && x.CodPpro.Equals(codAnag))).LastOrDefault();
|
||||
var contact = (await localDb.Get<PtbPros>(x => x.CodPpro != null && x.CodPpro.Equals(codAnag)))
|
||||
.LastOrDefault();
|
||||
|
||||
return contact == null ? null : mapper.Map<ContactDTO>(contact);
|
||||
}
|
||||
@@ -101,6 +103,9 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
|
||||
return returnDto;
|
||||
}
|
||||
|
||||
public Task InsertOrUpdate<T>(List<T> listToSave) =>
|
||||
localDb.InsertOrUpdate(listToSave);
|
||||
|
||||
public Task InsertOrUpdate<T>(T objectToSave) =>
|
||||
localDb.InsertOrUpdate<T>([objectToSave]);
|
||||
|
||||
|
||||
@@ -75,6 +75,16 @@ else
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Agente != null)
|
||||
{
|
||||
<div>
|
||||
<span class="info-title">Agente</span>
|
||||
<span class="info-text">
|
||||
@Agente.FullName
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -131,6 +141,7 @@ else
|
||||
private ContactDTO Anag { get; set; } = new();
|
||||
private List<PersRifDTO>? PersRif { get; set; }
|
||||
private List<JtbComt> Commesse { get; set; }
|
||||
private StbUser? Agente { get; set; }
|
||||
|
||||
private bool IsLoading { get; set; } = true;
|
||||
|
||||
@@ -160,6 +171,11 @@ else
|
||||
|
||||
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag != null && x.CodAnag.Equals(CodContact));
|
||||
|
||||
if (Anag.CodVage != null)
|
||||
{
|
||||
Agente = (await ManageData.GetTable<StbUser>(x => x.UserCode != null && x.UserCode.Equals(Anag.CodVage))).LastOrDefault();
|
||||
}
|
||||
|
||||
IsLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<NoDataAvailable Text="Nessun idirizzo trovato" />
|
||||
<NoDataAvailable Text="Nessun indirizzo trovato" />
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -128,6 +128,16 @@
|
||||
</MudChip>
|
||||
}
|
||||
}
|
||||
|
||||
@if (ActivityFileList != null)
|
||||
{
|
||||
foreach (var file in ActivityFileList)
|
||||
{
|
||||
<MudChip T="string" Color="Color.Default">
|
||||
@file.FileName
|
||||
</MudChip>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="container-button">
|
||||
@@ -214,6 +224,7 @@
|
||||
private List<JtbComt> Commesse { get; set; } = [];
|
||||
private List<AnagClie> Clienti { get; set; } = [];
|
||||
private List<PtbPros> Pros { get; set; } = [];
|
||||
private List<ActivityFileDto>? ActivityFileList { get; set; }
|
||||
|
||||
private bool IsNew => Id.IsNullOrEmpty();
|
||||
private bool IsView => !NetworkService.IsNetworkAvailable();
|
||||
@@ -336,6 +347,11 @@
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
if (!IsNew && Id != null)
|
||||
{
|
||||
ActivityFileList = await IntegryApiService.GetActivityFile(Id);
|
||||
}
|
||||
|
||||
Users = await ManageData.GetTable<StbUser>();
|
||||
ActivityResult = await ManageData.GetTable<StbActivityResult>();
|
||||
Clienti = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
|
||||
@@ -404,10 +420,10 @@
|
||||
{
|
||||
OnAfterChangeValue();
|
||||
|
||||
var result = await ConfirmMemo.ShowAsync();
|
||||
// var result = await ConfirmMemo.ShowAsync();
|
||||
|
||||
if (result is true)
|
||||
OpenAddMemo = !OpenAddMemo;
|
||||
// if (result is true)
|
||||
// OpenAddMemo = !OpenAddMemo;
|
||||
}
|
||||
|
||||
private void OpenSelectEsito()
|
||||
@@ -455,6 +471,7 @@
|
||||
private void Duplica()
|
||||
{
|
||||
var activityCopy = ActivityModel.Clone();
|
||||
activityCopy.ActivityId = null;
|
||||
|
||||
MudDialog.Cancel();
|
||||
Messenger.Send(new CopyActivityMessage(activityCopy));
|
||||
@@ -468,6 +485,8 @@
|
||||
{
|
||||
AttachedList ??= [];
|
||||
AttachedList.Add((AttachedDTO)result.Data);
|
||||
|
||||
LabelSave = "Aggiorna";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -380,9 +380,11 @@
|
||||
return;
|
||||
case {AnagClie: null, PtbPros: not null}:
|
||||
await ManageData.InsertOrUpdate(response.PtbPros);
|
||||
await ManageData.InsertOrUpdate(response.PtbProsRif);
|
||||
break;
|
||||
case { AnagClie: not null, PtbPros: null }:
|
||||
await ManageData.InsertOrUpdate(response.AnagClie);
|
||||
await ManageData.InsertOrUpdate(response.VtbCliePersRif);
|
||||
break;
|
||||
default:
|
||||
VisibleOverlay = false;
|
||||
|
||||
24
salesbook.Shared/Core/Dto/ActivityFileDto.cs
Normal file
24
salesbook.Shared/Core/Dto/ActivityFileDto.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class ActivityFileDto
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
[JsonPropertyName("fileName")]
|
||||
public string FileName { get; set; }
|
||||
|
||||
[JsonPropertyName("originalSize")]
|
||||
public int OriginalSize { get; set; }
|
||||
|
||||
[JsonPropertyName("lastUpd")]
|
||||
public DateTime LastUpd { get; set; }
|
||||
|
||||
[JsonPropertyName("descrizione")]
|
||||
public string Descrizione { get; set; }
|
||||
|
||||
[JsonPropertyName("modello")]
|
||||
public string Modello { get; set; }
|
||||
}
|
||||
@@ -10,4 +10,10 @@ public class CRMCreateContactResponseDTO
|
||||
|
||||
[JsonPropertyName("ptbPros")]
|
||||
public PtbPros? PtbPros { get; set; }
|
||||
|
||||
[JsonPropertyName("vtbCliePersRif")]
|
||||
public List<VtbCliePersRif> VtbCliePersRif { get; set; }
|
||||
|
||||
[JsonPropertyName("ptbProsRifs")]
|
||||
public List<PtbProsRif> PtbProsRif { get; set; }
|
||||
}
|
||||
12
salesbook.Shared/Core/Dto/CRMTransferProspectRequestDTO.cs
Normal file
12
salesbook.Shared/Core/Dto/CRMTransferProspectRequestDTO.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class CRMTransferProspectRequestDTO
|
||||
{
|
||||
[JsonPropertyName("codAnag")]
|
||||
public string? CodAnag { get; set; }
|
||||
|
||||
[JsonPropertyName("codPpro")]
|
||||
public string? CodPpro { get; set; }
|
||||
}
|
||||
10
salesbook.Shared/Core/Dto/CRMTransferProspectResponseDTO.cs
Normal file
10
salesbook.Shared/Core/Dto/CRMTransferProspectResponseDTO.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using salesbook.Shared.Core.Entity;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class CRMTransferProspectResponseDTO
|
||||
{
|
||||
[JsonPropertyName("anagClie")]
|
||||
public AnagClie? AnagClie { get; set; }
|
||||
}
|
||||
@@ -6,11 +6,36 @@ namespace salesbook.Shared.Core.Entity;
|
||||
[Table("ptb_pros_rif")]
|
||||
public class PtbProsRif
|
||||
{
|
||||
[PrimaryKey, Column("composite_key")]
|
||||
public string CompositeKey { get; set; }
|
||||
|
||||
private string? _codPpro;
|
||||
|
||||
[Column("cod_ppro"), JsonPropertyName("codPpro"), Indexed(Name = "PtbProsRifPK", Order = 1, Unique = true)]
|
||||
public string CodPpro { get; set; }
|
||||
public string? CodPpro
|
||||
{
|
||||
get => _codPpro;
|
||||
set
|
||||
{
|
||||
_codPpro = value;
|
||||
if (_codPpro != null && _idPersRif != null)
|
||||
UpdateCompositeKey();
|
||||
}
|
||||
}
|
||||
|
||||
private int? _idPersRif;
|
||||
|
||||
[Column("id_pers_rif"), JsonPropertyName("idPersRif"), Indexed(Name = "PtbProsRifPK", Order = 2, Unique = true)]
|
||||
public int IdPersRif { get; set; }
|
||||
public int? IdPersRif
|
||||
{
|
||||
get => _idPersRif;
|
||||
set
|
||||
{
|
||||
_idPersRif = value;
|
||||
if (_codPpro != null && _idPersRif != null)
|
||||
UpdateCompositeKey();
|
||||
}
|
||||
}
|
||||
|
||||
[Column("persona_rif"), JsonPropertyName("personaRif")]
|
||||
public string PersonaRif { get; set; }
|
||||
@@ -29,4 +54,7 @@ public class PtbProsRif
|
||||
|
||||
[Column("telefono"), JsonPropertyName("telefono")]
|
||||
public string Telefono { get; set; }
|
||||
|
||||
private void UpdateCompositeKey() =>
|
||||
CompositeKey = $"{CodPpro}::{IdPersRif}";
|
||||
}
|
||||
@@ -7,7 +7,7 @@ namespace salesbook.Shared.Core.Entity;
|
||||
public class StbActivity
|
||||
{
|
||||
[PrimaryKey, Column("activity_id"), JsonPropertyName("activityId")]
|
||||
public string ActivityId { get; set; }
|
||||
public string? ActivityId { get; set; }
|
||||
|
||||
[Column("activity_result_id"), JsonPropertyName("activityResultId")]
|
||||
public string? ActivityResultId { get; set; }
|
||||
|
||||
@@ -6,11 +6,36 @@ namespace salesbook.Shared.Core.Entity;
|
||||
[Table("stb_activity_type")]
|
||||
public class StbActivityType
|
||||
{
|
||||
[PrimaryKey, Column("composite_key")]
|
||||
public string CompositeKey { get; set; }
|
||||
|
||||
private string? _activityTypeId;
|
||||
|
||||
[Column("activity_type_id"), JsonPropertyName("activityTypeId"), Indexed(Name = "ActivityTypePK", Order = 1, Unique = true)]
|
||||
public string ActivityTypeId { get; set; }
|
||||
public string? ActivityTypeId
|
||||
{
|
||||
get => _activityTypeId;
|
||||
set
|
||||
{
|
||||
_activityTypeId = value;
|
||||
if (_activityTypeId != null && _flagTipologia != null)
|
||||
UpdateCompositeKey();
|
||||
}
|
||||
}
|
||||
|
||||
private string? _flagTipologia;
|
||||
|
||||
[Column("flag_tipologia"), JsonPropertyName("flagTipologia"), Indexed(Name = "ActivityTypePK", Order = 2, Unique = true)]
|
||||
public string FlagTipologia { get; set; }
|
||||
public string? FlagTipologia
|
||||
{
|
||||
get => _flagTipologia;
|
||||
set
|
||||
{
|
||||
_flagTipologia = value;
|
||||
if (_activityTypeId != null && _flagTipologia != null)
|
||||
UpdateCompositeKey();
|
||||
}
|
||||
}
|
||||
|
||||
[Column("estimated_duration"), JsonPropertyName("estimatedDuration")]
|
||||
public double? EstimatedDuration { get; set; } = 0;
|
||||
@@ -38,4 +63,7 @@ public class StbActivityType
|
||||
|
||||
[Column("flag_view_calendar"), JsonPropertyName("flagViewCalendar")]
|
||||
public bool FlagViewCalendar { get; set; }
|
||||
|
||||
private void UpdateCompositeKey() =>
|
||||
CompositeKey = $"{ActivityTypeId}::{FlagTipologia}";
|
||||
}
|
||||
@@ -6,11 +6,36 @@ namespace salesbook.Shared.Core.Entity;
|
||||
[Table("vtb_clie_pers_rif")]
|
||||
public class VtbCliePersRif
|
||||
{
|
||||
[PrimaryKey, Column("composite_key")]
|
||||
public string CompositeKey { get; set; }
|
||||
|
||||
private int? _idPersRif;
|
||||
|
||||
[Column("id_pers_rif"), JsonPropertyName("idPersRif"), Indexed(Name = "VtbCliePersRifPK", Order = 1, Unique = true)]
|
||||
public int IdPersRif { get; set; }
|
||||
public int? IdPersRif
|
||||
{
|
||||
get => _idPersRif;
|
||||
set
|
||||
{
|
||||
_idPersRif = value;
|
||||
if (_idPersRif != null && _codAnag != null)
|
||||
UpdateCompositeKey();
|
||||
}
|
||||
}
|
||||
|
||||
private string? _codAnag;
|
||||
|
||||
[Column("cod_anag"), JsonPropertyName("codAnag"), Indexed(Name = "VtbCliePersRifPK", Order = 2, Unique = true)]
|
||||
public string CodAnag { get; set; }
|
||||
public string? CodAnag
|
||||
{
|
||||
get => _codAnag;
|
||||
set
|
||||
{
|
||||
_codAnag = value;
|
||||
if (_idPersRif != null && _codAnag != null)
|
||||
UpdateCompositeKey();
|
||||
}
|
||||
}
|
||||
|
||||
[Column("persona_rif"), JsonPropertyName("personaRif")]
|
||||
public string PersonaRif { get; set; }
|
||||
@@ -38,4 +63,7 @@ public class VtbCliePersRif
|
||||
|
||||
[Column("data_ult_agg"), JsonPropertyName("dataUltAgg")]
|
||||
public DateTime? DataUltAgg { get; set; } = DateTime.Now;
|
||||
|
||||
private void UpdateCompositeKey() =>
|
||||
CompositeKey = $"{IdPersRif}::{CodAnag}";
|
||||
}
|
||||
@@ -6,11 +6,36 @@ namespace salesbook.Shared.Core.Entity;
|
||||
[Table("vtb_dest")]
|
||||
public class VtbDest
|
||||
{
|
||||
[PrimaryKey, Column("composite_key")]
|
||||
public string CompositeKey { get; set; }
|
||||
|
||||
private string? _codAnag;
|
||||
|
||||
[Column("cod_anag"), JsonPropertyName("codAnag"), Indexed(Name = "VtbDestPK", Order = 1, Unique = true)]
|
||||
public string CodAnag { get; set; }
|
||||
public string? CodAnag
|
||||
{
|
||||
get => _codAnag;
|
||||
set
|
||||
{
|
||||
_codAnag = value;
|
||||
if (_codAnag != null && _codVdes != null)
|
||||
UpdateCompositeKey();
|
||||
}
|
||||
}
|
||||
|
||||
private string? _codVdes;
|
||||
|
||||
[Column("cod_vdes"), JsonPropertyName("codVdes"), Indexed(Name = "VtbDestPK", Order = 2, Unique = true)]
|
||||
public string CodVdes { get; set; }
|
||||
public string? CodVdes
|
||||
{
|
||||
get => _codVdes;
|
||||
set
|
||||
{
|
||||
_codVdes = value;
|
||||
if (_codAnag != null && _codVdes != null)
|
||||
UpdateCompositeKey();
|
||||
}
|
||||
}
|
||||
|
||||
[Column("destinatario"), JsonPropertyName("destinatario")]
|
||||
public string Destinatario { get; set; }
|
||||
@@ -194,4 +219,7 @@ public class VtbDest
|
||||
|
||||
[Column("cod_fisc_legale"), JsonPropertyName("codFiscLegale")]
|
||||
public string CodFiscLegale { get; set; }
|
||||
|
||||
private void UpdateCompositeKey() =>
|
||||
CompositeKey = $"{CodAnag}::{CodVdes}";
|
||||
}
|
||||
@@ -16,9 +16,12 @@ public interface IIntegryApiService
|
||||
Task<List<StbActivity>?> SaveActivity(ActivityDTO activity);
|
||||
Task<CRMCreateContactResponseDTO?> SaveContact(CRMCreateContactRequestDTO request);
|
||||
Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request);
|
||||
Task<CRMTransferProspectResponseDTO> TransferProspect(CRMTransferProspectRequestDTO request);
|
||||
|
||||
Task UploadFile(string id, byte[] file, string fileName);
|
||||
|
||||
Task<List<ActivityFileDto>> GetActivityFile(string activityId);
|
||||
Task<Stream> DownloadFile(string activityId, string fileName);
|
||||
|
||||
//Position
|
||||
Task<PositionDTO> SavePosition(PositionDTO position);
|
||||
Task<PositionDTO> RetrievePosition(string id);
|
||||
|
||||
@@ -13,6 +13,7 @@ public interface IManageDataService
|
||||
Task<ContactDTO?> GetSpecificContact(string codAnag, bool IsContact);
|
||||
|
||||
Task InsertOrUpdate<T>(T objectToSave);
|
||||
Task InsertOrUpdate<T>(List<T> listToSave);
|
||||
|
||||
Task Delete<T>(T objectToDelete);
|
||||
Task DeleteActivity(ActivityDTO activity);
|
||||
|
||||
@@ -72,6 +72,9 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
public Task<CRMCreateContactResponseDTO?> SaveContact(CRMCreateContactRequestDTO request) =>
|
||||
integryApiRestClient.AuthorizedPost<CRMCreateContactResponseDTO>("crm/createContact", request);
|
||||
|
||||
public Task<CRMTransferProspectResponseDTO> TransferProspect(CRMTransferProspectRequestDTO request) =>
|
||||
integryApiRestClient.AuthorizedPost<CRMTransferProspectResponseDTO>("crm/transferProspect", request)!;
|
||||
|
||||
public Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request) =>
|
||||
integryApiRestClient.Post<CheckVatResponseDTO>("checkPartitaIva", request)!;
|
||||
|
||||
@@ -113,7 +116,7 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
{
|
||||
var queryParams = new Dictionary<string, object> { { "activityId", activityId } };
|
||||
|
||||
using var content = new MultipartFormDataContent();
|
||||
var content = new MultipartFormDataContent();
|
||||
var fileContent = new ByteArrayContent(file);
|
||||
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data");
|
||||
content.Add(fileContent, "files", fileName);
|
||||
@@ -121,6 +124,19 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
return integryApiRestClient.Post<object>($"uploadStbActivityFileAttachment", content, queryParams);
|
||||
}
|
||||
|
||||
public Task<List<ActivityFileDto>> GetActivityFile(string activityId)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object>
|
||||
{
|
||||
{ "activityId", activityId }
|
||||
};
|
||||
|
||||
return integryApiRestClient.AuthorizedGet<List<ActivityFileDto>>($"activity/getActivityFile", queryParams)!;
|
||||
}
|
||||
|
||||
public Task<Stream> DownloadFile(string activityId, string fileName) =>
|
||||
integryApiRestClient.Download($"downloadStbFileAttachment/{activityId}/{fileName}")!;
|
||||
|
||||
public Task<PositionDTO> SavePosition(PositionDTO position) =>
|
||||
integryApiRestClient.Post<PositionDTO>("savePosition", position)!;
|
||||
|
||||
|
||||
@@ -32,6 +32,11 @@ public class ManageDataService : IManageDataService
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task InsertOrUpdate<T>(List<T> listToSave)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task Delete<T>(T objectToDelete)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
Reference in New Issue
Block a user