public static void SetRestriction(IElementAEO element, CRestrictionUtilisateurSurType rest) { if (m_tableElementToRestriction.Count > 100) { m_tableElementToRestriction.Clear(); } CCacheRestriction cache = new CCacheRestriction(rest, element.CodesEntitesOrganisationnelles); m_tableElementToRestriction[element] = cache; }
public static CRestrictionUtilisateurSurType GetRestriction(IElementAEO element) { CCacheRestriction cache = m_tableElementToRestriction[element] as CCacheRestriction; if (cache != null && ((TimeSpan)(DateTime.Now - cache.DateValeur)).TotalSeconds <= c_nDureeVieSeconde && cache.CodesEO == element.CodesEntitesOrganisationnelles) { return(cache.Restriction); } return(null); }