/// <summary> /// Get all period objects. /// </summary> /// <returns>All periods.</returns> public static PeriodList GetPeriods() { PeriodList periods = null; for (Int32 getAttempts = 0; (periods.IsNull()) && (getAttempts < 3); getAttempts++) { LoadPeriods(); periods = Periods; } return(periods); }
/// <summary> /// Get all period objects of a sertain period type. /// </summary> /// <param name="periodTypeId">Id enum of the period type.</param> /// <returns>All periods of the requested type.</returns> public static PeriodList GetPeriods(PeriodTypeId periodTypeId) { PeriodList periods = new PeriodList(); for (Int32 getAttempts = 0; (periods.IsNull()) && (getAttempts < 3); getAttempts++) { LoadPeriods(); } foreach (Period period in Periods) { if (period.PeriodType.Id == (Int32)periodTypeId) { periods.Add(period); } } return(periods); }