Beispiel #1
0
 public Api.ArticleProperty DomainToApi(ArticleProperty value)
 {
     return(new Api.ArticleProperty
     {
         Id = value.Id,
         ArticleId = value.ArticleId,
         ArticlePropertyId = value.ArticlePropertyId,
         Type = value.Type.ToApiValue(),
         Name = value.Name,
         Value = MappingHelpers.ParsePropertyValue(value.Type, value.Value)
     });
 }
        public Api.ClientProperty DomainToApi(ClientProperty value)
        {
            if (value == null)
            {
                return(null);
            }

            return(new Api.ClientProperty
            {
                Id = value.Id,
                ClientId = value.ClientId,
                ClientPropertyId = value.ClientPropertyId,
                Type = value.Type.ToApiValue(),
                Name = value.Name,
                Value = MappingHelpers.ParsePropertyValue(value.Type, value.Value)
            });
        }
        public InvoiceDocument ApiToDomain(Api.InvoiceDocument value)
        {
            if (value == null)
            {
                return(null);
            }

            return(new InvoiceDocument
            {
                Id = value.Id.ToInt(),
                Created = value.Created.ToDateTime(),
                FileName = value.FileName,
                FileSize = value.FileSize.ToInt(),
                InvoiceId = value.InvoiceId.ToInt(),
                MimeType = value.MimeType,
                FileContent = MappingHelpers.ToByteArray(value.Base64File)
            });
        }
        public OfferDocument ApiToDomain(Api.OfferDocument value)
        {
            if (value == null)
            {
                return(null);
            }

            return(new OfferDocument
            {
                Id = int.Parse(value.Id),
                Created = DateTime.Parse(value.Created, CultureInfo.InvariantCulture),
                FileName = value.FileName,
                FileSize = int.Parse(value.FileSize, CultureInfo.InvariantCulture),
                OfferId = int.Parse(value.OfferId, CultureInfo.InvariantCulture),
                MimeType = value.MimeType,
                FileContent = MappingHelpers.ToByteArray(value.Base64File)
            });
        }
        public ClientProperty ApiToDomain(Api.ClientProperty value)
        {
            if (value == null)
            {
                return(null);
            }

            var type = value.Type.ToPropertyType();

            return(new ClientProperty
            {
                Id = value.Id,
                ClientPropertyId = value.ClientPropertyId,
                Type = type,
                ClientId = value.ClientId,
                Name = value.Name,
                Value = MappingHelpers.ParsePropertyValue(type, value.Value)
            });
        }
        public SupplierPropertyValue ApiToDomain(Api.SupplierPropertyValue value)
        {
            if (value == null)
            {
                return(null);
            }

            var type = value.Type.ToPropertyType();

            return(new SupplierPropertyValue
            {
                Id = int.Parse(value.Id),
                SupplierId = int.Parse(value.SupplierId),
                SupplierPropertyId = int.Parse(value.SupplierPropertyId),
                Type = type,
                Name = value.Name,
                Value = MappingHelpers.ParsePropertyValue(type, value.Value)
            });
        }
Beispiel #7
0
        public ArticleProperty ApiToDomain(Api.ArticleProperty value)
        {
            if (value == null)
            {
                return(null);
            }

            var type = value.Type.ToPropertyType();

            return(new ArticleProperty
            {
                Id = value.Id,
                ArticlePropertyId = value.ArticlePropertyId,
                Type = type,
                ArticleId = value.ArticleId,
                Name = value.Name,
                Value = MappingHelpers.ParsePropertyValue(type, value.Value)
            });
        }
        public InboxDocument ApiToDomain(Api.InboxDocument value)
        {
            if (value == null)
            {
                return(null);
            }

            return(new InboxDocument
            {
                Id = value.Id.ToInt(),
                FileSize = value.FileSize.ToInt(),
                FileName = value.FileName.Sanitize(),
                MimeType = value.MimeType.Sanitize(),
                UserId = value.UserId.ToInt(),
                Created = value.Created.ToDateTime(),
                PageCount = value.PageCount.ToInt(),
                Updated = value.Updated.ToDateTime(),
                FileContent = MappingHelpers.ToByteArray(value.Base64File),
                Metadata = value.Metadata?.Data?.ToDictionary(),
                DocumentType = MappingHelpers.ToInboxDocumentType(value.DocumentType)
            });
        }