public virtual Site MatchRule(Site site, HttpContextBase httpContext, out ABSiteSetting abSiteSetting) { var matchedSite = site; var ruleName = site.FullName; var visitRule = abSiteSetting = Get(ruleName); if (visitRule != null) { ABSiteRuleItem matchedRuleItem = null; var ruleSetting = new ABRuleSetting(null, visitRule.RuleName).AsActual(); if (ruleSetting != null && ruleSetting.RuleItems != null) { foreach (var item in visitRule.Items) { var ruleItem = ruleSetting.RuleItems.Where(it => it.Name.EqualsOrNullEmpty(item.RuleItemName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); if (ruleItem.IsMatch(httpContext.Request)) { if (!string.IsNullOrEmpty(item.SiteName)) { var ruleSite = new Site(item.SiteName).AsActual(); if (ruleSite != null) { matchedSite = ruleSite; matchedRuleItem = item; break; } } } } OnRuleMatch(new SiteMatchedContext() { HttpContext = httpContext, RawSite = site, MatchedSite = matchedSite, SiteVisitRule = visitRule, MatchedRuleItem = matchedRuleItem }); } } return matchedSite; }
public virtual void Update(Models.Site site, ABSiteSetting @new, ABSiteSetting old) { _provider.Update(@new, old); }
public void Add(Site site, ABSiteSetting item) { _provider.Add(item); }
public void Remove(Site site, ABSiteSetting item) { _provider.Remove(item); }