Example #1
0
        } // MonthTimeRange

        // ----------------------------------------------------------------------
        protected MonthTimeRange(int startYear, YearMonth startMonth, int monthCount, ITimeCalendar calendar) :
            base(GetPeriodOf(calendar, startYear, startMonth, monthCount), calendar)
        {
            this.startYear  = startYear;
            this.startMonth = startMonth;
            this.monthCount = monthCount;
            TimeTool.AddMonth(startYear, startMonth, monthCount - 1, out endYear, out endMonth);
        } // MonthTimeRange
Example #2
0
        } // Months

        // ----------------------------------------------------------------------
        public ITimePeriodCollection GetMonths()
        {
            TimePeriodCollection months = new TimePeriodCollection();

            for (int i = 0; i < MonthCount; i++)
            {
                int       year;
                YearMonth month;
                TimeTool.AddMonth(StartYear, StartMonth, i, out year, out month);
                months.Add(new Month(year, month, Calendar));
            }
            return(months);
        } // GetMonths
Example #3
0
        } // GetQuarters

        // ----------------------------------------------------------------------
        public ITimePeriodCollection GetMonths()
        {
            TimePeriodCollection months = new TimePeriodCollection();

            for (int i = 0; i < halfyearCount; i++)
            {
                for (int month = 0; month < TimeSpec.MonthsPerHalfyear; month++)
                {
                    int       year;
                    YearMonth yearMonth;
                    TimeTool.AddMonth(startYear, YearBaseMonth, (i * TimeSpec.MonthsPerHalfyear) + month, out year, out yearMonth);
                    months.Add(new Month(year, yearMonth, Calendar));
                }
            }
            return(months);
        } // GetMonths
Example #4
0
        } // GetStartOfMonth

        // ----------------------------------------------------------------------
        private static TimeRange GetPeriodOf(ITimeCalendar calendar, int startYear, YearMonth startMonth, int monthCount)
        {
            if (monthCount < 1)
            {
                throw new ArgumentOutOfRangeException("monthCount");
            }

            DateTime start = GetStartOfMonth(calendar, startYear, startMonth);
            DateTime end;

            if (calendar.YearType == YearType.FiscalYear)
            {
                int       endYear;
                YearMonth endMonth;
                TimeTool.AddMonth(startYear, startMonth, monthCount, out endYear, out endMonth);
                end = GetStartOfMonth(calendar, endYear, endMonth);
            }
            else
            {
                end = start.AddMonths(monthCount);
            }
            return(new TimeRange(start, end));
        } // GetPeriodOf