Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
 public static DateTime GetDateFromTokens(TokenOrdinal ordinal, TokenDayOfWeek day, TokenTime time)
 {
     DateTime theDate = GetDateFromTokens(ordinal, day);
     return theDate + (TimeSpan) time.Value;
 }
Ejemplo n.º 3
0
        public static TokenDeterminateSeries GetSeriesFromTokens(TokenEach each, TokenOther other, TokenDayOfWeek dow, TokenInt year)
        {
            var endDate = new DateTime((int)year.Value + 1, 1, 1).AddDays(-1);
            var startDate = GetFirstDowOfYear((int)year.Value, ((DateTime)dow.Value).DayOfWeek);

            var series = new TokenDeterminateSeries
            {
                EndDate = endDate,
                Interval = 2,
                IntervalType = TokenDeterminateSeries.SeriesIntervalType.DayOfWeek,
                StartDate = startDate,
                Value = dow.Value
            };
            return series;
        }
Ejemplo n.º 4
0
 public static DateTime GetDateFromTokens(TokenDayOfWeek day, TokenTime time)
 {
     DateTime theDate = (DateTime) day.Value;
     return new DateTime(theDate.Year, theDate.Month, theDate.Day, 0, 0, 0) + (TimeSpan)time.Value;
 }
Ejemplo n.º 5
0
        public static TokenDeterminateSeries GetSeriesFromTokens(TokenEach each, TokenOther other, TokenDayOfWeek dow, TokenMonth month)
        {
            DateTime endDate;
            DateTime startDate;

            if (DateTime.Now.Month <= (int)month.Value)
            {
                endDate = new DateTime(DateTime.Now.Year, (int) month.Value,
                    new DateTime(DateTime.Now.Year, (int)month.Value + 1, 1).AddDays(-1).Day);
                startDate = GetFirstDowOfMonth((int)month.Value, DateTime.Now.Year, (DayOfWeek)dow.Value);
            }
            else
            {
                endDate = new DateTime(DateTime.Now.Year + 1, (int) month.Value,
                    new DateTime(DateTime.Now.Year, (int)month.Value + 1, 1).AddDays(-1).Day);
                startDate = GetFirstDowOfMonth((int)month.Value, DateTime.Now.Year + 1, (DayOfWeek)dow.Value);
            }

            var series = new TokenDeterminateSeries
            {
                EndDate = endDate,
                Interval = 2,
                IntervalType = TokenDeterminateSeries.SeriesIntervalType.DayOfWeek,
                StartDate = startDate,
                Value = dow.Value
            };
            return series;
        }
Ejemplo n.º 6
0
        public static TokenIndeterminateSeries GetIndeterminateSeriesFromTokens(TokenEach each, TokenOther other, TokenDayOfWeek dow, TokenTime time)
        {
            var startDate = DateTime.Today;
            var theDateTime = (TimeSpan)time.Value;

            var series = new TokenIndeterminateSeries
            {
                Interval = 2,
                IntervalType = TokenIndeterminateSeries.SeriesIntervalType.DayOfWeek,
                StartDate = startDate + theDateTime,
                Value = dow
            };
            return series;
        }
Ejemplo n.º 7
0
        public static TokenIndeterminateSeries GetIndeterminateSeriesFromTokens(TokenEach each, TokenOther other, TokenDayOfWeek dow)
        {
            var startDate = DateTime.Now;

            var series = new TokenIndeterminateSeries
            {
                Interval = 2,
                IntervalType = TokenIndeterminateSeries.SeriesIntervalType.DayOfWeek,
                StartDate = startDate,
                Value = dow
            };
            return series;
        }
Ejemplo n.º 8
0
 public static DateTime GetDateFromTokens(TokenDayOfWeek dow, TokenMonth month, TokenOrdinal day)
 {
     return new DateTime(DateTime.Now.Year, (int)month.Value, (int)day.Value);
 }
Ejemplo n.º 9
0
 public static DateTime GetDateFromTokens(TokenOrdinal ordinal, TokenDayOfWeek day, TokenMonth month, TokenTime time)
 {
     return GetDateFromTokens(ordinal, day, month) + (TimeSpan) time.Value;
 }