/// <summary> /// Gets the accounting period for a given date. /// </summary> /// <param name="date">The date to find the accounting period for.</param> /// <param name="periodStartDate">A date that an account period starts on.</param> /// <param name="periodLength">The length of accounting periods.</param> /// <returns>The period.</returns> public static Period CalculatePeriodForDate(DateTime date, DateTime periodStartDate, PeriodLength periodLength) { Period result = new Period(); DateTime lower = new DateTime(date.Year - 1, periodStartDate.Month, periodStartDate.Day). Date.AddMonths(-1 * ((int)periodLength)); DateTime upper = lower.AddMonths((int)periodLength).AddDays(-1).Date; while (date < lower || date > upper) { lower = upper.AddDays(1).Date; upper = lower.AddMonths((int)periodLength).AddDays(-1).Date; } result._startDate = lower.Date; result._length = periodLength; return result; }
public PeriodEventArgs(Period period) { _period = period; }
/// <summary> /// Constructor. /// </summary> /// <param name="period">The accounting period for this transaction scope.</param> public TransactionScope(Period period) : this(period.StartDate, period.EndDate) { }