You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
3.2 KiB
75 lines
3.2 KiB
2 years ago
|
using AutoMapper;
|
||
|
using Win_in.Sfs.Label.Domain.Shared;
|
||
|
|
||
|
namespace Win_in.Sfs.Label.Application;
|
||
|
|
||
|
public static class LabelCommonMapperExtensions
|
||
|
|
||
|
{
|
||
|
public static IMappingExpression<TSource, TDestination> MapPurchaseInfo<TSource, TDestination>(
|
||
|
this IMappingExpression<TSource, TDestination> m)
|
||
|
where TSource : IHasPurchaseInfo
|
||
|
where TDestination : IHasPurchaseInfoDto
|
||
|
{
|
||
|
return m
|
||
|
.ForMember(dest => dest.SupplierCode, opts => opts.MapFrom(src => src.PurchaseInfo.SupplierCode))
|
||
|
.ForMember(dest => dest.PoNumber, opts => opts.MapFrom(src => src.PurchaseInfo.PoNumber))
|
||
|
.ForMember(dest => dest.RpNumber, opts => opts.MapFrom(src => src.PurchaseInfo.RpNumber))
|
||
|
.ForMember(dest => dest.AsnNumber, opts => opts.MapFrom(src => src.PurchaseInfo.AsnNumber))
|
||
|
;
|
||
|
}
|
||
|
|
||
|
public static IMappingExpression<TSource, TDestination> MapProductionInfo<TSource, TDestination>(
|
||
|
this IMappingExpression<TSource, TDestination> m)
|
||
|
where TSource : IHasProductionInfo
|
||
|
where TDestination : IHasProductionInfoDto
|
||
|
{
|
||
|
return m
|
||
|
.ForMember(dest => dest.ProdLine, opts => opts.MapFrom(src => src.ProductionInfo.ProdLine))
|
||
|
.ForMember(dest => dest.Team, opts => opts.MapFrom(src => src.ProductionInfo.Team))
|
||
|
.ForMember(dest => dest.Shift, opts => opts.MapFrom(src => src.ProductionInfo.Shift))
|
||
|
;
|
||
|
}
|
||
|
|
||
|
public static IMappingExpression<TSource, TDestination> MapPurchaseInfoDto<TSource, TDestination>(
|
||
|
this IMappingExpression<TSource, TDestination> m)
|
||
|
where TSource : IHasPurchaseInfoDto
|
||
|
where TDestination : IHasPurchaseInfo
|
||
|
{
|
||
|
return m
|
||
|
.ForMember(dest => dest.PurchaseInfo, opts => opts.MapFrom(src => new PurchaseInfo(src.SupplierCode, src.PoNumber, src.RpNumber, src.AsnNumber)))
|
||
|
;
|
||
|
}
|
||
|
|
||
|
public static IMappingExpression<TSource, TDestination> MapProductionInfoDto<TSource, TDestination>(
|
||
|
this IMappingExpression<TSource, TDestination> m)
|
||
|
where TSource : IHasProductionInfoDto
|
||
|
where TDestination : IHasProductionInfo
|
||
|
{
|
||
|
return m
|
||
|
.ForMember(dest => dest.ProductionInfo, opts => opts.MapFrom(src => new ProductionInfo(src.ProdLine, src.Team, src.Shift)))
|
||
|
;
|
||
|
}
|
||
|
|
||
|
public static IMappingExpression<TSource, TDestination> MapQualityInfo<TSource, TDestination>(
|
||
|
this IMappingExpression<TSource, TDestination> m)
|
||
|
where TSource : IHasQualityInfo
|
||
|
where TDestination : IHasQualityInfoDto
|
||
|
{
|
||
|
return m
|
||
|
.ForMember(dest => dest.QLevel, opts => opts.MapFrom(src => src.QualityInfo.QLevel))
|
||
|
.ForMember(dest => dest.QualityFile, opts => opts.MapFrom(src => src.QualityInfo.QualityFile))
|
||
|
;
|
||
|
}
|
||
|
|
||
|
public static IMappingExpression<TSource, TDestination> MapQualityInfoDto<TSource, TDestination>(
|
||
|
this IMappingExpression<TSource, TDestination> m)
|
||
|
where TSource : IHasQualityInfoDto
|
||
|
where TDestination : IHasQualityInfo
|
||
|
{
|
||
|
return m
|
||
|
.ForMember(dest => dest.QualityInfo, opts => opts.MapFrom(src => new QualityInfo(src.QLevel, src.QualityFile)))
|
||
|
;
|
||
|
}
|
||
|
}
|