Beispiel #1
0
        public static DateTime GetDateFromTokens(TokenOrdinal ordinal, TokenDayOfWeek day, TokenMonth month)
        {
            int number = (int)ordinal.Value;
            DayOfWeek dayOfWeek = ((DateTime)day.Value).DayOfWeek;
            int foundCounter = 0;

            DateTime startDate = new DateTime(DateTime.Now.Year, (int)month.Value, 1, 0, 0, 0);

            while (true)
            {
                if (startDate.DayOfWeek == dayOfWeek)
                {
                    foundCounter++;
                    if (foundCounter == number)
                    {
                        return startDate;
                    }
                }

                startDate = startDate.AddDays(1);
            }
        }
Beispiel #2
0
        public static TokenDeterminateSeries GetSeriesFromTokens(TokenEach each, TokenOrdinal ordinal, TokenInt year)
        {
            var endDate = new DateTime((int)year.Value + 1, 1, 1).AddDays(-1);
            var startDate = new DateTime((int)year.Value, 1, (int)ordinal.Value);

            var series = new TokenDeterminateSeries
            {
                EndDate = endDate,
                Interval = (int)ordinal.Value,
                IntervalType = TokenDeterminateSeries.SeriesIntervalType.DayOfMonth,
                StartDate = startDate,
                Value = ordinal.Value
            };
            return series;
        }
Beispiel #3
0
 public static DateTime GetDateFromTokens(TokenOrdinal ordinal, TokenDayOfWeek day, TokenTime time)
 {
     DateTime theDate = GetDateFromTokens(ordinal, day);
     return theDate + (TimeSpan) time.Value;
 }
Beispiel #4
0
        public static TokenIndeterminateSeries GetIndeterminateSeriesFromTokens(TokenEach each, TokenOrdinal ordinal, TokenDayOfWeek dow, TokenTime time)
        {
            var startDate = DateTime.Today;
            var theDateTime = (TimeSpan)time.Value;

            var series = new TokenIndeterminateSeries
            {
                Interval = (int)ordinal.Value,
                IntervalType = TokenIndeterminateSeries.SeriesIntervalType.DayOfWeek,
                StartDate = startDate + theDateTime,
                Value = dow
            };
            return series;
        }
Beispiel #5
0
 public static DateTime GetDateFromTokens(TokenMonth month, TokenOrdinal day, TokenNumeric year)
 {
     return new DateTime((int) year.Value, (int)month.Value, (int)day.Value);
 }
Beispiel #6
0
        public static TokenIndeterminateSeries GetIndeterminateSeriesFromTokens(TokenEach each, TokenOrdinal ordinal, TokenDayOfWeek dow)
        {
            var startDate = DateTime.Now;

            var series = new TokenIndeterminateSeries
            {
                Interval = (int)ordinal.Value,
                IntervalType = TokenIndeterminateSeries.SeriesIntervalType.DayOfWeek,
                StartDate = startDate,
                Value = dow
            };
            return series;
        }
Beispiel #7
0
 public static DateTime GetDateFromTokens(TokenMonth month, TokenOrdinal day)
 {
     return new DateTime(DateTime.Now.Year, (int)month.Value, (int)day.Value);
 }
Beispiel #8
0
        public static TokenIndeterminateSeries GetIndeterminateSeriesFromTokens(TokenEach each, TokenOrdinal ordinal)
        {
            var startDate = DateTime.Now;

            var series = new TokenIndeterminateSeries
            {
                Interval = 1,
                IntervalType = TokenIndeterminateSeries.SeriesIntervalType.DayOfMonth,
                StartDate = startDate,
                Value = ordinal.Value
            };
            return series;
        }
Beispiel #9
0
 public static DateTime GetDateFromTokens(TokenMonth month, TokenOrdinal day, TokenTime time)
 {
     return new DateTime(DateTime.Now.Year, (int)month.Value, (int)day.Value) + (TimeSpan)time.Value;
 }
Beispiel #10
0
 public static DateTime GetDateFromTokens(TokenOrdinal ordinal, TokenDayOfWeek day, TokenMonth month, TokenTime time)
 {
     return GetDateFromTokens(ordinal, day, month) + (TimeSpan) time.Value;
 }