Example #1
0
 public DossierModelProfile(IDataUnitOfWork unitOfWork, Security.ISecurity security)
 {
     CreateMap <Dossier, DossierModel>()
     .AfterMap((src, dest) => dest.DossierFolders   = GetDossierFolderModels(src.DossierFolders))
     .AfterMap((src, dest) => dest.Roles            = GetDossierRoleModels(src.DossierRoles))
     .AfterMap((src, dest) => dest.Title            = src.DossierFolders.First().Name.Replace("Dossier ", string.Empty))
     .AfterMap((src, dest) => dest.RegistrationUser = security.GetUser(src.RegistrationUser).DisplayName)
     .AfterMap((src, dest) => dest.LastChangedUser  = src.LastChangedUser != null ? security.GetUser(src.LastChangedUser).DisplayName : null);
 }
Example #2
0
 public FascicleModelProfile(IDataUnitOfWork unitOfWork, Security.ISecurity security)
 {
     CreateMap <Fascicle, FascicleModel>()
     .ForCtorParam("id", opt => opt.MapFrom(src => src.UniqueId))
     .AfterMap((src, dest) => dest.FascicleName     = src.Name)
     .AfterMap((src, dest) => dest.Subject          = src.FascicleObject)
     .AfterMap((src, dest) => dest.Name             = "Fascicle")
     .AfterMap((src, dest) => dest.RegistrationUser = security.GetUser(src.RegistrationUser).DisplayName)
     .AfterMap((src, dest) => dest.LastChangedUser  = src.LastChangedUser != null ? security.GetUser(src.LastChangedUser).DisplayName : null);
 }
 public ProtocolModelProfile(IDataUnitOfWork unitOfWork, Security.ISecurity security)
 {
     CreateMap <Protocol, ProtocolModel>()
     .ForCtorParam("location", opt => opt.MapFrom(src => src.Container != null && src.Container.ProtLocation != null ? src.Container.ProtLocation.Name : "location non definita"))
     .ForCtorParam("id", opt => opt.MapFrom(src => src.UniqueId))
     .ForCtorParam("year", opt => opt.MapFrom(src => src.Year))
     .ForCtorParam("number", opt => opt.MapFrom(src => src.Number))
     .ForCtorParam("subject", opt => opt.MapFrom(src => src.Object))
     .AfterMap((src, dest) => dest.AnnulmentReason  = src.LastChangedReason)
     .AfterMap((src, dest) => dest.RegistrationUser = src.RegistrationUser)     //TODO:usare il metodo UsersFinder di ActiveDirectory per avere il DisplayName
     .AfterMap((src, dest) => dest.LastChangedUser  = src.LastChangedUser)
     .AfterMap((src, dest) => dest.Addressee        = src.ProtocolType?.EntityShortId == (short)ProtocolTypology.Outgoing ? src.AdvancedProtocol?.Subject : string.Empty)
     .AfterMap((src, dest) => dest.Assignee         = src.ProtocolType?.EntityShortId == (short)ProtocolTypology.Inbound ? src.AdvancedProtocol?.Subject : string.Empty)
     .AfterMap((src, dest) => dest.RegistrationUser = security.GetUser(src.RegistrationUser).DisplayName)
     .AfterMap((src, dest) => dest.LastChangedUser  = src.LastChangedUser != null ? security.GetUser(src.LastChangedUser).DisplayName : null);
 }
Example #4
0
 public GenericDocumentUnitModelProfile(IDataUnitOfWork unitOfWork, Security.ISecurity security)
 {
     _unitOfWork = unitOfWork;
     _security   = security;
     CreateMap <FascicleDocumentUnit, GenericDocumentUnitModel>()
     .ForCtorParam("id", opt => opt.MapFrom(src => src.DocumentUnit.UniqueId))
     .ForCtorParam("year", opt => opt.MapFrom(src => src.DocumentUnit.Year))
     .ForCtorParam("number", opt => opt.MapFrom(src => src.DocumentUnit.Number))
     .ForCtorParam("subject", opt => opt.MapFrom(src => src.DocumentUnit.Subject))
     .ForCtorParam("category", opt => opt.MapFrom(src => new CategoryModel(Guid.NewGuid(), string.Empty)))
     .ForCtorParam("container", opt => opt.MapFrom(src => new ContainerModel(Guid.NewGuid(), string.Empty)))
     .ForCtorParam("location", opt => opt.MapFrom(src => string.Empty))
     .AfterMap((src, dest) => dest.Title            = src.DocumentUnit.Title)
     .AfterMap((src, dest) => dest.Environment      = src.DocumentUnit.Environment)
     .AfterMap((src, dest) => dest.DocumentUnitName = src.DocumentUnit.DocumentUnitName)
     .AfterMap((src, dest) => dest.RegistrationUser = _security.GetUser(src.RegistrationUser).DisplayName)
     .AfterMap((src, dest) => dest.LastChangedUser  = src.LastChangedUser != null ? _security.GetUser(src.LastChangedUser).DisplayName : null);
 }