示例#1
0
        /// <summary>
        /// Moves the period backwards in time according to the type set. If Type == PeriodType.Year, the start and end is moved -1 year.
        /// </summary>
        public void Subtract()
        {
            switch (Type)
            {
            case PeriodType.Year:
                Start = Start.AddYears(-1);
                End   = End.AddYears(-1);
                break;

            case PeriodType.Halfyear:
                Start = Start.AddMonths(-6);
                End   = End.AddMonths(-6);
                break;

            case PeriodType.Month:
                Start = Start.AddMonths(-1);
                End   = End.AddMonths(-1);
                break;

            default:
                break;
            }
        }
示例#2
0
 public void YearForward()
 {
     Start  = Start.AddYears(1);
     Finish = Finish.AddYears(1);
 }
示例#3
0
 public void YearBack()
 {
     Start  = Start.AddYears(-1);
     Finish = Finish.AddYears(-1);
 }
示例#4
0
 public DateTimeRange SpreadByYears(int yearsStart, int yearsEnd)
 {
     return(new DateTimeRange(
                start: Start.AddYears(-yearsStart),
                end: End.AddYears(yearsEnd)));
 }