示例#1
0
        }         // GetNextQuarter

        // ----------------------------------------------------------------------
        public Quarter AddQuarters(int count)
        {
            int         year;
            YearQuarter quarter;

            TimeTool.AddQuarter(BaseYear, StartQuarter, count, out year, out quarter);
            return(new Quarter(year, quarter, Calendar));
        }         // AddQuarters
示例#2
0
        }         // QuarterTimeRange

        // ----------------------------------------------------------------------
        protected QuarterTimeRange(int startYear, YearQuarter startQuarter, int quarterCount, ITimeCalendar calendar) :
            base(GetPeriodOf(calendar, startYear, startQuarter, quarterCount), calendar)
        {
            this.startYear    = startYear;
            this.startQuarter = startQuarter;
            this.quarterCount = quarterCount;
            TimeTool.AddQuarter(startYear, startQuarter, quarterCount - 1, out endYear, out endQuarter);
        }         // QuarterTimeRange
示例#3
0
        }         // Quarters

        // ----------------------------------------------------------------------
        public ITimePeriodCollection GetQuarters()
        {
            TimePeriodCollection quarters = new TimePeriodCollection();

            for (int i = 0; i < QuarterCount; i++)
            {
                int         year;
                YearQuarter quarter;
                TimeTool.AddQuarter(BaseYear, StartQuarter, i, out year, out quarter);
                quarters.Add(new Quarter(year, quarter, Calendar));
            }
            return(quarters);
        }         // GetQuarters
示例#4
0
        }         // GetStartOfQuarter

        // ----------------------------------------------------------------------
        private static TimeRange GetPeriodOf(ITimeCalendar calendar, int startYear, YearQuarter startQuarter, int quarterCount)
        {
            if (quarterCount < 1)
            {
                throw new ArgumentOutOfRangeException("quarterCount");
            }

            DateTime    start = GetStartOfQuarter(calendar, startYear, startQuarter);
            int         endYear;
            YearQuarter endQuarter;

            TimeTool.AddQuarter(startYear, startQuarter, quarterCount, out endYear, out endQuarter);
            DateTime end = GetStartOfQuarter(calendar, endYear, endQuarter);

            return(new TimeRange(start, end));
        }         // GetPeriodOf
示例#5
0
        }         // GetHalfyears

        // ----------------------------------------------------------------------
        public ITimePeriodCollection GetQuarters()
        {
            TimePeriodCollection quarters = new TimePeriodCollection();

            for (int i = 0; i < yearCount; i++)
            {
                for (int quarter = 0; quarter < TimeSpec.QuartersPerYear; quarter++)
                {
                    int         year;
                    YearQuarter yearQuarter;
                    TimeTool.AddQuarter(startYear, YearQuarter.First, (i * TimeSpec.QuartersPerYear) + quarter, out year, out yearQuarter);
                    quarters.Add(new Quarter(year, yearQuarter, Calendar));
                }
            }
            return(quarters);
        }         // GetQuarters