/// <summary> /// Returns a list of string holding the alerts for the user /// </summary> /// <param name="userId"></param> /// <returns></returns> public static IList <string> UserAlertMessages(int userId) { UserAlertMessageViewCollection alerts = UserAlertMessageCache.GetUserAlerts(userId); if (alerts != null) { return(alerts.DisplayAlertMessages()); } else { return(null); } }
public static UserAlertMessageViewCollection GetUserAlerts(int userId) { string key = GetCacheKey(userId); CacheManager <string, UserAlertMessageViewCollection> cache = GetUserAlertMessageCache(); UserAlertMessageViewCollection alerts = cache[key]; if (alerts == null && userId != 0) { User user = User.FetchByID(userId); alerts = user.AlertMessages(); cache.Insert(key, alerts, CacheHelper.CACHE_DURATION_IN_SECONDS); } return(alerts); }