Beispiel #1
0
        /// <summary>
        /// Converts a BillingPeriodEnum value to a corresponding string value
        /// </summary>
        /// <param name="enumValue">The BillingPeriodEnum value to convert</param>
        /// <returns>The representative string value</returns>
        public static string ToValue(BillingPeriodEnum enumValue)
        {
            switch (enumValue)
            {
            //only valid enum elements can be used
            //this is necessary to avoid errors
            case BillingPeriodEnum.DAILY:
            case BillingPeriodEnum.MONTHLY:
                return(StringValues[(int)enumValue]);

            //an invalid enum value was requested
            default:
                return(null);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Product" /> class.
 /// </summary>
 /// <param name="amount">Monto del calgo que se aplicará de forma periodica (required).</param>
 /// <param name="billingPeriod">Periodo en el cual se aplicará el cargo, si no se especifica la propiedad frequency por defecto sera la unidad (required).</param>
 /// <param name="frequency">La frecuencia en la que se aplicará el cargo, trabaja en conjunto con la propiedad billingPeriod (required).</param>
 /// <param name="name">Nombre del producto sobre el cual se aplicará el cobro recurrente (required).</param>
 public Product(decimal?amount = default(decimal?), BillingPeriodEnum billingPeriod = default(BillingPeriodEnum), int?frequency = default(int?), string name = default(string))
 {
     // to ensure "amount" is required (not null)
     if (amount == null)
     {
         throw new InvalidDataException("amount is a required property for Product and cannot be null");
     }
     else
     {
         this.Amount = amount;
     }
     // to ensure "billingPeriod" is required (not null)
     if (billingPeriod == null)
     {
         throw new InvalidDataException("billingPeriod is a required property for Product and cannot be null");
     }
     else
     {
         this.BillingPeriod = billingPeriod;
     }
     // to ensure "frequency" is required (not null)
     if (frequency == null)
     {
         throw new InvalidDataException("frequency is a required property for Product and cannot be null");
     }
     else
     {
         this.Frequency = frequency;
     }
     // to ensure "name" is required (not null)
     if (name == null)
     {
         throw new InvalidDataException("name is a required property for Product and cannot be null");
     }
     else
     {
         this.Name = name;
     }
 }