/// <summary> /// Get all period type objects. /// </summary> /// <returns>All period types.</returns> public static PeriodTypeList GetPeriodTypes() { PeriodTypeList periodTypes = null; for (Int32 getAttempts = 0; (periodTypes.IsNull()) && (getAttempts < 3); getAttempts++) { LoadPeriodTypes(); periodTypes = PeriodTypes; } return(periodTypes); }
/// <summary> /// Get period types from web service. /// </summary> private static void LoadPeriodTypes() { PeriodTypeList periodTypes; if (PeriodTypes.IsNull()) { // Get data from web service. periodTypes = new PeriodTypeList(); foreach (WebPeriodType webPeriodType in WebServiceClient.GetPeriodTypes()) { periodTypes.Add(new PeriodType(webPeriodType.Id, webPeriodType.Name, webPeriodType.Description)); } PeriodTypes = periodTypes; } }