Beispiel #1
0
        }         // GetDaysInMonth

        // ----------------------------------------------------------------------
        public int GetYear(int year, int month)
        {
            if (YearType == YearType.FiscalYear)
            {
                year = FiscalCalendarTool.GetYear(year, (YearMonth)month, YearBaseMonth, FiscalYearBaseMonth);
            }
            return(year);
        }         // GetYear
        } // ComputeHashCode

        // ----------------------------------------------------------------------
        private static DateTime GetStartOfMonth(ITimeCalendar calendar, int year, YearMonth month)
        {
            DateTime startOfMonth;

            if (calendar.YearType == YearType.FiscalYear)
            {
                startOfMonth = FiscalCalendarTool.GetStartOfMonth(
                    year, month, calendar.YearBaseMonth, calendar.FiscalFirstDayOfYear, calendar.FiscalYearAlignment, calendar.FiscalQuarterGrouping);
            }
            else
            {
                startOfMonth = new DateTime(year, (int)month, 1);
            }
            return(startOfMonth);
        } // GetStartOfMonth
Beispiel #3
0
        } // ComputeHashCode

        // ----------------------------------------------------------------------
        private static DateTime GetStartOfYear(ITimeCalendar calendar, int year)
        {
            DateTime startOfYear;

            switch (calendar.YearType)
            {
            case YearType.FiscalYear:
                startOfYear = FiscalCalendarTool.GetStartOfYear(year, calendar.YearBaseMonth,
                                                                calendar.FiscalFirstDayOfYear, calendar.FiscalYearAlignment);
                break;

            default:
                startOfYear = new DateTime(year, (int)calendar.YearBaseMonth, 1);
                break;
            }
            return(startOfYear);
        } // GetStartOfYear
Beispiel #4
0
        }         // ComputeHashCode

        // ----------------------------------------------------------------------
        private static DateTime GetStartOfHalfyear(ITimeCalendar calendar, int year, YearHalfyear halfyear)
        {
            DateTime startOfHalfyear;

            switch (calendar.YearType)
            {
            case YearType.FiscalYear:
                startOfHalfyear = FiscalCalendarTool.GetStartOfHalfyear(year, halfyear,
                                                                        calendar.YearBaseMonth, calendar.FiscalFirstDayOfYear, calendar.FiscalYearAlignment);
                break;

            default:
                DateTime yearStart = new DateTime(year, (int)calendar.YearBaseMonth, 1);
                startOfHalfyear = yearStart.AddMonths(((int)halfyear - 1) * TimeSpec.MonthsPerHalfyear);
                break;
            }
            return(startOfHalfyear);
        }         // GetStartOfHalfyear