Exemplo n.º 1
0
        protected override APIProtocol.Protocol TransformDTO(DSW.Protocol entity)
        {
            if (entity == null)
            {
                throw new ArgumentException("Impossibile trasformare Protocol se l'entità non è inizializzata");
            }

            APIProtocol.Protocol apiProtocol = new APIProtocol.Protocol();
            apiProtocol.UniqueId                 = entity.Id;
            apiProtocol.Year                     = entity.Year;
            apiProtocol.Number                   = entity.Number;
            apiProtocol.Object                   = entity.ProtocolObject;
            apiProtocol.RegistrationDate         = entity.RegistrationDate;
            apiProtocol.RegistrationUser         = entity.RegistrationUser;
            apiProtocol.LastChangedDate          = entity.LastChangedDate;
            apiProtocol.LastChangedUser          = entity.LastChangedUser;
            apiProtocol.ObjectChangeReason       = entity.ObjectChangeReason;
            apiProtocol.DocumentDate             = entity.DocumentDate;
            apiProtocol.DocumentProtocol         = entity.DocumentProtocol;
            apiProtocol.IdDocument               = entity.IdDocument;
            apiProtocol.IdAttachments            = entity.IdAttachments;
            apiProtocol.DocumentCode             = entity.DocumentCode;
            apiProtocol.IdStatus                 = Convert.ToInt16(entity.IdStatus);
            apiProtocol.LastChangedReason        = entity.LastChangedReason;
            apiProtocol.AlternativeRecipient     = entity.AlternativeRecipient;
            apiProtocol.JournalDate              = entity.JournalDate;
            apiProtocol.LastConservationDate     = entity.LastConservationDate;
            apiProtocol.HasConservatedDocs       = entity.HasConservatedDocs;
            apiProtocol.IdAnnexed                = entity.IdAnnexed != Guid.Empty ? entity.IdAnnexed : (Guid?)null;
            apiProtocol.HandlerDate              = entity.HandlerDate;
            apiProtocol.TDError                  = entity.TDError;
            apiProtocol.IdProtocolKind           = entity.IdProtocolKind;
            apiProtocol.DematerialisationChainId = entity.DematerialisationChainId;
            apiProtocol.Category                 = _mapperCategory.MappingDTO(entity.Category);
            apiProtocol.Container                = _mapperContainer.MappingDTO(entity.Container);
            apiProtocol.ProtocolRoles            = entity.Roles.Select(s => _mapperProtocolRoleEntity.MappingDTO(s)).ToList();
            apiProtocol.ProtocolUsers            = entity.Users.Select(u => _mapperProtocolUserEntity.MappingDTO(u)).ToList();
            return(apiProtocol);
        }
Exemplo n.º 2
0
        protected override APISeriesItem.DocumentSeriesItem TransformDTO(DSW.DocumentSeriesItem entity)
        {
            if (entity == null)
            {
                throw new ArgumentException("Impossibile trasformare DocumentSeriesItem se l'entità non è inizializzata");
            }

            APISeriesItem.DocumentSeriesItem apiDocumentSeriesItem = new APISeriesItem.DocumentSeriesItem();
            apiDocumentSeriesItem.EntityId                 = entity.Id;
            apiDocumentSeriesItem.UniqueId                 = entity.UniqueId;
            apiDocumentSeriesItem.Year                     = entity.Year;
            apiDocumentSeriesItem.Number                   = entity.Number;
            apiDocumentSeriesItem.IdMain                   = entity.IdMain;
            apiDocumentSeriesItem.IdAnnexed                = entity.IdAnnexed;
            apiDocumentSeriesItem.PublishingDate           = entity.PublishingDate;
            apiDocumentSeriesItem.RetireDate               = entity.RetireDate;
            apiDocumentSeriesItem.Subject                  = entity.Subject;
            apiDocumentSeriesItem.Status                   = StatusConverter(entity.Status);
            apiDocumentSeriesItem.IdUnpublishedAnnexed     = entity.IdUnpublishedAnnexed;
            apiDocumentSeriesItem.DematerialisationChainId = entity.DematerialisationChainId;
            apiDocumentSeriesItem.Priority                 = entity.Priority;
            apiDocumentSeriesItem.RegistrationDate         = entity.RegistrationDate;
            apiDocumentSeriesItem.RegistrationUser         = entity.RegistrationUser;
            apiDocumentSeriesItem.LastChangedDate          = entity.LastChangedDate;
            apiDocumentSeriesItem.LastChangedUser          = entity.LastChangedUser;
            apiDocumentSeriesItem.Category                 = entity.SubCategory == null?_mapperCategoryEntity.MappingDTO(entity.Category) : _mapperCategoryEntity.MappingDTO(entity.SubCategory);

            apiDocumentSeriesItem.DocumentSeries          = _mapperDocumentSeriesEntity.MappingDTO(entity.DocumentSeries);
            apiDocumentSeriesItem.DocumentSeriesItemRoles = _mapperDocumentSeriesItemRoleEntity.MappingDTO(entity.DocumentSeriesItemRoles);

            return(apiDocumentSeriesItem);
        }