/// <summary> /// AddSIMPLLoginTrackerRecordToCache method /// </summary> /// <param name="userName"></param> /// <param name="myLoginTracker"></param> /// <returns></returns> public static bool AddSIMPLLoginTrackerRecordToCache(string userName, SIMPLLoginTracker myLoginTracker) { if (string.IsNullOrWhiteSpace(userName)) { throw new ArgumentException("Parameter is null or whitespace", "userName"); } GuardsForSIMPLLoginTracker(myLoginTracker); // not catching or logging here, assume caller will log AddToOrUpdateCache(GetCacheKey(userName), myLoginTracker, TypesCacheExpirationTimeInSeconds); return true; }
/// <summary> /// GuardsForSIMPLLoginTracker method checks the various members of a SIMPLLoginTracker object to see if it is a null / default new object /// </summary> /// <param name="myLoginTracker"></param> internal static void GuardsForSIMPLLoginTracker(SIMPLLoginTracker myLoginTracker) { if (myLoginTracker == null) { throw new ArgumentNullException("myLoginTracker", "Parameter is null"); } if (string.IsNullOrWhiteSpace(myLoginTracker.ASPNETSessionId)) { throw new ArgumentException("Parameter is null or whitespace, specifically ASPNETSessionId", "myLoginTracker"); } if (myLoginTracker.SIMPLLoginTimeUtc == null) { throw new ArgumentNullException("myLoginTracker", "Parameter is null, specifically SIMPLLoginTimeUtc"); } if (myLoginTracker.SIMPLLoginTimeUtc == DateTimeOffset.MinValue) { throw new ArgumentException("Parameter is invalid, specifically SIMPLLoginTimeUtc", "myLoginTracker"); } if (myLoginTracker.SIMPLLoginTrackerId == 0) { throw new ArgumentException("Parameter is invalid, specifically SIMPLLoginTrackerId", "myLoginTracker"); } if (string.IsNullOrWhiteSpace(myLoginTracker.SIMPLUsername)) { throw new ArgumentException("Parameter is null or whitespace, specifically SIMPLUsername", "myLoginTracker"); } }