コード例 #1
0
        private bool MeetsContraints(ShippingOptionRecord option, IList <Tuple <int, IShippingInfo> > ShippingInfos, Decimal ItemsTotal)
        {
            foreach (var contraint in option.Contraints)
            {
                double propertyValue = EvalProperty(contraint.Property, ShippingInfos, ItemsTotal);
                switch (contraint.Operator)
                {
                case ShippingContraintOperator.LessThan:
                    if (contraint.Value <= propertyValue)
                    {
                        return(false);
                    }
                    break;

                case ShippingContraintOperator.LessThanOrEqual:
                    if (contraint.Value < propertyValue)
                    {
                        return(false);
                    }
                    break;

                case ShippingContraintOperator.Equal:
                    if (contraint.Value != propertyValue)
                    {
                        return(false);
                    }
                    break;

                case ShippingContraintOperator.GreaterThan:
                    if (contraint.Value >= propertyValue)
                    {
                        return(false);
                    }
                    break;

                case ShippingContraintOperator.GreaterThanOrEqual:
                    if (contraint.Value > propertyValue)
                    {
                        return(false);
                    }
                    break;

                case ShippingContraintOperator.NotEqual:
                    if (contraint.Value == propertyValue)
                    {
                        return(false);
                    }
                    break;
                }
            }

            return(true);
        }
コード例 #2
0
 public void UpdateOption(ShippingOptionRecord record)
 {
     _optionRepository.Update(record);
 }
コード例 #3
0
 public void CreateOption(ShippingOptionRecord record)
 {
     _optionRepository.Create(record);
 }
コード例 #4
0
 public void DeleteOption(ShippingOptionRecord record)
 {
     _optionRepository.Delete(record);
 }