Ejemplo n.º 1
0
        public IList <DeliveryOption> GetOptions(DateTime dtStart, int nextDays, DeliveryFeeCalculator defaultCalc, DateTimeTerm openingHours)
        {
            var result = new List <DeliveryOption>();

            var calc = Calculator ?? defaultCalc;

            if (calc == null)
            {
                return(result);
            }

            IList <DateTimePair> pairs;

            if (SameAsOpeningHours)
            {
                pairs = openingHours.GetDateTimePairs(dtStart, nextDays);
            }
            else if (DateTimes != null)
            {
                pairs = DateTimes.GetDateTimePairs(dtStart, nextDays);
            }
            else
            {
                pairs = new List <DateTimePair>();
            }

            foreach (var p in pairs)
            {
                result.Add(new DeliveryOption()
                {
                    From = p.From,
                    To   = p.To,
                    ReferenceTimePonitType = p.ReferenceTimePonitType,
                    DivisionType           = p.DivisionType,
                    DivisionMinutes        = p.DivisionMinutes,
                    Areas      = Areas,
                    Calculator = calc
                });
            }

            return(result);
        }
Ejemplo n.º 2
0
        public IList <PickupOption> GetOptions(DateTime dtDate, int nextDays, DateTimeTerm openingHours)
        {
            var result = new List <PickupOption>();

            IList <DateTimePair> pairs;

            if (SameAsOpeningHours)
            {
                pairs = openingHours.GetDateTimePairs(dtDate, nextDays);
            }
            else if (DateTimes != null)
            {
                pairs = DateTimes.GetDateTimePairs(dtDate, nextDays);
            }
            else
            {
                pairs = new List <DateTimePair>();
            }

            foreach (var p in pairs)
            {
                foreach (var addr in Addresses)
                {
                    result.Add(new PickupOption()
                    {
                        From = p.From,
                        To   = p.To,
                        ReferenceTimePonitType = p.ReferenceTimePonitType,
                        DivisionType           = p.DivisionType,
                        DivisionMinutes        = p.DivisionMinutes,
                        Address = addr
                    });
                }
            }

            return(result);
        }