Cleaned code
This commit is contained in:
@@ -6,6 +6,6 @@ public class GetDelivererDto
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? Transporter { get; set; }
|
public string? Transporter { get; set; }
|
||||||
|
|
||||||
public List<GetDeliveryNoteDto>? DeliveryNotes { get; set; }
|
public List<GetDeliveryNoteDto>? DeliveryNotes { get; set; }
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,6 @@ public class UpdateDeliveryNoteDto
|
|||||||
public DateOnly EstimateDeliveryDate { get; set; }
|
public DateOnly EstimateDeliveryDate { get; set; }
|
||||||
public DateOnly ExpeditionDate { get; set; }
|
public DateOnly ExpeditionDate { get; set; }
|
||||||
public DateOnly? RealDeliveryDate { get; set; }
|
public DateOnly? RealDeliveryDate { get; set; }
|
||||||
|
|
||||||
public int DelivererId { get; set; }
|
public int DelivererId { get; set; }
|
||||||
}
|
}
|
||||||
@@ -9,9 +9,9 @@ public class GetDeliveryNoteDto
|
|||||||
public DateOnly EstimateDeliveryDate { get; set; }
|
public DateOnly EstimateDeliveryDate { get; set; }
|
||||||
public DateOnly ExpeditionDate { get; set; }
|
public DateOnly ExpeditionDate { get; set; }
|
||||||
public DateOnly? RealDeliveryDate { get; set; }
|
public DateOnly? RealDeliveryDate { get; set; }
|
||||||
|
|
||||||
public int DelivererId { get; set; }
|
public int DelivererId { get; set; }
|
||||||
public string? DelivererTransporter { get; set; }
|
public string? DelivererTransporter { get; set; }
|
||||||
|
|
||||||
public List<GetProductDeliveryDto>? Products { get; set; }
|
public List<GetProductDeliveryDto>? Products { get; set; }
|
||||||
}
|
}
|
||||||
@@ -3,11 +3,11 @@
|
|||||||
public class GetPriceDto
|
public class GetPriceDto
|
||||||
{
|
{
|
||||||
public decimal SellingPrice { get; set; }
|
public decimal SellingPrice { get; set; }
|
||||||
|
|
||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public string? ProductReference { get; set; }
|
public string? ProductReference { get; set; }
|
||||||
public string? ProductName { get; set; }
|
public string? ProductName { get; set; }
|
||||||
public decimal ProductDuration {get; set;}
|
public decimal ProductDuration { get; set; }
|
||||||
public int ProductCaliber { get; set; }
|
public int ProductCaliber { get; set; }
|
||||||
public string? ProductApprovalNumber { get; set; }
|
public string? ProductApprovalNumber { get; set; }
|
||||||
public decimal ProductWeight { get; set; }
|
public decimal ProductWeight { get; set; }
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ public class UpdateProductDto
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? References { get; set; }
|
public string? References { get; set; }
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public decimal Duration {get; set;}
|
public decimal Duration { get; set; }
|
||||||
public int Caliber { get; set; }
|
public int Caliber { get; set; }
|
||||||
public string? ApprovalNumber { get; set; }
|
public string? ApprovalNumber { get; set; }
|
||||||
public decimal Weight { get; set; }
|
public decimal Weight { get; set; }
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ public class GetProductDto
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? References { get; set; }
|
public string? References { get; set; }
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public decimal Duration {get; set;}
|
public decimal Duration { get; set; }
|
||||||
public int Caliber { get; set; }
|
public int Caliber { get; set; }
|
||||||
public string? ApprovalNumber { get; set; }
|
public string? ApprovalNumber { get; set; }
|
||||||
public decimal Weight { get; set; }
|
public decimal Weight { get; set; }
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ public class GetProductDeliveryDto
|
|||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public string? ProductReference { get; set; }
|
public string? ProductReference { get; set; }
|
||||||
public string? ProductName { get; set; }
|
public string? ProductName { get; set; }
|
||||||
public decimal ProductDuration {get; set;}
|
public decimal ProductDuration { get; set; }
|
||||||
public int ProductCaliber { get; set; }
|
public int ProductCaliber { get; set; }
|
||||||
public string? ProductApprovalNumber { get; set; }
|
public string? ProductApprovalNumber { get; set; }
|
||||||
public decimal ProductWeight { get; set; }
|
public decimal ProductWeight { get; set; }
|
||||||
@@ -13,6 +13,6 @@ public class GetProductDeliveryDto
|
|||||||
public string? ProductImage { get; set; }
|
public string? ProductImage { get; set; }
|
||||||
public string? ProductLink { get; set; }
|
public string? ProductLink { get; set; }
|
||||||
public int ProductMinimalQuantity { get; set; }
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
}
|
}
|
||||||
@@ -6,4 +6,4 @@ public class CreatePurchaseOrderDto
|
|||||||
{
|
{
|
||||||
public string? PurchaseConditions { get; set; }
|
public string? PurchaseConditions { get; set; }
|
||||||
public List<CreatePurchaseOrderProductDto>? Products { get; set; }
|
public List<CreatePurchaseOrderProductDto>? Products { get; set; }
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@ namespace PyroFetes.DTO.PurchaseProduct.Request;
|
|||||||
|
|
||||||
public class CreatePurchaseProductDto
|
public class CreatePurchaseProductDto
|
||||||
{
|
{
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public int PurchaseOrderId { get; set; }
|
public int PurchaseOrderId { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,5 +4,5 @@ public class PatchPurchaseProductQuantityDto
|
|||||||
{
|
{
|
||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public int PurchaseOrderId { get; set; }
|
public int PurchaseOrderId { get; set; }
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ public class GetPurchaseProductDto
|
|||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public string? ProductReference { get; set; }
|
public string? ProductReference { get; set; }
|
||||||
public string? ProductName { get; set; }
|
public string? ProductName { get; set; }
|
||||||
public decimal ProductDuration {get; set;}
|
public decimal ProductDuration { get; set; }
|
||||||
public int ProductCaliber { get; set; }
|
public int ProductCaliber { get; set; }
|
||||||
public string? ProductApprovalNumber { get; set; }
|
public string? ProductApprovalNumber { get; set; }
|
||||||
public decimal ProductWeight { get; set; }
|
public decimal ProductWeight { get; set; }
|
||||||
@@ -14,6 +14,6 @@ public class GetPurchaseProductDto
|
|||||||
public string? ProductLink { get; set; }
|
public string? ProductLink { get; set; }
|
||||||
public int ProductMinimalQuantity { get; set; }
|
public int ProductMinimalQuantity { get; set; }
|
||||||
public decimal ProductPrice { get; set; }
|
public decimal ProductPrice { get; set; }
|
||||||
|
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
}
|
}
|
||||||
@@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
public class GetQuotationPdfDto
|
public class GetQuotationPdfDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
@@ -3,11 +3,11 @@ namespace PyroFetes.DTO.QuotationProduct.Response;
|
|||||||
public class GetQuotationProductDto
|
public class GetQuotationProductDto
|
||||||
{
|
{
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public string? ProductReference { get; set; }
|
public string? ProductReference { get; set; }
|
||||||
public string? ProductName { get; set; }
|
public string? ProductName { get; set; }
|
||||||
public decimal ProductDuration {get; set;}
|
public decimal ProductDuration { get; set; }
|
||||||
public int ProductCaliber { get; set; }
|
public int ProductCaliber { get; set; }
|
||||||
public string? ProductApprovalNumber { get; set; }
|
public string? ProductApprovalNumber { get; set; }
|
||||||
public decimal ProductWeight { get; set; }
|
public decimal ProductWeight { get; set; }
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class CreateDeliveryNoteEndpoint(
|
|||||||
DeliveryNote = newDeliveryNote,
|
DeliveryNote = newDeliveryNote,
|
||||||
Quantity = productQuantity.Value,
|
Quantity = productQuantity.Value,
|
||||||
Product = product,
|
Product = product,
|
||||||
ProductId = product.Id,
|
ProductId = product.Id,
|
||||||
DeliveryNoteId = newDeliveryNote.Id
|
DeliveryNoteId = newDeliveryNote.Id
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ public class GetAllDeliveryNoteEndpoint(DeliveryNotesRepository deliveryNotesRep
|
|||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
public override async Task HandleAsync(CancellationToken ct)
|
||||||
{
|
{
|
||||||
await Send.OkAsync(await deliveryNotesRepository.ProjectToListAsync<GetDeliveryNoteDto>(new GetAllDeliveryNoteSpec() ,ct), ct);
|
await Send.OkAsync(await deliveryNotesRepository.ProjectToListAsync<GetDeliveryNoteDto>(new GetAllDeliveryNoteSpec(), ct), ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,8 @@ using PyroFetes.Specifications.DeliveryNotes;
|
|||||||
|
|
||||||
namespace PyroFetes.Endpoints.DeliveryNotes;
|
namespace PyroFetes.Endpoints.DeliveryNotes;
|
||||||
|
|
||||||
public class GetDeliveryNotePdfEndpoint(DeliveryNotesRepository deliveryNotesRepository, IDeliveryNotePdfService deliveryNotePdfService, SettingsRepository settingsRepository) : Endpoint<GetDeliveryNotePdfDto, byte[]>
|
public class GetDeliveryNotePdfEndpoint(DeliveryNotesRepository deliveryNotesRepository, IDeliveryNotePdfService deliveryNotePdfService, SettingsRepository settingsRepository)
|
||||||
|
: Endpoint<GetDeliveryNotePdfDto, byte[]>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class PatchProductMinimalStockEndpoint(ProductsRepository productsReposit
|
|||||||
}
|
}
|
||||||
|
|
||||||
mapper.Map(req, product);
|
mapper.Map(req, product);
|
||||||
|
|
||||||
await productsRepository.UpdateAsync(product, ct);
|
await productsRepository.UpdateAsync(product, ct);
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ public class CreatePurchaseOrder(
|
|||||||
await Send.NotFoundAsync(ct);
|
await Send.NotFoundAsync(ct);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PurchaseProduct? purchaseProduct =
|
PurchaseProduct? purchaseProduct =
|
||||||
await purchaseProductsRepository.SingleOrDefaultAsync(new GetPurchaseProductByProductIdAndPurchaseOrderIdSpec(line.ProductId, purchaseOrder.Id), ct);
|
await purchaseProductsRepository.SingleOrDefaultAsync(new GetPurchaseProductByProductIdAndPurchaseOrderIdSpec(line.ProductId, purchaseOrder.Id), ct);
|
||||||
|
|
||||||
if (purchaseProduct is not null)
|
if (purchaseProduct is not null)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace PyroFetes.Endpoints.PurchaseOrders;
|
|||||||
|
|
||||||
public class GetPurchaseOrderPdfEndpoint(
|
public class GetPurchaseOrderPdfEndpoint(
|
||||||
PurchaseOrdersRepository purchaseOrdersRepository,
|
PurchaseOrdersRepository purchaseOrdersRepository,
|
||||||
IPurchaseOrderPdfService purchaseOrderPdfService,
|
IPurchaseOrderPdfService purchaseOrderPdfService,
|
||||||
SettingsRepository settingsRepository)
|
SettingsRepository settingsRepository)
|
||||||
: Endpoint<GetPurchaseOrderPdfDto, byte[]>
|
: Endpoint<GetPurchaseOrderPdfDto, byte[]>
|
||||||
{
|
{
|
||||||
@@ -24,7 +24,7 @@ public class GetPurchaseOrderPdfEndpoint(
|
|||||||
public override async Task HandleAsync(GetPurchaseOrderPdfDto req, CancellationToken ct)
|
public override async Task HandleAsync(GetPurchaseOrderPdfDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
PurchaseOrder? purchaseOrder = await purchaseOrdersRepository.SingleOrDefaultAsync(new GetPurchaseOrderByIdWithProductsSpec(req.Id), ct);
|
PurchaseOrder? purchaseOrder = await purchaseOrdersRepository.SingleOrDefaultAsync(new GetPurchaseOrderByIdWithProductsSpec(req.Id), ct);
|
||||||
|
|
||||||
if (purchaseOrder is null)
|
if (purchaseOrder is null)
|
||||||
{
|
{
|
||||||
await Send.NotFoundAsync(ct);
|
await Send.NotFoundAsync(ct);
|
||||||
@@ -32,7 +32,7 @@ public class GetPurchaseOrderPdfEndpoint(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Setting? setting = await settingsRepository.FirstOrDefaultAsync(ct);
|
Setting? setting = await settingsRepository.FirstOrDefaultAsync(ct);
|
||||||
|
|
||||||
byte[] bytes = purchaseOrderPdfService.Generate(purchaseOrder, purchaseOrder.PurchaseProducts!, setting!);
|
byte[] bytes = purchaseOrderPdfService.Generate(purchaseOrder, purchaseOrder.PurchaseProducts!, setting!);
|
||||||
|
|
||||||
await Send.BytesAsync(
|
await Send.BytesAsync(
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class PatchPurchaseProductQuantityEndpoint(PurchaseProductsRepository pur
|
|||||||
}
|
}
|
||||||
|
|
||||||
mapper.Map(req, purchaseProduct);
|
mapper.Map(req, purchaseProduct);
|
||||||
|
|
||||||
await purchaseProductsRepository.SaveChangesAsync(ct);
|
await purchaseProductsRepository.SaveChangesAsync(ct);
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ public class AddProductoToQuotationEndpoint(
|
|||||||
|
|
||||||
public override async Task HandleAsync(AddQuotationProductDto req, CancellationToken ct)
|
public override async Task HandleAsync(AddQuotationProductDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
QuotationProduct? productQuotation = await quotationProductsRepository.SingleOrDefaultAsync(new GetQuotationProductByProductIdAndQuotationIdSpec(req.ProductId, req.QuotationId), ct);
|
QuotationProduct? productQuotation =
|
||||||
|
await quotationProductsRepository.SingleOrDefaultAsync(new GetQuotationProductByProductIdAndQuotationIdSpec(req.ProductId, req.QuotationId), ct);
|
||||||
|
|
||||||
if (productQuotation is not null)
|
if (productQuotation is not null)
|
||||||
{
|
{
|
||||||
@@ -28,7 +29,7 @@ public class AddProductoToQuotationEndpoint(
|
|||||||
}
|
}
|
||||||
|
|
||||||
QuotationProduct quotationProduct = mapper.Map<QuotationProduct>(req);
|
QuotationProduct quotationProduct = mapper.Map<QuotationProduct>(req);
|
||||||
|
|
||||||
await quotationProductsRepository.AddAsync(quotationProduct, ct);
|
await quotationProductsRepository.AddAsync(quotationProduct, ct);
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class CreateQuotationEndpoint(
|
|||||||
Product? product = await productsRepository.SingleOrDefaultAsync(new GetProductByIdSpec(line.ProductId), ct);
|
Product? product = await productsRepository.SingleOrDefaultAsync(new GetProductByIdSpec(line.ProductId), ct);
|
||||||
QuotationProduct? quotationProduct =
|
QuotationProduct? quotationProduct =
|
||||||
await quotationProductsRepository.SingleOrDefaultAsync(new GetQuotationProductByProductIdAndQuotationIdSpec(line.ProductId, quotation.Id), ct);
|
await quotationProductsRepository.SingleOrDefaultAsync(new GetQuotationProductByProductIdAndQuotationIdSpec(line.ProductId, quotation.Id), ct);
|
||||||
|
|
||||||
if (product is null)
|
if (product is null)
|
||||||
{
|
{
|
||||||
await Send.NotFoundAsync(ct);
|
await Send.NotFoundAsync(ct);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace PyroFetes.Endpoints.Quotations;
|
|||||||
|
|
||||||
public class GetQuotationPdfEndpoint(
|
public class GetQuotationPdfEndpoint(
|
||||||
QuotationsRepository quotationRepository,
|
QuotationsRepository quotationRepository,
|
||||||
IQuotationPdfService quotationPdfService,
|
IQuotationPdfService quotationPdfService,
|
||||||
SettingsRepository settingsRepository)
|
SettingsRepository settingsRepository)
|
||||||
: Endpoint<GetQuotationPdfDto, byte[]>
|
: Endpoint<GetQuotationPdfDto, byte[]>
|
||||||
{
|
{
|
||||||
@@ -32,7 +32,7 @@ public class GetQuotationPdfEndpoint(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Setting? setting = await settingsRepository.FirstOrDefaultAsync(ct);
|
Setting? setting = await settingsRepository.FirstOrDefaultAsync(ct);
|
||||||
|
|
||||||
byte[] bytes = quotationPdfService.Generate(quotation, quotation.QuotationProducts!, setting!);
|
byte[] bytes = quotationPdfService.Generate(quotation, quotation.QuotationProducts!, setting!);
|
||||||
|
|
||||||
await Send.BytesAsync(
|
await Send.BytesAsync(
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class PatchQuotationConditionsSaleEndpoint(
|
|||||||
}
|
}
|
||||||
|
|
||||||
mapper.Map(req, quotation);
|
mapper.Map(req, quotation);
|
||||||
|
|
||||||
await quotationsRepository.SaveChangesAsync(ct);
|
await quotationsRepository.SaveChangesAsync(ct);
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class PatchQuotationMessageEndpoint(
|
|||||||
}
|
}
|
||||||
|
|
||||||
mapper.Map(req, quotation);
|
mapper.Map(req, quotation);
|
||||||
|
|
||||||
await quotationsRepository.SaveChangesAsync(ct);
|
await quotationsRepository.SaveChangesAsync(ct);
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class PatchQuotationProductQuantityEndpoint(
|
|||||||
}
|
}
|
||||||
|
|
||||||
mapper.Map(req, quotationProduct);
|
mapper.Map(req, quotationProduct);
|
||||||
|
|
||||||
await quotationProductsRepository.SaveChangesAsync(ct);
|
await quotationProductsRepository.SaveChangesAsync(ct);
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class UpdateQuotationEndpoint(
|
|||||||
}
|
}
|
||||||
|
|
||||||
mapper.Map(req, quotation);
|
mapper.Map(req, quotation);
|
||||||
|
|
||||||
await quotationsRepository.SaveChangesAsync(ct);
|
await quotationsRepository.SaveChangesAsync(ct);
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class CreateSettingEndpoint(SettingsRepository settingsRepository) : Endp
|
|||||||
|
|
||||||
if (req.ElectronicSignature != null) await req.ElectronicSignature.CopyToAsync(memoryStream, ct);
|
if (req.ElectronicSignature != null) await req.ElectronicSignature.CopyToAsync(memoryStream, ct);
|
||||||
byte[] signatureBytes = memoryStream.ToArray();
|
byte[] signatureBytes = memoryStream.ToArray();
|
||||||
|
|
||||||
Setting setting = new()
|
Setting setting = new()
|
||||||
{
|
{
|
||||||
ElectronicSignature = Convert.ToBase64String(signatureBytes),
|
ElectronicSignature = Convert.ToBase64String(signatureBytes),
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ public class PatchSettingElectronicSignatureEndpoint(SettingsRepository settings
|
|||||||
using MemoryStream memoryStream = new();
|
using MemoryStream memoryStream = new();
|
||||||
if (req.ElectronicSignature != null) await req.ElectronicSignature.CopyToAsync(memoryStream, ct);
|
if (req.ElectronicSignature != null) await req.ElectronicSignature.CopyToAsync(memoryStream, ct);
|
||||||
byte[] signatureBytes = memoryStream.ToArray();
|
byte[] signatureBytes = memoryStream.ToArray();
|
||||||
|
|
||||||
setting.ElectronicSignature = Convert.ToBase64String(signatureBytes);
|
setting.ElectronicSignature = Convert.ToBase64String(signatureBytes);
|
||||||
|
|
||||||
await settingsRepository.SaveChangesAsync(ct);
|
await settingsRepository.SaveChangesAsync(ct);
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ public class PatchSettingLogoEndpoint(SettingsRepository settingsRepository) : E
|
|||||||
using MemoryStream memoryStream = new();
|
using MemoryStream memoryStream = new();
|
||||||
if (req.Logo != null) await req.Logo.CopyToAsync(memoryStream, ct);
|
if (req.Logo != null) await req.Logo.CopyToAsync(memoryStream, ct);
|
||||||
byte[] logoBytes = memoryStream.ToArray();
|
byte[] logoBytes = memoryStream.ToArray();
|
||||||
|
|
||||||
setting.Logo = Convert.ToBase64String(logoBytes);
|
setting.Logo = Convert.ToBase64String(logoBytes);
|
||||||
|
|
||||||
await settingsRepository.SaveChangesAsync(ct);
|
await settingsRepository.SaveChangesAsync(ct);
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace PyroFetes.Endpoints.Suppliers;
|
|||||||
public class AddProductToSupplierEndpoint(
|
public class AddProductToSupplierEndpoint(
|
||||||
SuppliersRepository suppliersRepository,
|
SuppliersRepository suppliersRepository,
|
||||||
ProductsRepository productsRepository,
|
ProductsRepository productsRepository,
|
||||||
PricesRepository pricesRepository,
|
PricesRepository pricesRepository,
|
||||||
AutoMapper.IMapper mapper) : Endpoint<CreatePriceDto>
|
AutoMapper.IMapper mapper) : Endpoint<CreatePriceDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
@@ -36,7 +36,7 @@ public class AddProductToSupplierEndpoint(
|
|||||||
await Send.StringAsync("Le fournisseur a déjà un prix pour ce produit.", 400, cancellation: ct);
|
await Send.StringAsync("Le fournisseur a déjà un prix pour ce produit.", 400, cancellation: ct);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await pricesRepository.AddAsync(mapper.Map<Price>(req), ct);
|
await pricesRepository.AddAsync(mapper.Map<Price>(req), ct);
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class PatchPriceEndpoint(
|
|||||||
}
|
}
|
||||||
|
|
||||||
mapper.Map(req, price);
|
mapper.Map(req, price);
|
||||||
|
|
||||||
await pricesRepository.SaveChangesAsync(ct);
|
await pricesRepository.SaveChangesAsync(ct);
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using PyroFetes.Specifications.Users;
|
|||||||
|
|
||||||
namespace PyroFetes.Endpoints.Users;
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
public class PatchUserPasswordEndpoint(UsersRepository usersRepository,AutoMapper.IMapper mapper) : Endpoint<PatchUserPasswordDto, GetUserDto>
|
public class PatchUserPasswordEndpoint(UsersRepository usersRepository, AutoMapper.IMapper mapper) : Endpoint<PatchUserPasswordDto, GetUserDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class PatchWareHouseProductQuantityEndpoint(WarehouseProductsRepository w
|
|||||||
|
|
||||||
public override async Task HandleAsync(PatchWareHouseProductQuantityDto req, CancellationToken ct)
|
public override async Task HandleAsync(PatchWareHouseProductQuantityDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
WarehouseProduct? wareHouseProduct = await warehouseProductsRepository.FirstOrDefaultAsync(new GetWarehouseProductByProductIdSpec(req.ProductId, req.WareHouseId) , ct);
|
WarehouseProduct? wareHouseProduct = await warehouseProductsRepository.FirstOrDefaultAsync(new GetWarehouseProductByProductIdSpec(req.ProductId, req.WareHouseId), ct);
|
||||||
|
|
||||||
if (wareHouseProduct is null)
|
if (wareHouseProduct is null)
|
||||||
{
|
{
|
||||||
@@ -27,7 +27,7 @@ public class PatchWareHouseProductQuantityEndpoint(WarehouseProductsRepository w
|
|||||||
|
|
||||||
wareHouseProduct.Quantity = req.Quantity;
|
wareHouseProduct.Quantity = req.Quantity;
|
||||||
await warehouseProductsRepository.SaveChangesAsync(ct);
|
await warehouseProductsRepository.SaveChangesAsync(ct);
|
||||||
|
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,16 +38,16 @@ public class DtoToEntityMappings : Profile
|
|||||||
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
||||||
CreateMap<PatchProductMinimalStockDto, Product>()
|
CreateMap<PatchProductMinimalStockDto, Product>()
|
||||||
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
||||||
|
|
||||||
CreateMap<CreatePurchaseOrderDto, PurchaseOrder>();
|
CreateMap<CreatePurchaseOrderDto, PurchaseOrder>();
|
||||||
CreateMap<PatchPurchaseOrderPurchaseConditionsDto,PurchaseOrder>()
|
CreateMap<PatchPurchaseOrderPurchaseConditionsDto, PurchaseOrder>()
|
||||||
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
||||||
|
|
||||||
CreateMap<CreatePurchaseProductDto, PurchaseProduct>();
|
CreateMap<CreatePurchaseProductDto, PurchaseProduct>();
|
||||||
CreateMap<PatchPurchaseProductQuantityDto, PurchaseProduct>()
|
CreateMap<PatchPurchaseProductQuantityDto, PurchaseProduct>()
|
||||||
.ForMember(dest => dest.ProductId, opt => opt.Ignore())
|
.ForMember(dest => dest.ProductId, opt => opt.Ignore())
|
||||||
.ForMember(dest => dest.PurchaseOrderId, opt => opt.Ignore());
|
.ForMember(dest => dest.PurchaseOrderId, opt => opt.Ignore());
|
||||||
|
|
||||||
CreateMap<PatchQuotationConditionsSaleDto, Quotation>()
|
CreateMap<PatchQuotationConditionsSaleDto, Quotation>()
|
||||||
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
||||||
CreateMap<PatchQuotationMessageDto, Quotation>()
|
CreateMap<PatchQuotationMessageDto, Quotation>()
|
||||||
@@ -58,19 +58,19 @@ public class DtoToEntityMappings : Profile
|
|||||||
CreateMap<PatchQuotationProductQuantityDto, QuotationProduct>()
|
CreateMap<PatchQuotationProductQuantityDto, QuotationProduct>()
|
||||||
.ForMember(dest => dest.ProductId, opt => opt.Ignore())
|
.ForMember(dest => dest.ProductId, opt => opt.Ignore())
|
||||||
.ForMember(dest => dest.QuotationId, opt => opt.Ignore());
|
.ForMember(dest => dest.QuotationId, opt => opt.Ignore());
|
||||||
|
|
||||||
CreateMap<CreateSettingDto, Setting>();
|
CreateMap<CreateSettingDto, Setting>();
|
||||||
CreateMap<PatchSettingElectronicSignatureDto, Setting>()
|
CreateMap<PatchSettingElectronicSignatureDto, Setting>()
|
||||||
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
||||||
CreateMap<PatchSettingLogoDto, Setting>()
|
CreateMap<PatchSettingLogoDto, Setting>()
|
||||||
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
||||||
|
|
||||||
CreateMap<CreateSupplierDto, Supplier>();
|
CreateMap<CreateSupplierDto, Supplier>();
|
||||||
CreateMap<UpdateSupplierDto, Supplier>()
|
CreateMap<UpdateSupplierDto, Supplier>()
|
||||||
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
||||||
CreateMap<PatchSupplierDeliveryDelayDto, Supplier>()
|
CreateMap<PatchSupplierDeliveryDelayDto, Supplier>()
|
||||||
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
||||||
|
|
||||||
CreateMap<CreateUserDto, User>();
|
CreateMap<CreateUserDto, User>();
|
||||||
CreateMap<UpdateUserDto, User>()
|
CreateMap<UpdateUserDto, User>()
|
||||||
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
.ForMember(dest => dest.Id, opt => opt.Ignore());
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ public class EntityToDtoMappings : Profile
|
|||||||
.ForMember(dest => dest.Products, opt => opt.MapFrom(src => src.ProductDeliveries));
|
.ForMember(dest => dest.Products, opt => opt.MapFrom(src => src.ProductDeliveries));
|
||||||
|
|
||||||
CreateMap<Price, GetPriceDto>();
|
CreateMap<Price, GetPriceDto>();
|
||||||
|
|
||||||
CreateMap<Product, GetProductDto>()
|
CreateMap<Product, GetProductDto>()
|
||||||
.ForMember(dest => dest.References, opt => opt.MapFrom(src => src.Reference));
|
.ForMember(dest => dest.References, opt => opt.MapFrom(src => src.Reference));
|
||||||
|
|
||||||
CreateMap<ProductDelivery, GetProductDeliveryDto>();
|
CreateMap<ProductDelivery, GetProductDeliveryDto>();
|
||||||
|
|
||||||
CreateMap<PurchaseOrder, GetPurchaseOrderDto>()
|
CreateMap<PurchaseOrder, GetPurchaseOrderDto>()
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ public class Availability
|
|||||||
[Required] public DateOnly DeliveryDate { get; set; }
|
[Required] public DateOnly DeliveryDate { get; set; }
|
||||||
[Required] public DateOnly ExpirationDate { get; set; }
|
[Required] public DateOnly ExpirationDate { get; set; }
|
||||||
[Required] public DateOnly RenewallDate { get; set; }
|
[Required] public DateOnly RenewallDate { get; set; }
|
||||||
|
|
||||||
public List<StaffAvailability>? StaffAvailabilities { get; set; }
|
public List<StaffAvailability>? StaffAvailabilities { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,9 +4,9 @@ namespace PyroFetes.Models;
|
|||||||
|
|
||||||
public class Brand
|
public class Brand
|
||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Name { get; set; }
|
[Required, MaxLength(100)] public string? Name { get; set; }
|
||||||
|
|
||||||
[Required] public int ProductId { get; set; }
|
[Required] public int ProductId { get; set; }
|
||||||
[Required] public Product? Product { get; set; }
|
[Required] public Product? Product { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,9 +4,9 @@ namespace PyroFetes.Models;
|
|||||||
|
|
||||||
public class City
|
public class City
|
||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Name { get; set; }
|
[Required, MaxLength(100)] public string? Name { get; set; }
|
||||||
[Required] public int ZipCode { get; set; }
|
[Required] public int ZipCode { get; set; }
|
||||||
|
|
||||||
public List<Show>? Shows { get; set; }
|
public List<Show>? Shows { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,8 +4,8 @@ namespace PyroFetes.Models;
|
|||||||
|
|
||||||
public class Classification
|
public class Classification
|
||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Label { get; set; }
|
[Required, MaxLength(100)] public string? Label { get; set; }
|
||||||
|
|
||||||
public List<Product>? Products { get; set; }
|
public List<Product>? Products { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,8 +4,8 @@ namespace PyroFetes.Models;
|
|||||||
|
|
||||||
public class Color
|
public class Color
|
||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Label { get; set; }
|
[Required, MaxLength(100)] public string? Label { get; set; }
|
||||||
|
|
||||||
public List<ProductColor>? ProductColors { get; set; }
|
public List<ProductColor>? ProductColors { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,11 +4,11 @@ namespace PyroFetes.Models;
|
|||||||
|
|
||||||
public class Communication
|
public class Communication
|
||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Calling { get; set; }
|
[Required, MaxLength(100)] public string? Calling { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Email { get; set; }
|
[Required, MaxLength(100)] public string? Email { get; set; }
|
||||||
[Required, MaxLength(300)] public string? Meeting { get; set; }
|
[Required, MaxLength(300)] public string? Meeting { get; set; }
|
||||||
|
|
||||||
[Required] public int ContactId { get; set; }
|
[Required] public int ContactId { get; set; }
|
||||||
public Contact? Contact { get; set; }
|
public Contact? Contact { get; set; }
|
||||||
}
|
}
|
||||||
@@ -13,10 +13,10 @@ public class Contact
|
|||||||
[Required] public int ZipCode { get; set; }
|
[Required] public int ZipCode { get; set; }
|
||||||
[Required, MaxLength(100)] public string? City { get; set; }
|
[Required, MaxLength(100)] public string? City { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Role { get; set; }
|
[Required, MaxLength(100)] public string? Role { get; set; }
|
||||||
|
|
||||||
public Customer? Customer { get; set; }
|
public Customer? Customer { get; set; }
|
||||||
[Required] public int CustomerId { get; set; }
|
[Required] public int CustomerId { get; set; }
|
||||||
|
|
||||||
public List<Communication>? Communications { get; set; }
|
public List<Communication>? Communications { get; set; }
|
||||||
public List<StaffContact>? StaffContacts { get; set; }
|
public List<StaffContact>? StaffContacts { get; set; }
|
||||||
public List<ContactServiceProvider>? ContactServiceProviders { get; set; }
|
public List<ContactServiceProvider>? ContactServiceProviders { get; set; }
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class ContactServiceProvider
|
|||||||
{
|
{
|
||||||
[Required] public int ContactId { get; set; }
|
[Required] public int ContactId { get; set; }
|
||||||
[Required] public int ServiceProviderId { get; set; }
|
[Required] public int ServiceProviderId { get; set; }
|
||||||
|
|
||||||
public Contact? Contact { get; set; }
|
public Contact? Contact { get; set; }
|
||||||
public ServiceProvider? ServiceProvider { get; set; }
|
public ServiceProvider? ServiceProvider { get; set; }
|
||||||
}
|
}
|
||||||
@@ -6,11 +6,11 @@ public class Customer
|
|||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(200)] public string? Note { get; set; }
|
[Required, MaxLength(200)] public string? Note { get; set; }
|
||||||
|
|
||||||
//Relations
|
//Relations
|
||||||
[Required] public int CustomerTypeId { get; set; }
|
[Required] public int CustomerTypeId { get; set; }
|
||||||
public CustomerType? CustomerType { get; set; }
|
public CustomerType? CustomerType { get; set; }
|
||||||
|
|
||||||
public List<Contact>? Contacts { get; set; }
|
public List<Contact>? Contacts { get; set; }
|
||||||
public List<Quotation>? Quotations { get; set; }
|
public List<Quotation>? Quotations { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,8 +4,8 @@ namespace PyroFetes.Models;
|
|||||||
|
|
||||||
public class CustomerType
|
public class CustomerType
|
||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Label { get; set; }
|
[Required, MaxLength(100)] public string? Label { get; set; }
|
||||||
|
|
||||||
public List<Customer>? Customers { get; set; }
|
public List<Customer>? Customers { get; set; }
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,6 @@ public class Deliverer
|
|||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Transporter { get; set; }
|
[Required, MaxLength(100)] public string? Transporter { get; set; }
|
||||||
|
|
||||||
public List<DeliveryNote>? DeliveryNotes { get; set; }
|
public List<DeliveryNote>? DeliveryNotes { get; set; }
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ public class DeliveryNote
|
|||||||
[Required] public DateOnly EstimateDeliveryDate { get; set; }
|
[Required] public DateOnly EstimateDeliveryDate { get; set; }
|
||||||
[Required] public DateOnly ExpeditionDate { get; set; }
|
[Required] public DateOnly ExpeditionDate { get; set; }
|
||||||
public DateOnly? RealDeliveryDate { get; set; }
|
public DateOnly? RealDeliveryDate { get; set; }
|
||||||
|
|
||||||
public Deliverer? Deliverer { get; set; }
|
public Deliverer? Deliverer { get; set; }
|
||||||
public List<ProductDelivery>? ProductDeliveries { get; set; }
|
public List<ProductDelivery>? ProductDeliveries { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,8 +4,8 @@ namespace PyroFetes.Models;
|
|||||||
|
|
||||||
public class Effect
|
public class Effect
|
||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(200)] public string? Label { get; set; }
|
[Required, MaxLength(200)] public string? Label { get; set; }
|
||||||
|
|
||||||
public List<ProductEffect>? ProductEffects { get; set; }
|
public List<ProductEffect>? ProductEffects { get; set; }
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ public class ExperienceLevel
|
|||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Label { get; set; }
|
[Required, MaxLength(100)] public string? Label { get; set; }
|
||||||
|
|
||||||
public Staff? Staff { get; set; }
|
public Staff? Staff { get; set; }
|
||||||
[Required] public int StaffId { get; set; }
|
[Required] public int StaffId { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,9 +4,9 @@ namespace PyroFetes.Models;
|
|||||||
|
|
||||||
public class HistoryOfApproval
|
public class HistoryOfApproval
|
||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required] public DateOnly DeliveryDate { get; set; }
|
[Required] public DateOnly DeliveryDate { get; set; }
|
||||||
[Required] public DateOnly ExpirationDate { get; set; }
|
[Required] public DateOnly ExpirationDate { get; set; }
|
||||||
|
|
||||||
public List<StaffHistoryOfApproval>? StaffHistoryOfApprovals { get; set; }
|
public List<StaffHistoryOfApproval>? StaffHistoryOfApprovals { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,13 +4,13 @@ namespace PyroFetes.Models;
|
|||||||
|
|
||||||
public class Material
|
public class Material
|
||||||
{
|
{
|
||||||
[Key] public int Id {get; set;}
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Name {get; set;}
|
[Required, MaxLength(100)] public string? Name { get; set; }
|
||||||
[Required] public int Quantity {get; set;}
|
[Required] public int Quantity { get; set; }
|
||||||
|
|
||||||
[Required] public int WarehouseId {get; set;}
|
[Required] public int WarehouseId { get; set; }
|
||||||
public Warehouse? Warehouse {get; set;}
|
public Warehouse? Warehouse { get; set; }
|
||||||
|
|
||||||
public List<ShowMaterial>? ShowMaterials {get; set;}
|
public List<ShowMaterial>? ShowMaterials { get; set; }
|
||||||
public List<MaterialWarehouse>? MaterialWarehouses {get; set;}
|
public List<MaterialWarehouse>? MaterialWarehouses { get; set; }
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ public class MaterialWarehouse
|
|||||||
{
|
{
|
||||||
[Required] public int MaterialId { get; set; }
|
[Required] public int MaterialId { get; set; }
|
||||||
[Required] public int WarehouseId { get; set; }
|
[Required] public int WarehouseId { get; set; }
|
||||||
|
|
||||||
public Material? Material { get; set; }
|
public Material? Material { get; set; }
|
||||||
public Warehouse? Warehouse { get; set; }
|
public Warehouse? Warehouse { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,16 +4,16 @@ namespace PyroFetes.Models;
|
|||||||
|
|
||||||
public class Movement
|
public class Movement
|
||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required] public DateTime Date { get; set; }
|
[Required] public DateTime Date { get; set; }
|
||||||
[Required] public DateTime Start {get; set;}
|
[Required] public DateTime Start { get; set; }
|
||||||
[Required] public DateTime Arrival {get; set;}
|
[Required] public DateTime Arrival { get; set; }
|
||||||
[Required] public int Quantity {get; set;}
|
[Required] public int Quantity { get; set; }
|
||||||
|
|
||||||
public List<Product>? Products { get; set; }
|
public List<Product>? Products { get; set; }
|
||||||
|
|
||||||
public int? SourceWarehouseId {get; set;}
|
public int? SourceWarehouseId { get; set; }
|
||||||
public Warehouse? SourceWarehouse {get; set;}
|
public Warehouse? SourceWarehouse { get; set; }
|
||||||
public int? DestinationWarehouseId {get; set;}
|
public int? DestinationWarehouseId { get; set; }
|
||||||
public Warehouse? DestinationWarehouse {get; set;}
|
public Warehouse? DestinationWarehouse { get; set; }
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ public class Price
|
|||||||
[Required] public int ProductId { get; set; }
|
[Required] public int ProductId { get; set; }
|
||||||
[Required] public int SupplierId { get; set; }
|
[Required] public int SupplierId { get; set; }
|
||||||
[Required] public decimal SellingPrice { get; set; }
|
[Required] public decimal SellingPrice { get; set; }
|
||||||
|
|
||||||
public Product? Product { get; set; }
|
public Product? Product { get; set; }
|
||||||
public Supplier? Supplier { get; set; }
|
public Supplier? Supplier { get; set; }
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ namespace PyroFetes.Models
|
|||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(20)] public string? Reference { get; set; }
|
[Required, MaxLength(20)] public string? Reference { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Name { get; set; }
|
[Required, MaxLength(100)] public string? Name { get; set; }
|
||||||
[Required] public decimal Duration {get; set;}
|
[Required] public decimal Duration { get; set; }
|
||||||
[Required] public int Caliber { get; set; }
|
[Required] public int Caliber { get; set; }
|
||||||
[Required, MaxLength(100)] public string? ApprovalNumber { get; set; }
|
[Required, MaxLength(100)] public string? ApprovalNumber { get; set; }
|
||||||
[Required] public decimal Weight { get; set; }
|
[Required] public decimal Weight { get; set; }
|
||||||
@@ -22,9 +22,9 @@ namespace PyroFetes.Models
|
|||||||
|
|
||||||
[Required] public int ProductCategoryId { get; set; }
|
[Required] public int ProductCategoryId { get; set; }
|
||||||
public ProductCategory? ProductCategory { get; set; }
|
public ProductCategory? ProductCategory { get; set; }
|
||||||
|
|
||||||
[Required] public int MovementId {get; set;}
|
[Required] public int MovementId { get; set; }
|
||||||
public Movement? Movement {get; set;}
|
public Movement? Movement { get; set; }
|
||||||
|
|
||||||
public List<ProductDelivery>? ProductDeliveries { get; set; }
|
public List<ProductDelivery>? ProductDeliveries { get; set; }
|
||||||
public List<Brand>? Brands { get; set; }
|
public List<Brand>? Brands { get; set; }
|
||||||
@@ -35,7 +35,5 @@ namespace PyroFetes.Models
|
|||||||
public List<QuotationProduct>? QuotationProducts { get; set; }
|
public List<QuotationProduct>? QuotationProducts { get; set; }
|
||||||
public List<WarehouseProduct>? WarehouseProducts { get; set; }
|
public List<WarehouseProduct>? WarehouseProducts { get; set; }
|
||||||
public List<ProductTimecode>? ProductTimecodes { get; set; }
|
public List<ProductTimecode>? ProductTimecodes { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,8 +4,8 @@ namespace PyroFetes.Models;
|
|||||||
|
|
||||||
public class ProductCategory
|
public class ProductCategory
|
||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Label { get; set; }
|
[Required, MaxLength(100)] public string? Label { get; set; }
|
||||||
|
|
||||||
public List<Product>? Products { get; set; }
|
public List<Product>? Products { get; set; }
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ public class ProductColor
|
|||||||
{
|
{
|
||||||
public Product? Product { get; set; }
|
public Product? Product { get; set; }
|
||||||
[Required] public int ProductId { get; set; }
|
[Required] public int ProductId { get; set; }
|
||||||
|
|
||||||
public Color? Color { get; set; }
|
public Color? Color { get; set; }
|
||||||
[Required] public int ColorId { get; set; }
|
[Required] public int ColorId { get; set; }
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,7 @@ public class ProductDelivery
|
|||||||
[Required] public int ProductId { get; set; }
|
[Required] public int ProductId { get; set; }
|
||||||
[Required] public int DeliveryNoteId { get; set; }
|
[Required] public int DeliveryNoteId { get; set; }
|
||||||
[Required] public int Quantity { get; set; }
|
[Required] public int Quantity { get; set; }
|
||||||
|
|
||||||
public Product? Product { get; set; }
|
public Product? Product { get; set; }
|
||||||
public DeliveryNote? DeliveryNote { get; set; }
|
public DeliveryNote? DeliveryNote { get; set; }
|
||||||
}
|
}
|
||||||
@@ -11,5 +11,4 @@ public class ProductEffect
|
|||||||
|
|
||||||
public Effect? Effect { get; set; }
|
public Effect? Effect { get; set; }
|
||||||
[Required] public int EffectId { get; set; }
|
[Required] public int EffectId { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,10 +8,10 @@ public class ProductTimecode
|
|||||||
{
|
{
|
||||||
public Product? Product { get; set; }
|
public Product? Product { get; set; }
|
||||||
[Required] public int ProductId { get; set; }
|
[Required] public int ProductId { get; set; }
|
||||||
|
|
||||||
public Show? Show { get; set; }
|
public Show? Show { get; set; }
|
||||||
[Required] public int ShowId { get; set; }
|
[Required] public int ShowId { get; set; }
|
||||||
|
|
||||||
[Required] public decimal Start { get; set; }
|
[Required] public decimal Start { get; set; }
|
||||||
[Required] public decimal End { get; set; }
|
[Required] public decimal End { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,8 +4,8 @@ namespace PyroFetes.Models;
|
|||||||
|
|
||||||
public class ProviderType
|
public class ProviderType
|
||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Label { get; set; }
|
[Required, MaxLength(100)] public string? Label { get; set; }
|
||||||
|
|
||||||
public List<ServiceProvider>? ServiceProviders { get; set; }
|
public List<ServiceProvider>? ServiceProviders { get; set; }
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ public class PurchaseOrder
|
|||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(300)] public string? PurchaseConditions { get; set; }
|
[Required, MaxLength(300)] public string? PurchaseConditions { get; set; }
|
||||||
|
|
||||||
[Required] public int SupplierId { get; set; }
|
[Required] public int SupplierId { get; set; }
|
||||||
public Supplier? Supplier { get; set; }
|
public Supplier? Supplier { get; set; }
|
||||||
public List<PurchaseProduct>? PurchaseProducts { get; set; }
|
public List<PurchaseProduct>? PurchaseProducts { get; set; }
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ public class Quotation
|
|||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(200)] public string? Message { get; set; }
|
[Required, MaxLength(200)] public string? Message { get; set; }
|
||||||
[Required, MaxLength(300)] public string? ConditionsSale { get; set; }
|
[Required, MaxLength(300)] public string? ConditionsSale { get; set; }
|
||||||
|
|
||||||
[Required] public int CustomerId { get; set; }
|
[Required] public int CustomerId { get; set; }
|
||||||
public Customer? Customer { get; set; }
|
public Customer? Customer { get; set; }
|
||||||
|
|
||||||
public List<QuotationProduct>? QuotationProducts { get; set; }
|
public List<QuotationProduct>? QuotationProducts { get; set; }
|
||||||
}
|
}
|
||||||
@@ -8,8 +8,8 @@ public class QuotationProduct
|
|||||||
{
|
{
|
||||||
[Required] public int ProductId { get; set; }
|
[Required] public int ProductId { get; set; }
|
||||||
[Required] public int QuotationId { get; set; }
|
[Required] public int QuotationId { get; set; }
|
||||||
[Required] public int Quantity { get; set; }
|
[Required] public int Quantity { get; set; }
|
||||||
|
|
||||||
public Product? Product { get; set; }
|
public Product? Product { get; set; }
|
||||||
public Quotation? Quotation { get; set; }
|
public Quotation? Quotation { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,13 +4,13 @@ namespace PyroFetes.Models;
|
|||||||
|
|
||||||
public class ServiceProvider
|
public class ServiceProvider
|
||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required] public decimal Price { get; set; }
|
[Required] public decimal Price { get; set; }
|
||||||
|
|
||||||
//Relations
|
//Relations
|
||||||
[Required] public int ProviderTypeId { get; set; }
|
[Required] public int ProviderTypeId { get; set; }
|
||||||
public ProviderType? ProviderType { get; set; }
|
public ProviderType? ProviderType { get; set; }
|
||||||
|
|
||||||
public List<Contract>? Contracts { get; set; }
|
public List<Contract>? Contracts { get; set; }
|
||||||
public List<ContactServiceProvider>? ContactServiceProviders { get; set; }
|
public List<ContactServiceProvider>? ContactServiceProviders { get; set; }
|
||||||
}
|
}
|
||||||
@@ -9,13 +9,13 @@ public class Show
|
|||||||
[Required, MaxLength(120)] public string? Place { get; set; }
|
[Required, MaxLength(120)] public string? Place { get; set; }
|
||||||
[MaxLength(500)] public string? Description { get; set; }
|
[MaxLength(500)] public string? Description { get; set; }
|
||||||
public DateOnly? Date { get; set; }
|
public DateOnly? Date { get; set; }
|
||||||
|
|
||||||
// Link (path/URL/file name) to the pyrotechnic implementation plan
|
// Link (path/URL/file name) to the pyrotechnic implementation plan
|
||||||
[Required, MaxLength(500)] public string? PyrotechnicImplementationPlan { get; set; }
|
[Required, MaxLength(500)] public string? PyrotechnicImplementationPlan { get; set; }
|
||||||
|
|
||||||
[Required] public int CityId { get; set; }
|
[Required] public int CityId { get; set; }
|
||||||
public City? City { get; set; }
|
public City? City { get; set; }
|
||||||
|
|
||||||
public List<ShowStaff>? ShowStaffs { get; set; }
|
public List<ShowStaff>? ShowStaffs { get; set; }
|
||||||
public List<ShowTruck>? ShowTrucks { get; set; }
|
public List<ShowTruck>? ShowTrucks { get; set; }
|
||||||
public List<SoundTimecode>? SoundTimecodes { get; set; }
|
public List<SoundTimecode>? SoundTimecodes { get; set; }
|
||||||
|
|||||||
@@ -11,5 +11,4 @@ public class ShowMaterial
|
|||||||
|
|
||||||
public Material? Material { get; set; }
|
public Material? Material { get; set; }
|
||||||
[Required] public int MaterialId { get; set; }
|
[Required] public int MaterialId { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,5 @@ namespace PyroFetes.Models;
|
|||||||
|
|
||||||
public class ShowServiceProvider
|
public class ShowServiceProvider
|
||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -12,9 +12,9 @@ public class Sound
|
|||||||
[Required, MaxLength(40)] public string? Kind { get; set; }
|
[Required, MaxLength(40)] public string? Kind { get; set; }
|
||||||
[Required, MaxLength(40)] public string? Format { get; set; }
|
[Required, MaxLength(40)] public string? Format { get; set; }
|
||||||
public DateTime? CreationDate { get; set; }
|
public DateTime? CreationDate { get; set; }
|
||||||
|
|
||||||
[Required] public int SoundCategoryId { get; set; }
|
[Required] public int SoundCategoryId { get; set; }
|
||||||
public SoundCategory? SoundCategory { get; set; }
|
public SoundCategory? SoundCategory { get; set; }
|
||||||
|
|
||||||
public List<SoundTimecode>? SoundTimecodes { get; set; }
|
public List<SoundTimecode>? SoundTimecodes { get; set; }
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,6 @@ public class SoundCategory
|
|||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(100)] public string Name { get; set; } = null!;
|
[Required, MaxLength(100)] public string Name { get; set; } = null!;
|
||||||
|
|
||||||
public List<Sound>? Sounds { get; set; }
|
public List<Sound>? Sounds { get; set; }
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ public class SoundTimecode
|
|||||||
public Show? Show { get; set; }
|
public Show? Show { get; set; }
|
||||||
[Required] public int SoundId { get; set; }
|
[Required] public int SoundId { get; set; }
|
||||||
public Sound? Sound { get; set; }
|
public Sound? Sound { get; set; }
|
||||||
|
|
||||||
[Required] public decimal Start { get; set; }
|
[Required] public decimal Start { get; set; }
|
||||||
[Required] public decimal End { get; set; }
|
[Required] public decimal End { get; set; }
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ public class Staff
|
|||||||
[Required, MaxLength(120)] public string? Email { get; set; }
|
[Required, MaxLength(120)] public string? Email { get; set; }
|
||||||
[Required, MaxLength(100)] public string? F4T2NumberApproval { get; set; }
|
[Required, MaxLength(100)] public string? F4T2NumberApproval { get; set; }
|
||||||
[Required] public DateOnly F4T2ExpirationDate { get; set; }
|
[Required] public DateOnly F4T2ExpirationDate { get; set; }
|
||||||
|
|
||||||
public List<ShowStaff>? ShowStaffs { get; set; }
|
public List<ShowStaff>? ShowStaffs { get; set; }
|
||||||
public List<ExperienceLevel>? ExperienceLevels { get; set; }
|
public List<ExperienceLevel>? ExperienceLevels { get; set; }
|
||||||
public List<StaffAvailability>? StaffAvailabilities { get; set; }
|
public List<StaffAvailability>? StaffAvailabilities { get; set; }
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ public class Supplier
|
|||||||
[Required, MaxLength(100)] public string? Email { get; set; }
|
[Required, MaxLength(100)] public string? Email { get; set; }
|
||||||
[Required, MaxLength(30)] public string? Phone { get; set; }
|
[Required, MaxLength(30)] public string? Phone { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Address { get; set; }
|
[Required, MaxLength(100)] public string? Address { get; set; }
|
||||||
[Required,Length(5,5)] public string? ZipCode { get; set; }
|
[Required, Length(5, 5)] public string? ZipCode { get; set; }
|
||||||
[Required, MaxLength(100)] public string? City { get; set; }
|
[Required, MaxLength(100)] public string? City { get; set; }
|
||||||
[Required] public int DeliveryDelay { get; set; }
|
[Required] public int DeliveryDelay { get; set; }
|
||||||
|
|
||||||
public List<Price>? Prices { get; set; }
|
public List<Price>? Prices { get; set; }
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,6 @@ public class Truck
|
|||||||
[Required] public double? MaxExplosiveCapacity { get; set; }
|
[Required] public double? MaxExplosiveCapacity { get; set; }
|
||||||
[Required, MaxLength(80)] public string? Sizes { get; set; }
|
[Required, MaxLength(80)] public string? Sizes { get; set; }
|
||||||
[Required, MaxLength(40)] public string? Status { get; set; }
|
[Required, MaxLength(40)] public string? Status { get; set; }
|
||||||
|
|
||||||
public List<ShowTruck>? ShowTrucks { get; set; }
|
public List<ShowTruck>? ShowTrucks { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,19 +4,19 @@ namespace PyroFetes.Models;
|
|||||||
|
|
||||||
public class Warehouse
|
public class Warehouse
|
||||||
{
|
{
|
||||||
[Key] public int Id {get; set;}
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Name {get; set;}
|
[Required, MaxLength(100)] public string? Name { get; set; }
|
||||||
[Required] public int MaxWeight {get; set;}
|
[Required] public int MaxWeight { get; set; }
|
||||||
[Required] public int Current {get; set;}
|
[Required] public int Current { get; set; }
|
||||||
[Required] public int MinWeight {get; set;}
|
[Required] public int MinWeight { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Address { get; set; }
|
[Required, MaxLength(100)] public string? Address { get; set; }
|
||||||
[Required, Length(5,5)] public string? ZipCode { get; set; }
|
[Required, Length(5, 5)] public string? ZipCode { get; set; }
|
||||||
[Required, MaxLength(100)] public string? City { get; set; }
|
[Required, MaxLength(100)] public string? City { get; set; }
|
||||||
|
|
||||||
public List<WarehouseProduct>? WarehouseProducts { get; set; }
|
public List<WarehouseProduct>? WarehouseProducts { get; set; }
|
||||||
|
|
||||||
public List<MaterialWarehouse>? MaterialWarehouses {get; set;}
|
public List<MaterialWarehouse>? MaterialWarehouses { get; set; }
|
||||||
|
|
||||||
public List<Movement>? MovementsSource { get; set; }
|
public List<Movement>? MovementsSource { get; set; }
|
||||||
public List<Movement>? MovementsDestination { get; set; }
|
public List<Movement>? MovementsDestination { get; set; }
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,6 @@ public class WarehouseProduct
|
|||||||
public Product? Product { get; set; }
|
public Product? Product { get; set; }
|
||||||
[Required] public int WarehouseId { get; set; }
|
[Required] public int WarehouseId { get; set; }
|
||||||
public Warehouse? Warehouse { get; set; }
|
public Warehouse? Warehouse { get; set; }
|
||||||
|
|
||||||
[Required] public int Quantity { get; set; }
|
[Required] public int Quantity { get; set; }
|
||||||
}
|
}
|
||||||
@@ -20,10 +20,7 @@ builder.Services
|
|||||||
.AddAuthenticationJwtBearer(s => s.SigningKey = "ThisIsASuperSecretJwtKeyThatIsAtLeast32CharsLong")
|
.AddAuthenticationJwtBearer(s => s.SigningKey = "ThisIsASuperSecretJwtKeyThatIsAtLeast32CharsLong")
|
||||||
.AddAuthorization()
|
.AddAuthorization()
|
||||||
.AddFastEndpoints()
|
.AddFastEndpoints()
|
||||||
.SwaggerDocument(options =>
|
.SwaggerDocument(options => { options.ShortSchemaNames = true; })
|
||||||
{
|
|
||||||
options.ShortSchemaNames = true;
|
|
||||||
})
|
|
||||||
.AddCors(options =>
|
.AddCors(options =>
|
||||||
{
|
{
|
||||||
options.AddDefaultPolicy(policyBuilder =>
|
options.AddDefaultPolicy(policyBuilder =>
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class PyroFetesDbContext : DbContext
|
|||||||
|
|
||||||
optionsBuilder.UseSqlServer(connectionString);
|
optionsBuilder.UseSqlServer(connectionString);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Models customization
|
// Models customization
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
@@ -80,13 +80,13 @@ public class PyroFetesDbContext : DbContext
|
|||||||
.WithMany(w => w.MovementsSource)
|
.WithMany(w => w.MovementsSource)
|
||||||
.HasForeignKey(m => m.SourceWarehouseId)
|
.HasForeignKey(m => m.SourceWarehouseId)
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
modelBuilder.Entity<Movement>()
|
modelBuilder.Entity<Movement>()
|
||||||
.HasOne(m => m.DestinationWarehouse)
|
.HasOne(m => m.DestinationWarehouse)
|
||||||
.WithMany(w => w.MovementsDestination)
|
.WithMany(w => w.MovementsDestination)
|
||||||
.HasForeignKey(m => m.DestinationWarehouseId)
|
.HasForeignKey(m => m.DestinationWarehouseId)
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
modelBuilder.Entity<MaterialWarehouse>()
|
modelBuilder.Entity<MaterialWarehouse>()
|
||||||
.HasOne(mw => mw.Material)
|
.HasOne(mw => mw.Material)
|
||||||
.WithMany(m => m.MaterialWarehouses)
|
.WithMany(m => m.MaterialWarehouses)
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ using PyroFetes.Models;
|
|||||||
|
|
||||||
namespace PyroFetes.Repositories;
|
namespace PyroFetes.Repositories;
|
||||||
|
|
||||||
public class DeliverersRepository(PyroFetesDbContext pyrofetesContext, AutoMapper.IMapper mapper) : PyrofetesRepository<Deliverer>(pyrofetesContext, mapper);
|
public class DeliverersRepository(PyroFetesDbContext pyrofetesContext, AutoMapper.IMapper mapper) : PyrofetesRepository<Deliverer>(pyrofetesContext, mapper);
|
||||||
@@ -2,4 +2,4 @@ using PyroFetes.Models;
|
|||||||
|
|
||||||
namespace PyroFetes.Repositories;
|
namespace PyroFetes.Repositories;
|
||||||
|
|
||||||
public class QuotationProductsRepository(PyroFetesDbContext pyrofetesContext, AutoMapper.IMapper mapper) : PyrofetesRepository<QuotationProduct>(pyrofetesContext, mapper);
|
public class QuotationProductsRepository(PyroFetesDbContext pyrofetesContext, AutoMapper.IMapper mapper) : PyrofetesRepository<QuotationProduct>(pyrofetesContext, mapper);
|
||||||
@@ -78,10 +78,10 @@ public class DeliveryNotePdfService : IDeliveryNotePdfService
|
|||||||
{
|
{
|
||||||
table.ColumnsDefinition(columns =>
|
table.ColumnsDefinition(columns =>
|
||||||
{
|
{
|
||||||
columns.RelativeColumn(4); // Produit
|
columns.RelativeColumn(4); // Produit
|
||||||
columns.RelativeColumn(2); // Qté
|
columns.RelativeColumn(2); // Qté
|
||||||
columns.RelativeColumn(2); // PU
|
columns.RelativeColumn(2); // PU
|
||||||
columns.RelativeColumn(2); // Total
|
columns.RelativeColumn(2); // Total
|
||||||
});
|
});
|
||||||
|
|
||||||
// En-têtes
|
// En-têtes
|
||||||
@@ -92,16 +92,16 @@ public class DeliveryNotePdfService : IDeliveryNotePdfService
|
|||||||
header.Cell().Element(CellHeader).AlignRight().Text("PU");
|
header.Cell().Element(CellHeader).AlignRight().Text("PU");
|
||||||
header.Cell().Element(CellHeader).AlignRight().Text("Total");
|
header.Cell().Element(CellHeader).AlignRight().Text("Total");
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (ProductDelivery l in lignes)
|
foreach (ProductDelivery l in lignes)
|
||||||
{
|
{
|
||||||
table.Cell().Element(CellBody).Text(l.Product?.Name);
|
table.Cell().Element(CellBody).Text(l.Product?.Name);
|
||||||
table.Cell().Element(CellBody).AlignRight().Text(l.Quantity.ToString());
|
table.Cell().Element(CellBody).AlignRight().Text(l.Quantity.ToString());
|
||||||
table.Cell().Element(CellBody).AlignRight().Text($"{l.Quantity:n2} €");
|
table.Cell().Element(CellBody).AlignRight().Text($"{l.Quantity:n2} €");
|
||||||
table.Cell().Element(CellBody).AlignRight().Text($"{l.Quantity * l.Quantity:n2} €");
|
table.Cell().Element(CellBody).AlignRight().Text($"{l.Quantity * l.Quantity:n2} €");
|
||||||
|
|
||||||
totalQuantity += l.Quantity;
|
totalQuantity += l.Quantity;
|
||||||
total += l.Quantity * l.Quantity;
|
total += l.Quantity * l.Quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
IContainer CellHeader(IContainer c) =>
|
IContainer CellHeader(IContainer c) =>
|
||||||
@@ -121,13 +121,10 @@ public class DeliveryNotePdfService : IDeliveryNotePdfService
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Signature en bas à droite
|
// Signature en bas à droite
|
||||||
page.Footer().AlignRight().Column(col =>
|
page.Footer().AlignRight().Column(col => { col.Item().AlignRight().Height(100).Image(signature, ImageScaling.FitArea); });
|
||||||
{
|
|
||||||
col.Item().AlignRight().Height(100).Image(signature, ImageScaling.FitArea);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return document.GeneratePdf();
|
return document.GeneratePdf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,10 +75,10 @@ public class PurchaseOrderPdfService : IPurchaseOrderPdfService
|
|||||||
{
|
{
|
||||||
table.ColumnsDefinition(columns =>
|
table.ColumnsDefinition(columns =>
|
||||||
{
|
{
|
||||||
columns.RelativeColumn(4); // Produit
|
columns.RelativeColumn(4); // Produit
|
||||||
columns.RelativeColumn(1); // Qté
|
columns.RelativeColumn(1); // Qté
|
||||||
columns.RelativeColumn(2); // PU
|
columns.RelativeColumn(2); // PU
|
||||||
columns.RelativeColumn(2); // Total
|
columns.RelativeColumn(2); // Total
|
||||||
});
|
});
|
||||||
|
|
||||||
// En-têtes
|
// En-têtes
|
||||||
@@ -89,20 +89,20 @@ public class PurchaseOrderPdfService : IPurchaseOrderPdfService
|
|||||||
header.Cell().Element(CellHeader).AlignRight().Text("PU");
|
header.Cell().Element(CellHeader).AlignRight().Text("PU");
|
||||||
header.Cell().Element(CellHeader).AlignRight().Text("Total");
|
header.Cell().Element(CellHeader).AlignRight().Text("Total");
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (PurchaseProduct l in lignes)
|
foreach (PurchaseProduct l in lignes)
|
||||||
{
|
{
|
||||||
decimal price = l.Product!.Prices!
|
decimal price = l.Product!.Prices!
|
||||||
.FirstOrDefault(p => p.SupplierId == l.PurchaseOrder!.SupplierId)
|
.FirstOrDefault(p => p.SupplierId == l.PurchaseOrder!.SupplierId)
|
||||||
?.SellingPrice ?? 0;
|
?.SellingPrice ?? 0;
|
||||||
|
|
||||||
table.Cell().Element(CellBody).Text(l.Product?.Name);
|
table.Cell().Element(CellBody).Text(l.Product?.Name);
|
||||||
table.Cell().Element(CellBody).AlignRight().Text(l.Quantity.ToString());
|
table.Cell().Element(CellBody).AlignRight().Text(l.Quantity.ToString());
|
||||||
table.Cell().Element(CellBody).AlignRight().Text($"{price:n2} €");
|
table.Cell().Element(CellBody).AlignRight().Text($"{price:n2} €");
|
||||||
table.Cell().Element(CellBody).AlignRight().Text($"{l.Quantity * price:n2} €");
|
table.Cell().Element(CellBody).AlignRight().Text($"{l.Quantity * price:n2} €");
|
||||||
|
|
||||||
totalQuantity += l.Quantity;
|
totalQuantity += l.Quantity;
|
||||||
total += l.Quantity * price;
|
total += l.Quantity * price;
|
||||||
}
|
}
|
||||||
|
|
||||||
IContainer CellHeader(IContainer c) =>
|
IContainer CellHeader(IContainer c) =>
|
||||||
@@ -132,19 +132,16 @@ public class PurchaseOrderPdfService : IPurchaseOrderPdfService
|
|||||||
right.Item().AlignRight().Text($"Total: {totalQuantity:n2} produits");
|
right.Item().AlignRight().Text($"Total: {totalQuantity:n2} produits");
|
||||||
right.Item().AlignRight().Text($"Total HT: {total:n2} €");
|
right.Item().AlignRight().Text($"Total HT: {total:n2} €");
|
||||||
right.Item().AlignRight().Text("Taxe: 20 %");
|
right.Item().AlignRight().Text("Taxe: 20 %");
|
||||||
right.Item().AlignRight().Text($"Total TTC: {(total * 1,2):n2} €");
|
right.Item().AlignRight().Text($"Total TTC: {(total * 1, 2):n2} €");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Signature en bas à droite
|
// Signature en bas à droite
|
||||||
page.Footer().AlignRight().Column(col =>
|
page.Footer().AlignRight().Column(col => { col.Item().AlignRight().Height(100).Image(signature, ImageScaling.FitArea); });
|
||||||
{
|
|
||||||
col.Item().AlignRight().Height(100).Image(signature, ImageScaling.FitArea);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return document.GeneratePdf();
|
return document.GeneratePdf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,10 +74,10 @@ public class QuotationPdfService : IQuotationPdfService
|
|||||||
{
|
{
|
||||||
table.ColumnsDefinition(columns =>
|
table.ColumnsDefinition(columns =>
|
||||||
{
|
{
|
||||||
columns.RelativeColumn(10); // Produit
|
columns.RelativeColumn(10); // Produit
|
||||||
columns.RelativeColumn(2); // Qté
|
columns.RelativeColumn(2); // Qté
|
||||||
columns.RelativeColumn(3); // PU
|
columns.RelativeColumn(3); // PU
|
||||||
columns.RelativeColumn(3); // Total
|
columns.RelativeColumn(3); // Total
|
||||||
});
|
});
|
||||||
|
|
||||||
// En-têtes
|
// En-têtes
|
||||||
@@ -88,15 +88,15 @@ public class QuotationPdfService : IQuotationPdfService
|
|||||||
header.Cell().Element(CellHeader).AlignRight().Text("PU");
|
header.Cell().Element(CellHeader).AlignRight().Text("PU");
|
||||||
header.Cell().Element(CellHeader).AlignRight().Text("Total");
|
header.Cell().Element(CellHeader).AlignRight().Text("Total");
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (QuotationProduct l in lignes)
|
foreach (QuotationProduct l in lignes)
|
||||||
{
|
{
|
||||||
table.Cell().Element(CellBody).Text(l.Product?.Name);
|
table.Cell().Element(CellBody).Text(l.Product?.Name);
|
||||||
table.Cell().Element(CellBody).AlignRight().Text(l.Quantity.ToString());
|
table.Cell().Element(CellBody).AlignRight().Text(l.Quantity.ToString());
|
||||||
table.Cell().Element(CellBody).AlignRight().Text($"{l.Quantity:n2} €");
|
table.Cell().Element(CellBody).AlignRight().Text($"{l.Quantity:n2} €");
|
||||||
table.Cell().Element(CellBody).AlignRight().Text($"{l.Quantity * l.Quantity:n2} €");
|
table.Cell().Element(CellBody).AlignRight().Text($"{l.Quantity * l.Quantity:n2} €");
|
||||||
|
|
||||||
total = total + l.Quantity * l.Quantity;
|
total = total + l.Quantity * l.Quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
IContainer CellHeader(IContainer c) =>
|
IContainer CellHeader(IContainer c) =>
|
||||||
@@ -131,16 +131,13 @@ public class QuotationPdfService : IQuotationPdfService
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Signature en bas à droite
|
// Signature en bas à droite
|
||||||
page.Footer().AlignRight().Column(col =>
|
page.Footer().AlignRight().Column(col => { col.Item().AlignRight().Height(100).Image(signature, ImageScaling.FitArea); });
|
||||||
{
|
|
||||||
col.Item().AlignRight().Height(100).Image(signature, ImageScaling.FitArea);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Pour avoir la vue du PDF en temps réel
|
// Pour avoir la vue du PDF en temps réel
|
||||||
// document.ShowInCompanion();
|
// document.ShowInCompanion();
|
||||||
|
|
||||||
return document.GeneratePdf();
|
return document.GeneratePdf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,6 @@ public class GetPurchaseOrderByIdWithProductsSpec : SingleResultSpecification<Pu
|
|||||||
.Where(x => x.Id == purchaseOrderId)
|
.Where(x => x.Id == purchaseOrderId)
|
||||||
.Include(x => x.PurchaseProducts!)
|
.Include(x => x.PurchaseProducts!)
|
||||||
.ThenInclude(p => p.Product)
|
.ThenInclude(p => p.Product)
|
||||||
.ThenInclude(p=> p!.Prices);
|
.ThenInclude(p => p!.Prices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -5,7 +5,7 @@ namespace PyroFetes.Specifications.PurchaseProducts;
|
|||||||
|
|
||||||
public sealed class GetPurchaseProductByProductIdAndPurchaseOrderIdSpec : SingleResultSpecification<PurchaseProduct>
|
public sealed class GetPurchaseProductByProductIdAndPurchaseOrderIdSpec : SingleResultSpecification<PurchaseProduct>
|
||||||
{
|
{
|
||||||
public GetPurchaseProductByProductIdAndPurchaseOrderIdSpec(int productId, int purchaseOrderId)
|
public GetPurchaseProductByProductIdAndPurchaseOrderIdSpec(int productId, int purchaseOrderId)
|
||||||
{
|
{
|
||||||
Query
|
Query
|
||||||
.Where(p => p.ProductId == productId && p.PurchaseOrderId == purchaseOrderId);
|
.Where(p => p.ProductId == productId && p.PurchaseOrderId == purchaseOrderId);
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ public sealed class GetUserByNameSpec : SingleResultSpecification<User>
|
|||||||
public GetUserByNameSpec(string userName)
|
public GetUserByNameSpec(string userName)
|
||||||
{
|
{
|
||||||
Query
|
Query
|
||||||
.Where(x=> x.Name == userName);
|
.Where(x => x.Name == userName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,5 @@ public sealed class GetProductTotalQuantitySpec : Specification<WarehouseProduct
|
|||||||
{
|
{
|
||||||
Query
|
Query
|
||||||
.Where(wp => wp.ProductId == productId);
|
.Where(wp => wp.ProductId == productId);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user