improvements, fixes, etc...
This commit is contained in:
parent
cefb19584d
commit
a2ed202276
|
|
@ -1,24 +1,38 @@
|
||||||
using Mango.Nop.Core.Interfaces;
|
using AyCode.Core.Extensions;
|
||||||
|
using Mango.Nop.Core.Interfaces;
|
||||||
using Nop.Core.Domain.Catalog;
|
using Nop.Core.Domain.Catalog;
|
||||||
using Nop.Core.Domain.Orders;
|
using Nop.Core.Domain.Orders;
|
||||||
|
using Nop.Core.Domain.Shipping;
|
||||||
|
|
||||||
namespace Mango.Nop.Core.Dtos;
|
namespace Mango.Nop.Core.Dtos;
|
||||||
|
|
||||||
public abstract class MgOrderDto : ModelDtoBase<Order>, IMgOrderDto
|
public abstract class MgOrderDto<TOrderItemDto, TProductDto> : ModelDtoBase<Order>, IMgOrderDto<TOrderItemDto, TProductDto> where TOrderItemDto : IMgOrderItemDto<TProductDto> where TProductDto : IMgProductDto
|
||||||
{
|
{
|
||||||
public Guid OrderGuid { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public Guid OrderGuid { get; set; }
|
||||||
public int StoreId { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public int StoreId { get; set; }
|
||||||
public int CustomerId { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public int CustomerId { get; set; }
|
||||||
public int OrderStatusId { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public int OrderStatusId { get; set; }
|
||||||
public int ShippingStatusId { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public int ShippingStatusId { get; set; }
|
||||||
public decimal OrderDiscount { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public decimal OrderDiscount { get; set; }
|
||||||
public decimal OrderTotal { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public decimal OrderTotal { get; set; }
|
||||||
public DateTime CreatedOnUtc { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public DateTime CreatedOnUtc { get; set; }
|
||||||
public DateTime? PaidDateUtc { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public DateTime? PaidDateUtc { get; set; }
|
||||||
public string ShippingMethod { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public string ShippingMethod { get; set; }
|
||||||
public string CustomOrderNumber { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public string CustomOrderNumber { get; set; }
|
||||||
public string CustomValuesXml { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public string CustomValuesXml { get; set; }
|
||||||
public bool Deleted { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public bool Deleted { get; set; }
|
||||||
|
public List<TOrderItemDto> OrderItemDtos { get; private set; }
|
||||||
|
|
||||||
|
public OrderStatus OrderStatus
|
||||||
|
{
|
||||||
|
get => (OrderStatus)OrderStatusId;
|
||||||
|
set => OrderStatusId = (int)value;
|
||||||
|
}
|
||||||
|
public ShippingStatus ShippingStatus
|
||||||
|
{
|
||||||
|
get => (ShippingStatus)ShippingStatusId;
|
||||||
|
set => ShippingStatusId = (int)value;
|
||||||
|
}
|
||||||
|
|
||||||
protected MgOrderDto() :base()
|
protected MgOrderDto() :base()
|
||||||
{ }
|
{ }
|
||||||
|
|
@ -26,4 +40,40 @@ public abstract class MgOrderDto : ModelDtoBase<Order>, IMgOrderDto
|
||||||
{ }
|
{ }
|
||||||
protected MgOrderDto(Order order) : base(order)
|
protected MgOrderDto(Order order) : base(order)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
public override void CopyDtoValuesToEntity(Order entity)
|
||||||
|
{
|
||||||
|
base.CopyDtoValuesToEntity(entity);
|
||||||
|
|
||||||
|
PropertyHelper.CopyPublicValueTypeProperties(this, entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void CopyEntityValuesToDto(Order entity)
|
||||||
|
{
|
||||||
|
base.CopyEntityValuesToDto(entity);
|
||||||
|
|
||||||
|
PropertyHelper.CopyPublicValueTypeProperties(entity, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CopyEntityValuesToDto(Order entity, List<TOrderItemDto> orderItemDtos)
|
||||||
|
{
|
||||||
|
CopyEntityValuesToDto(entity);
|
||||||
|
|
||||||
|
InitializeOrderItemDtos(orderItemDtos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitializeOrderItemDtos(List<TOrderItemDto> orderItemDtos)
|
||||||
|
{
|
||||||
|
OrderItemDtos = orderItemDtos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Order CreateMainEntity()
|
||||||
|
{
|
||||||
|
//base.CreateMainEntity();
|
||||||
|
|
||||||
|
var order = new Order();
|
||||||
|
CopyDtoValuesToEntity(order);
|
||||||
|
|
||||||
|
return order;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
using AyCode.Core.Extensions;
|
||||||
|
using Mango.Nop.Core.Interfaces;
|
||||||
|
using Nop.Core.Domain.Orders;
|
||||||
|
|
||||||
|
namespace Mango.Nop.Core.Dtos;
|
||||||
|
|
||||||
|
public abstract class MgOrderItemDto<TProductDto> : ModelDtoBase<OrderItem>, IMgOrderItemDto<TProductDto> where TProductDto : IMgProductDto
|
||||||
|
{
|
||||||
|
public Guid OrderItemGuid { get; set; }
|
||||||
|
public int OrderId { get; set; }
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
public string AttributesXml { get; set; }
|
||||||
|
public decimal? ItemWeight { get; set; }
|
||||||
|
public TProductDto ProductDto { get; set; }
|
||||||
|
|
||||||
|
protected MgOrderItemDto() :base()
|
||||||
|
{ }
|
||||||
|
protected MgOrderItemDto(int orderItemId) : base(orderItemId)
|
||||||
|
{ }
|
||||||
|
protected MgOrderItemDto(OrderItem orderItem) : base(orderItem)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public override void CopyDtoValuesToEntity(OrderItem entity)
|
||||||
|
{
|
||||||
|
base.CopyDtoValuesToEntity(entity);
|
||||||
|
|
||||||
|
PropertyHelper.CopyPublicValueTypeProperties(this, entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void CopyEntityValuesToDto(OrderItem entity)
|
||||||
|
{
|
||||||
|
base.CopyEntityValuesToDto(entity);
|
||||||
|
|
||||||
|
PropertyHelper.CopyPublicValueTypeProperties(entity, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CopyEntityValuesToDto(OrderItem entity, TProductDto productDto)
|
||||||
|
{
|
||||||
|
CopyEntityValuesToDto(entity);
|
||||||
|
|
||||||
|
InitializeProductDto(productDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitializeProductDto(TProductDto productDto)
|
||||||
|
{
|
||||||
|
ProductDto = productDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override OrderItem CreateMainEntity()
|
||||||
|
{
|
||||||
|
//base.CreateMainEntity();
|
||||||
|
|
||||||
|
var orderItem = new OrderItem();
|
||||||
|
CopyDtoValuesToEntity(orderItem);
|
||||||
|
|
||||||
|
return orderItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
using AyCode.Interfaces.Entities;
|
using AyCode.Interfaces.Entities;
|
||||||
|
using Mango.Nop.Core.Dtos;
|
||||||
using Nop.Core.Domain.Common;
|
using Nop.Core.Domain.Common;
|
||||||
|
using Nop.Core.Domain.Orders;
|
||||||
|
using Nop.Core.Domain.Shipping;
|
||||||
|
|
||||||
namespace Mango.Nop.Core.Interfaces;
|
namespace Mango.Nop.Core.Interfaces;
|
||||||
|
|
||||||
public interface IMgOrderDto : IEntityInt, ISoftDeletedEntity
|
public interface IMgOrderDto<TOrderItemDto, TProductDto> : IEntityInt, ISoftDeletedEntity where TOrderItemDto : IMgOrderItemDto<TProductDto> where TProductDto : IMgProductDto
|
||||||
{
|
{
|
||||||
public Guid OrderGuid { get; set; }
|
public Guid OrderGuid { get; set; }
|
||||||
public int StoreId { get; set; }
|
public int StoreId { get; set; }
|
||||||
|
|
@ -11,18 +14,10 @@ public interface IMgOrderDto : IEntityInt, ISoftDeletedEntity
|
||||||
public int CustomerId { get; set; }
|
public int CustomerId { get; set; }
|
||||||
|
|
||||||
public int OrderStatusId { get; set; }
|
public int OrderStatusId { get; set; }
|
||||||
//public OrderStatus OrderStatus
|
public OrderStatus OrderStatus { get; set; }
|
||||||
//{
|
|
||||||
// get => (OrderStatus)OrderStatusId;
|
|
||||||
// set => OrderStatusId = (int)value;
|
|
||||||
//}
|
|
||||||
|
|
||||||
public int ShippingStatusId { get; set; }
|
public int ShippingStatusId { get; set; }
|
||||||
//public ShippingStatus ShippingStatus
|
public ShippingStatus ShippingStatus { get; set; }
|
||||||
//{
|
|
||||||
// get => (ShippingStatus)ShippingStatusId;
|
|
||||||
// set => ShippingStatusId = (int)value;
|
|
||||||
//}
|
|
||||||
|
|
||||||
public decimal OrderDiscount { get; set; }
|
public decimal OrderDiscount { get; set; }
|
||||||
|
|
||||||
|
|
@ -32,9 +27,12 @@ public interface IMgOrderDto : IEntityInt, ISoftDeletedEntity
|
||||||
public DateTime? PaidDateUtc { get; set; }
|
public DateTime? PaidDateUtc { get; set; }
|
||||||
|
|
||||||
public string ShippingMethod { get; set; }
|
public string ShippingMethod { get; set; }
|
||||||
|
|
||||||
public string CustomOrderNumber { get; set; }
|
public string CustomOrderNumber { get; set; }
|
||||||
public string CustomValuesXml { get; set; }
|
public string CustomValuesXml { get; set; }
|
||||||
|
|
||||||
public bool Deleted { get; set; }
|
public List<TOrderItemDto> OrderItemDtos { get; }
|
||||||
|
|
||||||
|
void InitializeOrderItemDtos(List<TOrderItemDto> orderItemDtos);
|
||||||
|
void CopyEntityValuesToDto(Order entity, List<TOrderItemDto> orderItemDtos);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
using AyCode.Interfaces.Entities;
|
||||||
|
using Nop.Core.Domain.Orders;
|
||||||
|
|
||||||
|
namespace Mango.Nop.Core.Interfaces;
|
||||||
|
|
||||||
|
public interface IMgOrderItemDto<TProductDto> : IEntityInt where TProductDto : IMgProductDto
|
||||||
|
{
|
||||||
|
public Guid OrderItemGuid { get; set; }
|
||||||
|
|
||||||
|
public int OrderId { get; set; }
|
||||||
|
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
public string AttributesXml { get; set; }
|
||||||
|
public decimal? ItemWeight { get; set; }
|
||||||
|
|
||||||
|
public TProductDto ProductDto { get; set; }
|
||||||
|
|
||||||
|
void InitializeProductDto(TProductDto productDto);
|
||||||
|
void CopyEntityValuesToDto(OrderItem entity, TProductDto productDto);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue