73 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			C#
		
	
	
			
		
		
	
	
			73 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			C#
		
	
	
| using AutoMapper;
 | |
| using AutoMapper.EquivalencyExpression;
 | |
| using IRaCIS.Application.Contracts;
 | |
| using IRaCIS.Core.Application.Contracts;
 | |
| using IRaCIS.Core.Domain.Models;
 | |
| 
 | |
| namespace IRaCIS.Core.Application.Service
 | |
| {
 | |
|     public class DocumentConfig : Profile
 | |
|     {
 | |
|         public DocumentConfig()
 | |
|         {
 | |
| 
 | |
|             var userId = Guid.Empty;
 | |
|             var token = string.Empty;
 | |
|             CreateMap<SystemDocument, SystemDocumentView>()
 | |
|                  .ForMember(d => d.FileType, u => u.MapFrom(s => s.FileType.Value))
 | |
|                  .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path)); 
 | |
| 
 | |
|             CreateMap<TrialDocument, TrialDocumentView>()
 | |
|                 .ForMember(d => d.FileType, u => u.MapFrom(s => s.FileType.Value))
 | |
|                 .ForMember(d => d.IsSomeUserSigned, u => u.MapFrom(s => s.TrialDocConfirmedUserList.Any()))
 | |
|                 .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path ));
 | |
| 
 | |
| 
 | |
|             CreateMap<SystemDocument, UnionDocumentView>()
 | |
|                 .ForMember(d => d.IsSystemDoc, u => u.MapFrom(s => true))
 | |
|              .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path ));
 | |
| 
 | |
|             CreateMap<TrialDocument, UnionDocumentView>()
 | |
|                 .ForMember(d => d.IsSystemDoc, u => u.MapFrom(s => false))
 | |
|                .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path ));
 | |
| 
 | |
|             CreateMap<TrialDocNeedConfirmedUserType, NeedConfirmedUserTypeView>().ForMember(d => d.UserTypeShortName, t => t.MapFrom(c => c.UserTypeRole.UserTypeShortName));
 | |
|             CreateMap<SystemDocNeedConfirmedUserType, NeedConfirmedUserTypeView>().ForMember(d => d.UserTypeShortName, t => t.MapFrom(c => c.UserTypeRole.UserTypeShortName));
 | |
| 
 | |
| 
 | |
|             //CreateMap<TrialDocument, TrialDocumentUserView>()
 | |
|             //    .ForMember(t => t.UserConfirmInfo, c => c.MapFrom(t => t.TrialDocConfirmedUserList.Where(u => u.ConfirmUserId == userId).FirstOrDefault()))
 | |
|             //    .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path + "?access_token=" + token)); ;
 | |
| 
 | |
|             CreateMap<TrialDocUserTypeConfirmedUser, TrialDocumentUserConfirmView>()
 | |
|                 .ForMember(d => d.UserName, c => c.MapFrom(t => t.User.UserName))
 | |
|                 .ForMember(d => d.RealName, c => c.MapFrom(t => t.User.FullName));
 | |
| 
 | |
|             //CreateMap<SystemDocConfirmedUser, SystemDocumentUserConfirmView>()
 | |
|             //   .ForMember(d => d.UserName, c => c.MapFrom(t => t.User.UserName))
 | |
|             //   .ForMember(d => d.RealName, c => c.MapFrom(t => t.User.LastName + " / " + t.User.FirstName));
 | |
|             
 | |
| 
 | |
|             CreateMap<TrialUser, TrialDocumentUserConfirmView>();
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|             CreateMap<AddOrEditTrialDocument, TrialDocument>()
 | |
|                 .ForMember(d => d.NeedConfirmedUserTypeList, c => c.MapFrom(t => t.NeedConfirmedUserTypeIdList));
 | |
| 
 | |
|             CreateMap<Guid, TrialDocNeedConfirmedUserType>().EqualityComparison((odto, o) => odto == o.NeedConfirmUserTypeId)
 | |
|                 .ForMember(d => d.NeedConfirmUserTypeId, c => c.MapFrom(t => t))
 | |
|                 .ForMember(d => d.TrialDocumentId, c => c.Ignore());
 | |
| 
 | |
| 
 | |
| 
 | |
|             CreateMap<AddOrEditSystemDocument, SystemDocument>().ForMember(d => d.NeedConfirmedUserTypeList, c => c.MapFrom(t => t.NeedConfirmedUserTypeIdList));
 | |
|             CreateMap<Guid, SystemDocNeedConfirmedUserType>().EqualityComparison((odto, o) => odto == o.NeedConfirmUserTypeId)
 | |
|                .ForMember(d => d.NeedConfirmUserTypeId, c => c.MapFrom(t => t))
 | |
|                .ForMember(d => d.SystemDocumentId, c => c.Ignore());
 | |
|         }
 | |
|     }
 | |
| 
 | |
| }
 |