Example #1
0
        /// <summary>
        ///     NOTE: Code-generation-invoked method, method name and parameter order matters
        /// </summary>
        /// <param name="dtx">calendar</param>
        /// <param name="factor">factor</param>
        /// <param name="tp">duration</param>
        public static DateTimeEx ActionCalendarPlusMinusTimePeriod(
            DateTimeEx dtx,
            int factor,
            TimePeriod tp)
        {
            if (tp == null) {
                return dtx;
            }

            if (tp.Years != null) {
                dtx.AddYears(factor * tp.Years.Value);
            }

            if (tp.Months != null) {
                dtx.AddMonths(factor * tp.Months.Value);
            }

            if (tp.Weeks != null) {
                dtx.AddDays(factor * tp.Weeks.Value * 7);
            }

            if (tp.Days != null) {
                dtx.AddDays(factor * tp.Days.Value);
            }

            if (tp.Hours != null) {
                dtx.AddHours(factor * tp.Hours.Value);
            }

            if (tp.Minutes != null) {
                dtx.AddMinutes(factor * tp.Minutes.Value);
            }

            if (tp.Seconds != null) {
                dtx.AddSeconds(factor * tp.Seconds.Value);
            }

            if (tp.Milliseconds != null) {
                dtx.AddMilliseconds(factor * tp.Milliseconds.Value);
            }

            return dtx;
        }
Example #2
0
        public static void Action(DateTimeEx dateTime, int factor, TimePeriod tp)
        {
            if (tp == null)
            {
                return;
            }

            if (tp.Years != null)
            {
                dateTime.AddYears(tp.Years.Value * factor);
            }
            if (tp.Months != null)
            {
                dateTime.AddMonths(tp.Months.Value * factor, DateTimeMathStyle.Java);
            }
            if (tp.Weeks != null)
            {
                dateTime.AddDays(tp.Weeks.Value * 7 * factor, DateTimeMathStyle.Java);
            }
            if (tp.Days != null)
            {
                dateTime.AddDays(tp.Days.Value * factor, DateTimeMathStyle.Java);
            }
            if (tp.Hours != null)
            {
                dateTime.AddHours(tp.Hours.Value * factor, DateTimeMathStyle.Java);
            }
            if (tp.Minutes != null)
            {
                dateTime.AddMinutes(tp.Minutes.Value * factor, DateTimeMathStyle.Java);
            }
            if (tp.Seconds != null)
            {
                dateTime.AddSeconds(tp.Seconds.Value * factor, DateTimeMathStyle.Java);
            }
            if (tp.Milliseconds != null)
            {
                dateTime.AddMilliseconds(tp.Milliseconds.Value * factor, DateTimeMathStyle.Java);
            }
        }
Example #3
0
 public void Add(DateTimeEx dateTime, int value)
 {
     dateTime.AddHours(value);
 }
Example #4
0
 public void Add(
     DateTimeEx dtx,
     int value)
 {
     dtx.AddHours(value);
 }