You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
2.2 KiB
C#

using Mapster;
using Myshipping.Application.Entity;
using Myshipping.Application.Service.BookingOrder.Dto;
namespace Myshipping.Application
{
public class Mapper : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.ForType<BookingCustomerOrder, BookingCustomerOrderListOutput>()
.Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd") : null)
.Map(dest => dest.CreatedTime, src => src.CreatedTime.HasValue ? src.CreatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty)
.Map(dest => dest.UpdatedTime, src => src.UpdatedTime.HasValue ? src.UpdatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty);
config.ForType<BookingCustomerOrder, BookingCustomerOrderSaveOutput>()
.Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd") : null)
.Map(dest => dest.CreatedTime, src => src.CreatedTime.HasValue ? src.CreatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty)
.Map(dest => dest.UpdatedTime, src => src.UpdatedTime.HasValue ? src.UpdatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty);
config.ForType<BookingCustomerOrder, BookingCustomerSubmitDto>()
.Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd") : null);
config.ForType<BookingOrder, BookingOrderSyncCustomerDto>()
.Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd") : null)
.Map(dest => dest.CLOSEDOCDATE, src => src.CLOSEDOCDATE.HasValue ? src.CLOSEDOCDATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : null)
.Map(dest => dest.CLOSINGDATE, src => src.CLOSINGDATE.HasValue ? src.CLOSINGDATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : null)
.Map(dest => dest.CLOSEVGMDATE, src => src.CLOSEVGMDATE.HasValue ? src.CLOSEVGMDATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : null);
config.ForType<BookingLog, BookingLogSyncCustomerDto>()
.Map(dest => dest.CreatedTime, src => src.CreatedTime.HasValue ? src.CreatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty);
}
}
}