Ejemplo n.º 1
0
        } // ComputeHashCode

        // ----------------------------------------------------------------------
        private static TimeRange GetPeriodOf(DateTime moment, int weekCount, ITimeCalendar calendar)
        {
            int year;
            int weekOfYear;

            TimeTool.GetWeekOfYear(moment, calendar.Culture, calendar.YearWeekType, out year, out weekOfYear);
            return(GetPeriodOf(year, weekOfYear, weekCount, calendar));
        } // GetPeriodOf
Ejemplo n.º 2
0
        } // GetDayName

        // ----------------------------------------------------------------------
        public virtual int GetWeekOfYear(DateTime time)
        {
            int year;
            int weekOfYear;

            TimeTool.GetWeekOfYear(time, culture, yearWeekType, out year, out weekOfYear);
            return(weekOfYear);
        } // GetWeekOfYear
Ejemplo n.º 3
0
        } // IsSameWeek

        // ----------------------------------------------------------------------
        public static bool IsSameWeek(DateTime left, DateTime right, CultureInfo culture,
                                      CalendarWeekRule weekRule, DayOfWeek firstDayOfWeek, YearWeekType weekType)
        {
            if (culture == null)
            {
                throw new ArgumentNullException("culture");
            }

            // left
            int leftWeekOfYear;
            int leftYear;

            TimeTool.GetWeekOfYear(left, culture, weekRule, firstDayOfWeek, weekType, out leftYear, out leftWeekOfYear);

            // rught
            int rightWeekOfYear;
            int rightYear;

            TimeTool.GetWeekOfYear(right, culture, weekRule, firstDayOfWeek, weekType, out rightYear, out rightWeekOfYear);

            return(leftYear == rightYear && leftWeekOfYear == rightWeekOfYear);
        } // IsSameWeek
Ejemplo n.º 4
0
        } // WeekTimeRange

        // ----------------------------------------------------------------------
        protected WeekTimeRange(DateTime moment, int weekCount, ITimeCalendar calendar) :
            base(GetPeriodOf(moment, weekCount, calendar), calendar)
        {
            TimeTool.GetWeekOfYear(moment, calendar.Culture, calendar.YearWeekType, out year, out startWeek);
            this.weekCount = weekCount;
        } // WeekTimeRange