private static BannedIpNetworkCollection DBMapping(DBBannedIpNetworkCollection dbCollection) { if (dbCollection == null) { return(null); } var ipCollection = new BannedIpNetworkCollection(); foreach (var dbItem in dbCollection) { var item = DBMapping(dbItem); ipCollection.Add(item); } return(ipCollection); }
/// <summary> /// Gets all IP networks /// </summary> /// <returns>IP network collection</returns> public override DBBannedIpNetworkCollection GetIpNetworkAll() { DBBannedIpNetworkCollection ipCollection = new DBBannedIpNetworkCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_BannedIpNetworkLoadAll"); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { DBBannedIpNetwork ipNetwork = GetIpNetworkFromReader(dataReader); ipCollection.Add(ipNetwork); } } return(ipCollection); }
/// <summary> /// Gets all IP networks /// </summary> /// <returns>IP network collection</returns> public static BannedIpNetworkCollection GetBannedIpNetworkAll() { string key = BLACKLIST_ALLNETWORK_KEY; object obj2 = NopCache.Get(key); if (IpBlacklistManager.CacheEnabled && (obj2 != null)) { return((BannedIpNetworkCollection)obj2); } DBBannedIpNetworkCollection dbCollection = DBProviderManager <DBBlacklistProvider> .Provider.GetIpNetworkAll(); BannedIpNetworkCollection collection = DBMapping(dbCollection); if (IpBlacklistManager.CacheEnabled) { NopCache.Max(key, collection); } return(collection); }