Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AcsApiDateRangeBuilder"/> class.
        /// </summary>
        /// <param name="relativeDate">
        /// A start date.  If supplied, all date ranges will be relative to this date.
        /// </param>
        /// <param name="calendar">
        /// The type of calendar to use. If using FISCAL calendar, all start points (day, month, year) must be defined.
        /// Otherwise, start points are relative to the Gregorian calendar.
        /// </param>
        public AcsApiDateRangeBuilder(DateTime?relativeDate = null, AcsApiDateRange.AcsApiCalendarType calendar = AcsApiDateRange.AcsApiCalendarType.G)
        {
            this.DateRange = new AcsApiDateRange();

            if (relativeDate.HasValue)
            {
                this.DateRange.AsOfDate = relativeDate.Value.ToString(DateFormat);
            }

            this.DateRange.CalendarType = calendar.ToString();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AcsApiDateRangeBuilder"/> class.
        /// </summary>
        /// <param name="relativeDate">
        /// A start date.  If supplied, all date ranges will be relative to this date.
        /// </param>
        /// <param name="calendar">
        /// The type of calendar to use. If using FISCAL calendar, all start points (day, month, year) must be defined. 
        /// Otherwise, start points are relative to the Gregorian calendar.
        /// </param>
        public AcsApiDateRangeBuilder(DateTime? relativeDate = null, AcsApiDateRange.AcsApiCalendarType calendar = AcsApiDateRange.AcsApiCalendarType.G)
        {
            this.DateRange = new AcsApiDateRange();

            if (relativeDate.HasValue)
            {
                this.DateRange.AsOfDate = relativeDate.Value.ToString(DateFormat);
            }

            this.DateRange.CalendarType = calendar.ToString();
        }
 /// <summary>
 /// Set an absolute date range sequence by specifying the type of the sequence and the value, eg. 2 DAYS 
 /// </summary>
 /// <param name="value">Numeric value for the range.</param>
 /// <param name="rangeType">Type of range eg. Days.</param>
 /// <param name="modifier">A modifier to offset the date range.</param>
 public void SetAbsoluteDateRangeSequence(int value,  AcsApiDateRange.AcsApiRangeSequence rangeType, AcsApiDateRange.AcsApiPeriodModifier modifier = AcsApiDateRange.AcsApiPeriodModifier.DEFINED)
 {
     this.DateRange.Range = rangeType.ToString();
     this.DateRange.RangeNumber = value;
     this.DateRange.PeriodModifier = modifier.ToString();
 }
 /// <summary>
 /// Set an absolute date range by specifying the type of the range and the value, eg. YEAR 2015 
 /// </summary>
 /// <param name="rangeType">Type of range eg. Year.</param>
 /// <param name="value">Numeric value for the range.</param>
 /// <param name="modifier">A modifier to offset the date range.</param>
 public void SetAbsoluteDateRange(AcsApiDateRange.AcsApiRange rangeType, int? value = null, AcsApiDateRange.AcsApiPeriodModifier modifier = AcsApiDateRange.AcsApiPeriodModifier.DEFINED)
 {
     this.DateRange.Range = rangeType.ToString();
     this.DateRange.RangeNumber = value;
     this.DateRange.PeriodModifier = modifier.ToString();
 }