コード例 #1
0
ファイル: DateRange.cs プロジェクト: BillTheLoser/api-example
        /// <summary>
        ///     Initializes a new instance of the <see cref="DateRange" /> structure to the specified start and end date.
        /// </summary>
        /// <param name="startDate">A string that contains that first date in the date range.</param>
        /// <param name="endDate">A string that contains the last date in the date range.</param>
        /// <exception cref="System.ArgumentNullException">
        ///		endDate or startDate are <c>null</c>.
        /// </exception>
        /// <exception cref="System.FormatException">
        ///     endDate or startDate do not contain a vaild string representation of a date and time.
        /// </exception>
        /// <exception cref="System.ArgumentException">
        ///		endDate is not greater than or equal to startDate
        /// </exception>
        public DateRange(string startDate, string endDate)
        {
            if (string.IsNullOrWhiteSpace(startDate))
            {
                throw new ArgumentNullException("startDate");
            }

            if (string.IsNullOrWhiteSpace(endDate))
            {
                throw new ArgumentNullException("endDate");
            }

            Start = DateTime.Parse(startDate);
            End   = DateTime.Parse(endDate);

            if (End.Hour == 0 && End.Minute == 0)
            {
                End.AddHours(23);
                End.AddMinutes(59);
                End.AddMilliseconds(999);
            }

            if (End < Start)
            {
                throw new ArgumentException("endDate must be greater than or equal to startDate");
            }
        }
コード例 #2
0
ファイル: DateRange.cs プロジェクト: BillTheLoser/api-example
        public DateRange()
        {
            Start = DateTime.Today;
            End   = DateTime.Today;

            End.AddHours(23);
            End.AddMinutes(59);
            End.AddMilliseconds(999);
        }
コード例 #3
0
        void OnTimeFilterClick(long FilterDuration)
        {
            if (this.ActiveTimeFilterDuration == FilterDuration)
            {
                return;
            }

            ActiveTimeFilterDuration = FilterDuration;

            End   = MaxDate;
            Start = End.AddMilliseconds(-ActiveTimeFilterDuration.Value);

            FilterIntervals(FilterDuration);
            SetDefaultInterval(FilterDuration);

            FilterCurrentChartData(SelectedFilterInterval);
        }