Esempio n. 1
0
        internal IEnumerable <EpcisMasterData> FormatMasterdata()
        {
            return(MasterDataDtos.Select(md =>
            {
                var masterdata = md.ToMasterData();
                masterdata.Children.AddRange(HierarchyDtos.Where(x => x.Type == md.Type && x.ParentId == md.Id).Select(x => x.ToHierarchy()));
                masterdata.Attributes.AddRange(AttributeDtos.Where(x => x.ParentType == md.Type && x.ParentId == md.Id).Select(x => x.ToAttribute()));

                return masterdata;
            }));
        }
Esempio n. 2
0
        public void AddMasterdata(EpcisMasterData masterdata)
        {
            MasterDataDtos.Add(MasterDataDto.Create(masterdata));

            foreach (var attribute in masterdata.Attributes)
            {
                var attributeDto = MasterDataAttributeDto.Create(attribute, masterdata.Id, masterdata.Type);

                AttributeDtos.Add(attributeDto);
                FieldDtos.AddRange(attribute.Fields.ToFlattenedDtos(attributeDto));
            }

            HierarchyDtos.AddRange(masterdata.Children.Select(x => MasterDataHierarchyDto.Create(x, masterdata.Id, masterdata.Type)));
        }