Exemple #1
0
        public static Display.Analytic ToMockEntity(this DTO.Analytic dto)
        {
            var displayEntity = new Display.Analytic();

            displayEntity.SearchGroupKey = dto.SearchGroupKey;
            displayEntity.SearchId       = dto.SearchGroupId;
            displayEntity.Id             = dto.Id;

            displayEntity.Identity = dto.Identity.ToDisplayEntity();

            if (dto.FilterGroups != null)
            {
                foreach (DTO.FilterGroup filterGroup in dto.FilterGroups)
                {
                    displayEntity.FilterGroups.Add(filterGroup.ToDisplayEntity());
                }
            }

            if (dto.ValueDrivers != null)
            {
                foreach (DTO.AnalyticValueDriver driver in dto.ValueDrivers)
                {
                    displayEntity.ValueDrivers.Add(driver.ToDisplayEntity());
                }
            }

            if (dto.PriceListGroups != null)
            {
                foreach (var priceListGroup in dto.PriceListGroups)
                {
                    displayEntity.PriceListGroups.Add(priceListGroup.ToDisplayEntity());
                }
            }


            return(displayEntity);
        }
Exemple #2
0
        public static DTO.Analytic ToDto(this Display.Analytic displayEntity)
        {
            DTO.AnalyticIdentity identity = displayEntity.Identity.ToDto();

            var filterGroups = new List <DTO.FilterGroup>();

            foreach (Display.FilterGroup filterGroup in displayEntity.FilterGroups)
            {
                filterGroups.Add(filterGroup.ToDto());
            }

            var drivers = new List <DTO.AnalyticValueDriver>();

            foreach (Display.AnalyticValueDriver driver in displayEntity.ValueDrivers)
            {
                drivers.Add(driver.ToDto());
            }

            var priceListGroups = new List <DTO.AnalyticPriceListGroup>();

            foreach (Display.AnalyticPriceListGroup priceListGroup in displayEntity.PriceListGroups)
            {
                priceListGroups.Add(priceListGroup.ToDto());
            }

            var dto = new DTO.Analytic(
                displayEntity.Id,
                displayEntity.SearchId,
                displayEntity.SearchGroupKey,
                identity,
                drivers,
                priceListGroups,
                filterGroups);

            return(dto);
        }