Implementata gestione allegati
This commit is contained in:
@@ -11,6 +11,8 @@ public class ActivityDTO : StbActivity
|
||||
public bool Complete { get; set; }
|
||||
|
||||
public bool Deleted { get; set; }
|
||||
|
||||
public PositionDTO? Position { get; set; }
|
||||
|
||||
public ActivityDTO Clone()
|
||||
{
|
||||
|
||||
24
salesbook.Shared/Core/Dto/AttachedDTO.cs
Normal file
24
salesbook.Shared/Core/Dto/AttachedDTO.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class AttachedDTO
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
public string? MimeType { get; set; }
|
||||
public long? DimensionBytes { get; set; }
|
||||
public string? Path { get; set; }
|
||||
public byte[]? FileContent { get; set; }
|
||||
|
||||
public double? Lat { get; set; }
|
||||
public double? Lng { get; set; }
|
||||
|
||||
public TypeAttached Type { get; set; }
|
||||
|
||||
public enum TypeAttached
|
||||
{
|
||||
Image,
|
||||
Document,
|
||||
Position
|
||||
}
|
||||
}
|
||||
18
salesbook.Shared/Core/Dto/PositionDTO.cs
Normal file
18
salesbook.Shared/Core/Dto/PositionDTO.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class PositionDTO
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public long? Id { get; set; }
|
||||
|
||||
[JsonPropertyName("description")]
|
||||
public string? Description { get; set; }
|
||||
|
||||
[JsonPropertyName("lat")]
|
||||
public double? Lat { get; set; }
|
||||
|
||||
[JsonPropertyName("lng")]
|
||||
public double? Lng { get; set; }
|
||||
}
|
||||
@@ -63,4 +63,20 @@ public class ModalHelpers
|
||||
|
||||
return await modal.Result;
|
||||
}
|
||||
|
||||
public static async Task<DialogResult?> OpenAddAttached(IDialogService dialog)
|
||||
{
|
||||
var modal = await dialog.ShowAsync<AddAttached>(
|
||||
"Add attached",
|
||||
new DialogParameters<AddAttached>(),
|
||||
new DialogOptions
|
||||
{
|
||||
FullScreen = false,
|
||||
CloseButton = false,
|
||||
NoHeader = true
|
||||
}
|
||||
);
|
||||
|
||||
return await modal.Result;
|
||||
}
|
||||
}
|
||||
10
salesbook.Shared/Core/Interface/IAttachedService.cs
Normal file
10
salesbook.Shared/Core/Interface/IAttachedService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using salesbook.Shared.Core.Dto;
|
||||
|
||||
namespace salesbook.Shared.Core.Interface;
|
||||
|
||||
public interface IAttachedService
|
||||
{
|
||||
Task<AttachedDTO?> SelectImage();
|
||||
Task<AttachedDTO?> SelectFile();
|
||||
Task<AttachedDTO?> SelectPosition();
|
||||
}
|
||||
@@ -16,7 +16,13 @@ public interface IIntegryApiService
|
||||
Task<List<StbActivity>?> SaveActivity(ActivityDTO activity);
|
||||
Task<CRMCreateContactResponseDTO?> SaveContact(CRMCreateContactRequestDTO request);
|
||||
Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request);
|
||||
|
||||
Task UploadFile(string id, byte[] file, string fileName);
|
||||
|
||||
//Position
|
||||
Task<PositionDTO> SavePosition(PositionDTO position);
|
||||
Task<PositionDTO> RetrievePosition(string id);
|
||||
|
||||
//Google
|
||||
Task<List<IndirizzoDTO>?> Geocode(string address);
|
||||
Task<List<AutoCompleteAddressDTO>?> AutoCompleteAddress(string address, string language, string uuid);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using System.Xml;
|
||||
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
||||
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
||||
using IntegryApiClient.Core.Domain.RestClient.Contacts;
|
||||
using salesbook.Shared.Core.Dto;
|
||||
using salesbook.Shared.Core.Entity;
|
||||
using salesbook.Shared.Core.Interface;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
|
||||
namespace salesbook.Shared.Core.Services;
|
||||
|
||||
@@ -79,8 +80,8 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
{
|
||||
var queryParams = new Dictionary<string, object>
|
||||
{
|
||||
{"address", address},
|
||||
{"retrieveAll", true}
|
||||
{ "address", address },
|
||||
{ "retrieveAll", true }
|
||||
};
|
||||
|
||||
return integryApiRestClient.Get<List<IndirizzoDTO>>("geocode", queryParams);
|
||||
@@ -90,9 +91,9 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
{
|
||||
var queryParams = new Dictionary<string, object>
|
||||
{
|
||||
{"address", address},
|
||||
{"language", language},
|
||||
{"uuid", uuid}
|
||||
{ "address", address },
|
||||
{ "language", language },
|
||||
{ "uuid", uuid }
|
||||
};
|
||||
|
||||
return integryApiRestClient.Get<List<AutoCompleteAddressDTO>>("google/places/autoCompleteAddress", queryParams);
|
||||
@@ -108,4 +109,26 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
|
||||
return integryApiRestClient.Get<IndirizzoDTO>("google/places/placeDetails", queryParams);
|
||||
}
|
||||
|
||||
public Task UploadFile(string activityId, byte[] file, string fileName)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object> { { "activityId", activityId } };
|
||||
|
||||
using var content = new MultipartFormDataContent();
|
||||
var fileContent = new ByteArrayContent(file);
|
||||
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data");
|
||||
content.Add(fileContent, "files", fileName);
|
||||
|
||||
return integryApiRestClient.Post<object>($"uploadStbActivityFileAttachment", content, queryParams);
|
||||
}
|
||||
|
||||
public Task<PositionDTO> SavePosition(PositionDTO position) =>
|
||||
integryApiRestClient.Post<PositionDTO>("savePosition", position)!;
|
||||
|
||||
public Task<PositionDTO> RetrievePosition(string id)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object> { { "id", id } };
|
||||
|
||||
return integryApiRestClient.Get<PositionDTO>("retrievePosition", queryParams)!;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user