Exemplo n.º 1
0
 internal static MasterDataAttributeDto Create(MasterDataAttribute masterdata, string id, string type)
 {
     return(new MasterDataAttributeDto
     {
         ParentId = id,
         ParentType = type,
         Id = masterdata.Id,
         Value = masterdata.Value
     });
 }
Exemplo n.º 2
0
        private static MasterDataAttribute ParseAttribute(XElement element)
        {
            var attribute = new MasterDataAttribute
            {
                Id    = element.Attribute("id").Value,
                Value = element.HasElements ? string.Empty : element.Value
            };

            attribute.Fields.AddRange(element.Elements().Select(ParseField));

            return(attribute);
        }
Exemplo n.º 3
0
        private static IEnumerable <MasterDataAttribute> ParseAttributes(IEnumerable <XElement> elements, EpcisMasterData masterData)
        {
            return(elements.Select(element =>
            {
                var attr = new MasterDataAttribute
                {
                    ParentId = masterData.Id,
                    ParentType = masterData.Type,
                    Id = element.Attribute("id").Value,
                    Value = element.Value
                };

                ParseField(element.Elements(), attr.Fields, attr);

                return attr;
            }));
        }
Exemplo n.º 4
0
 private static XElement Format(MasterDataAttribute attribute)
 {
     return(new XElement("attribute", new XAttribute("id", attribute.Id), attribute.Value));
 }
 public static XElement Format(MasterDataAttribute attribute) => new XElement("attribute", new XAttribute("id", attribute.Id), attribute.Value);
Exemplo n.º 6
0
        private static void ParseField(IEnumerable <XElement> elements, IList <MasterDataField> output, MasterDataAttribute attribute)
        {
            if (elements == null || !elements.Any())
            {
                return;
            }

            foreach (var element in elements)
            {
                var field = new MasterDataField
                {
                    Name           = element.Name.LocalName,
                    Namespace      = element.Name.NamespaceName,
                    ParentId       = attribute.Id,
                    MasterdataId   = attribute.ParentId,
                    MasterdataType = attribute.ParentType,
                    Value          = element.HasElements ? null : element.Value
                };

                output.Add(field);
                ParseField(element.Elements(), field.Children, attribute);
            }
        }