} // Clear // ---------------------------------------------------------------------- private void SelectPeriod(PeriodSelectType periodSelectType) { int offset = 0; switch (periodSelectType) { case PeriodSelectType.Previous: offset = -1; break; case PeriodSelectType.Current: ResetWorkingPeriod(); return; case PeriodSelectType.Next: offset = 1; break; } switch (WorkingTimePeriod) { case TimePeriodMode.Year: Year year = new Year(WorkingPeriodStartDate); SetWorkingPeriod(year.AddYears(offset)); break; case TimePeriodMode.Halfyear: Halfyear halfyear = new Halfyear(WorkingPeriodStartDate); SetWorkingPeriod(halfyear.AddHalfyears(offset)); break; case TimePeriodMode.Quarter: Quarter quarter = new Quarter(WorkingPeriodStartDate); SetWorkingPeriod(quarter.AddQuarters(offset)); break; case TimePeriodMode.Month: Month month = new Month(WorkingPeriodStartDate); SetWorkingPeriod(month.AddMonths(offset)); break; case TimePeriodMode.Week: Week week = new Week(WorkingPeriodStartDate); SetWorkingPeriod(week.AddWeeks(offset)); break; case TimePeriodMode.Day: Day day = new Day(WorkingPeriodStartDate); SetWorkingPeriod(day.AddDays(offset)); break; } } // SelectPeriod
// ---------------------------------------------------------------------- private void SelectPeriod( PeriodSelectType periodSelectType ) { int offset = 0; switch ( periodSelectType ) { case PeriodSelectType.Previous: offset = -1; break; case PeriodSelectType.Current: ResetWorkingPeriod(); return; case PeriodSelectType.Next: offset = 1; break; } switch ( WorkingTimePeriod ) { case TimePeriodMode.Year: Year year = new Year( WorkingPeriodStartDate ); SetWorkingPeriod( year.AddYears( offset ) ); break; case TimePeriodMode.Halfyear: Halfyear halfyear = new Halfyear( WorkingPeriodStartDate ); SetWorkingPeriod( halfyear.AddHalfyears( offset ) ); break; case TimePeriodMode.Quarter: Quarter quarter = new Quarter( WorkingPeriodStartDate ); SetWorkingPeriod( quarter.AddQuarters( offset ) ); break; case TimePeriodMode.Month: Month month = new Month( WorkingPeriodStartDate ); SetWorkingPeriod( month.AddMonths( offset ) ); break; case TimePeriodMode.Week: Week week = new Week( WorkingPeriodStartDate ); SetWorkingPeriod( week.AddWeeks( offset ) ); break; case TimePeriodMode.Day: Day day = new Day( WorkingPeriodStartDate ); SetWorkingPeriod( day.AddDays( offset ) ); break; } }