public PricingEveryday(
     int id,
     string searchGroupKey,
     PricingIdentity identity,
     List <FilterGroup> filterGroups,
     List <PricingEverydayValueDriver> valueDrivers,
     PricingEverydayKeyValueDriver keyValueDriver,
     List <PricingEverydayLinkedValueDriver> linkedValueDrivers,
     List <PricingMode> pricingModes,
     List <PricingEverydayPriceListGroup> priceListGroups,
     PricingKeyPriceListRule keyPriceListRule,
     List <PricingLinkedPriceListRule> linkedPriceListRules,
     List <PricingEverydayResult> results
     )
 {
     Id                   = id;
     SearchGroupKey       = searchGroupKey;
     Identity             = identity;
     FilterGroups         = filterGroups;
     ValueDrivers         = valueDrivers;
     KeyValueDriver       = keyValueDriver;
     LinkedValueDrivers   = linkedValueDrivers;
     PricingModes         = pricingModes;
     PriceListGroups      = priceListGroups;
     KeyPriceListRule     = keyPriceListRule;
     LinkedPriceListRules = linkedPriceListRules;
     Results              = results;
 }
 public PricingEveryday(
     int id,
     PricingEverydayKeyValueDriver keyValueDriver,
     List <PricingEverydayLinkedValueDriver> linkedValueDrivers
     )
 {
     Id                 = id;
     KeyValueDriver     = keyValueDriver;
     LinkedValueDrivers = linkedValueDrivers;
 }
Example #3
0
        public static Display.PricingEverydayKeyValueDriver ToDisplayEntity(this DTO.PricingEverydayKeyValueDriver dto)
        {
            var displayEntity = new Display.PricingEverydayKeyValueDriver();

            displayEntity.ValueDriverId = dto.ValueDriverId;

            foreach (DTO.PricingEverydayKeyValueDriverGroup group in dto.Groups)
            {
                displayEntity.Groups.Add(group.ToDisplayEntity());
            }

            return(displayEntity);
        }
Example #4
0
        public static DTO.PricingEverydayKeyValueDriver ToDto(this Display.PricingEverydayKeyValueDriver displayEntity)
        {
            var groups = new List <DTO.PricingEverydayKeyValueDriverGroup>();

            foreach (Display.PricingEverydayKeyValueDriverGroup group in displayEntity.Groups)
            {
                groups.Add(group.ToDto());
            }
            var dto = new DTO.PricingEverydayKeyValueDriver(displayEntity.ValueDriverId, groups);

            displayEntity.IsDirty = false;

            return(dto);
        }
        public static DTO.PricingEveryday ToDto(this Display.PricingEveryday displayEntity)
        {
            DTO.PricingIdentity identity = displayEntity.Identity.ToDto();

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

            if (displayEntity.FilterGroups != null)
            {
                foreach (var filterGroup in displayEntity.FilterGroups)
                {
                    filterGroups.Add(filterGroup.ToDto());
                }
            }

            var valueDrivers = new List <DTO.PricingEverydayValueDriver>();

            if (displayEntity.ValueDrivers != null)
            {
                foreach (var driver in displayEntity.ValueDrivers)
                {
                    valueDrivers.Add(driver.ToDto());
                }
            }
            DTO.PricingEverydayKeyValueDriver keyValueDriver = new DTO.PricingEverydayKeyValueDriver();
            if (displayEntity.KeyValueDriver != null)
            {
                keyValueDriver = displayEntity.KeyValueDriver.ToDto();
            }

            var linkedValueDrivers = new List <DTO.PricingEverydayLinkedValueDriver>();

            if (displayEntity.LinkedValueDrivers != null)
            {
                foreach (var driver in displayEntity.LinkedValueDrivers)
                {
                    linkedValueDrivers.Add(driver.ToDto());
                }
            }

            var pricingModes = new List <DTO.PricingMode>();

            if (displayEntity.PricingModes != null)
            {
                foreach (var mode in displayEntity.PricingModes)
                {
                    pricingModes.Add(mode.ToDto());
                }
            }

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

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

            DTO.PricingKeyPriceListRule keyPriceListRule = new DTO.PricingKeyPriceListRule();
            if (displayEntity.KeyPriceListRule != null)
            {
                keyPriceListRule = displayEntity.KeyPriceListRule.ToDto();
            }

            var linkedPriceListRules = new List <DTO.PricingLinkedPriceListRule>();

            if (displayEntity.LinkedPriceListRules != null)
            {
                foreach (var rule in displayEntity.LinkedPriceListRules)
                {
                    linkedPriceListRules.Add(rule.ToDto());
                }
            }

            var results = new List <DTO.PricingEverydayResult>();

            if (displayEntity.Results != null)
            {
                foreach (var result in displayEntity.Results)
                {
                    results.Add(result.ToDto());
                }
            }

            DTO.PricingEveryday dto = new DTO.PricingEveryday(
                displayEntity.Id,
                displayEntity.SearchGroupKey,
                identity,
                filterGroups,
                valueDrivers,
                keyValueDriver,
                linkedValueDrivers,
                pricingModes,
                priceListGroups,
                keyPriceListRule,
                linkedPriceListRules,
                results);
            return(dto);
        }