예제 #1
0
        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;
        }
예제 #2
0
 public virtual void Update(Models.Site site, ABSiteSetting @new, ABSiteSetting old)
 {
     _provider.Update(@new, old);
 }
예제 #3
0
 public void Add(Site site, ABSiteSetting item)
 {
     _provider.Add(item);
 }
예제 #4
0
 public void Remove(Site site, ABSiteSetting item)
 {
     _provider.Remove(item);
 }