2026-03-19 01:37:43 -03:00
|
|
|
using Core.Interfaces;
|
2026-03-19 17:41:49 -03:00
|
|
|
using Domain.Dtos.Sales;
|
2026-03-19 01:37:43 -03:00
|
|
|
using Models.Interfaces;
|
|
|
|
|
|
|
|
|
|
namespace Core.Services
|
|
|
|
|
{
|
|
|
|
|
public class DeliveryNoteService(IPhSDeliveryNoteRepository deliveryNoteRepository) : IDeliveryNoteDom
|
|
|
|
|
{
|
|
|
|
|
private readonly IPhSDeliveryNoteRepository _deliveryNoteRepository = deliveryNoteRepository;
|
|
|
|
|
|
2026-03-19 17:41:49 -03:00
|
|
|
public Task<DeliveryNoteDto?> GetDtoByIdAsync(int id)
|
2026-03-19 01:37:43 -03:00
|
|
|
{
|
|
|
|
|
if (id <= 0)
|
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(id), "El identificador del remito es inválido.");
|
|
|
|
|
|
2026-03-19 17:41:49 -03:00
|
|
|
return _deliveryNoteRepository.GetDtoByIdAsync(id);
|
2026-03-19 01:37:43 -03:00
|
|
|
}
|
|
|
|
|
|
2026-03-19 17:41:49 -03:00
|
|
|
public Task<DeliveryNoteDto?> GetDtoByDeliveryNoteNumberAsync(string deliveryNoteNumber)
|
2026-03-19 01:37:43 -03:00
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(deliveryNoteNumber))
|
|
|
|
|
throw new ArgumentException("El número de remito es obligatorio.", nameof(deliveryNoteNumber));
|
|
|
|
|
|
2026-03-19 17:41:49 -03:00
|
|
|
return _deliveryNoteRepository.GetDtoByDeliveryNoteNumberAsync(deliveryNoteNumber.Trim());
|
2026-03-19 01:37:43 -03:00
|
|
|
}
|
|
|
|
|
|
2026-03-19 17:41:49 -03:00
|
|
|
public Task<IEnumerable<DeliveryNoteDto>> GetDtosByQuoteIdAsync(int quoteId)
|
2026-03-19 01:37:43 -03:00
|
|
|
{
|
|
|
|
|
if (quoteId <= 0)
|
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(quoteId), "El identificador del presupuesto es inválido.");
|
|
|
|
|
|
2026-03-19 17:41:49 -03:00
|
|
|
return _deliveryNoteRepository.GetDtosByQuoteIdAsync(quoteId);
|
2026-03-19 01:37:43 -03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|