internal static MasterDataAttributeDto Create(MasterDataAttribute masterdata, string id, string type) { return(new MasterDataAttributeDto { ParentId = id, ParentType = type, Id = masterdata.Id, Value = masterdata.Value }); }
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); }
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; })); }
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);
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); } }