Example #1
0
 public int GetYear(int year, int month)
 {
     if (YearType == YearType.FiscalYear)
     {
         year = FiscalCalendarTool.GetYear(year, (YearMonth)month, YearBaseMonth, FiscalYearBaseMonth);
     }
     return(year);
 }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        private static DateTime GetStartOfQuarter(ITimeCalendar calendar, int year, YearQuarter quarter)
        {
            DateTime startOfQuarter;

            switch (calendar.YearType)
            {
            case YearType.FiscalYear:
                startOfQuarter = FiscalCalendarTool.GetStartOfQuarter(year, quarter,
                                                                      calendar.YearBaseMonth, calendar.FiscalFirstDayOfYear, calendar.FiscalYearAlignment);
                break;

            default:
                DateTime yearStart = new DateTime(year, (int)calendar.YearBaseMonth, 1);
                startOfQuarter = yearStart.AddMonths(((int)quarter - 1) * TimeSpec.MonthsPerQuarter);
                break;
            }
            return(startOfQuarter);
        }