Ejemplo n.º 1
0
        /// <summary>
        /// Create a new charging tariff element.
        /// </summary>
        /// <param name="PriceComponent">A price component that makes up the pricing of this tariff.</param>
        /// <param name="TariffRestriction">A tariff restriction.</param>
        public TariffElement(PriceComponent     PriceComponent,
                             TariffRestriction  TariffRestriction)
        {
            #region Initial checks

            if (TariffRestriction == null)
                throw new ArgumentNullException(nameof(TariffRestriction),  "The given enumeration must not be empty!");

            #endregion

            this.PriceComponents     = new PriceComponent[]    { PriceComponent };
            this.TariffRestrictions  = new TariffRestriction[] { TariffRestriction };
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a new charging tariff element.
        /// </summary>
        /// <param name="PriceComponent">A price component that makes up the pricing of this tariff.</param>
        /// <param name="TariffRestriction">A tariff restriction.</param>
        public TariffElement(PriceComponent PriceComponent,
                             TariffRestriction TariffRestriction)
        {
            #region Initial checks

            if (TariffRestriction == null)
            {
                throw new ArgumentNullException(nameof(TariffRestriction), "The given enumeration must not be empty!");
            }

            #endregion

            this.PriceComponents    = new PriceComponent[]    { PriceComponent };
            this.TariffRestrictions = new TariffRestriction[] { TariffRestriction };
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        public JObject ToJSON()
        {
            return(JSONObject.Create(new JProperty("price_components", new JArray(PriceComponents.Select(PriceComponent => PriceComponent.ToJSON()))),

                                     (TariffRestrictions != null && TariffRestrictions.Any())
                                         ? new JProperty("restrictions", new JArray(TariffRestrictions.Select(TariffRestriction => TariffRestriction.ToJSON())))
                                         : null));
        }