111 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			C#
		
	
	
			
		
		
	
	
			111 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			C#
		
	
	
| using AutoMapper;
 | |
| using IRaCIS.Application.Contracts;
 | |
| using IRaCIS.Core.Application.Contracts;
 | |
| using IRaCIS.Core.Application.Helper;
 | |
| using IRaCIS.Core.Application.ViewModel;
 | |
| 
 | |
| namespace IRaCIS.Core.Application.Service
 | |
| {
 | |
|     public class CommonConfig : Profile
 | |
|     {
 | |
|         public CommonConfig()
 | |
|         {
 | |
| 
 | |
| 
 | |
|             CreateMap<FrontAuditConfig, FrontAuditConfigAddOrEdit>().ReverseMap();
 | |
| 
 | |
|             CreateMap<EmailNoticeConfigAddOrEdit, EmailNoticeConfig>().ReverseMap();
 | |
| 
 | |
| 
 | |
|             CreateMap<EmailNoticeUserType, EmailUserTypeDto>();
 | |
| 
 | |
| 
 | |
|             var trialId = Guid.Empty;
 | |
|             CreateMap<EmailNoticeConfig, TrialSelectEmailNoticeConfigView>().IncludeBase<EmailNoticeConfig, EmailNoticeConfigView>()
 | |
|                  .ForMember(o => o.IsHaveSelected, t => t.MapFrom(u => u.TrialEmailNoticeConfigList.Any(c => c.TrialId == trialId && c.SysEmailNoticeConfigId == u.Id)))
 | |
|                 ;
 | |
| 
 | |
|             CreateMap<EmailNoticeConfig, EmailNoticeConfigView>()
 | |
|                 .ForMember(t => t.EmailNoticeUserList, u => u.MapFrom(c => c.EmailNoticeUserTypeList));
 | |
| 
 | |
|             CreateMap<EmailNoticeConfig, EmailNoticeConfigExportDto>();
 | |
|             
 | |
| 
 | |
|             CreateMap<Dictionary, DicView>()
 | |
|             .ForMember(t => t.ParentCode, u => u.MapFrom(c => c.Parent.Code));
 | |
|             CreateMap<SystemBasicData, SystemBasicDataView>();
 | |
| 
 | |
|             var isEn_Us = false;
 | |
|             CreateMap<SystemBasicData, SystemBasicDataSelect>()
 | |
|                  .ForMember(o => o.ParentCode, t => t.MapFrom(u => u.Parent.Code))
 | |
|                   .ForMember(o => o.Value, t => t.MapFrom(u => isEn_Us ? u.Value : u.ValueCN));
 | |
| 
 | |
|             CreateMap<SystemBasicDataAddOrEdit, SystemBasicData>().ReverseMap();
 | |
| 
 | |
| 
 | |
| 
 | |
|             CreateMap<Dictionary, BasicDicView>()
 | |
|                  .ForMember(o => o.ConfigType, t => t.MapFrom(u => u.ConfigDictionary.Code));
 | |
| 
 | |
|             CreateMap<AddOrEditBasicDic, Dictionary>().ReverseMap();
 | |
| 
 | |
| 
 | |
|             CreateMap<AddBasicDicAndChild, Dictionary>().ForMember(o => o.ChildList, t => t.Ignore());
 | |
|             CreateMap<AddBasicDicChild, Dictionary>();
 | |
| 
 | |
|             CreateMap<Dictionary, BasicDicSelectCopy>()
 | |
|                  //.ForMember(o => o.ParentChildCodeEnum, t => t.MapFrom(u => u.Parent.ChildCodeEnum))
 | |
|                  .ForMember(o => o.Value, t => t.MapFrom(u => isEn_Us ? u.Value : u.ValueCN))
 | |
|                  .ForMember(o => o.ParentCode, t => t.MapFrom(u => u.Parent.Code));
 | |
| 
 | |
|             CreateMap<Dictionary, BasicDicSelect>()
 | |
|                  //.ForMember(o => o.ParentChildCodeEnum, t => t.MapFrom(u => u.Parent.ChildCodeEnum))
 | |
|                  .ForMember(o => o.ParentCode, t => t.MapFrom(u => u.Parent.Code));
 | |
| 
 | |
|             var token = "";
 | |
|             CreateMap<CommonDocument, CommonDocumentView>()
 | |
|                  .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path + "?access_token=" + token));
 | |
| 
 | |
|             CreateMap<CommonDocument, CommonDocumentAddOrEdit>().ReverseMap();
 | |
| 
 | |
|             CreateMap<Internationalization, InternationalizationView>()
 | |
|                  .ForMember(o => o.Version, t => t.MapFrom(u => u.PublishLog.Version));
 | |
| 
 | |
|             CreateMap<Internationalization, InternationExportDTO>()
 | |
|                .ForMember(o => o.Version, t => t.MapFrom(u => u.PublishLog.Version));
 | |
| 
 | |
|             CreateMap<Internationalization, InternationalizationAddOrEdit>().ReverseMap();
 | |
| 
 | |
|             CreateMap<InternationalizationAddOrEdit, IRCGlobalInfoDTO>();
 | |
|             
 | |
| 
 | |
|             CreateMap<Internationalization, BatchInternationalizationDto>().ReverseMap();
 | |
| 
 | |
|             CreateMap<Internationalization, IRCGlobalInfoDTO>();
 | |
| 
 | |
|             CreateMap<EventStoreRecord, EventStoreRecordView>();
 | |
|             
 | |
|             CreateMap<BatchAddInternationalizationDto, InternationalizationAddOrEdit>();
 | |
| 
 | |
| 
 | |
|             CreateMap<PublishLog, PublishLogView>();
 | |
|             CreateMap<PublishLog, PublishLogAddOrEdit>().ReverseMap();
 | |
| 
 | |
|             CreateMap<PublishLog, PublishVersionSelect>();
 | |
| 
 | |
|             CreateMap<ExploreRecommend, ExploreRecommendView>();
 | |
|             CreateMap<ExploreRecommend, ExploreRecommendAddOrEdit>().ReverseMap();
 | |
| 
 | |
| 
 | |
|             CreateMap<TrialImageDownload, TrialImageDownloadExportDto>()
 | |
|                 .ForMember(d => d.UserFullName, u => u.MapFrom(s => s.CreateUserRole.FullName))
 | |
|                 .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.CreateUserRole.UserTypeEnum))
 | |
|                 .ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.UserName))
 | |
|                 .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode));
 | |
| 
 | |
| 
 | |
|         }
 | |
|     }
 | |
| 
 | |
| }
 |