本文整理汇总了C#中System.Item.IsInboundRuleItem方法的典型用法代码示例。如果您正苦于以下问题:C# Item.IsInboundRuleItem方法的具体用法?C# Item.IsInboundRuleItem怎么用?C# Item.IsInboundRuleItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Item
的用法示例。
在下文中一共展示了Item.IsInboundRuleItem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddRule
private void AddRule(Item item, Item redirectFolderItem, List<IBaseRule> inboundRules)
{
IBaseRule newRule = null;
Log.Debug(this, item.Database, "Adding Rule - item: [{0}]", item.Paths.FullPath);
if (item.IsInboundRuleItem())
{
newRule = CreateInboundRuleFromInboundRuleItem(item, redirectFolderItem);
}
else if (item.IsSimpleRedirectItem())
{
newRule = CreateInboundRuleFromSimpleRedirectItem(item, redirectFolderItem);
}
else if (item.IsOutboundRuleItem())
{
newRule = CreateOutboundRuleFromOutboundRuleItem(item, redirectFolderItem);
}
if (newRule != null)
{
AddOrRemoveRule(item, redirectFolderItem, inboundRules, newRule);
}
}
示例2: UpdateRulesCache
private void UpdateRulesCache(Item item, Item redirectFolderItem, Action<Item, Item, List<IBaseRule>> action)
{
var cache = GetRulesCache();
IEnumerable<IBaseRule> baseRules = null;
if (item.IsSimpleRedirectItem() || item.IsInboundRuleItem())
{
baseRules = cache.GetInboundRules();
if (baseRules == null)
{
baseRules = GetInboundRules();
}
}
else if (item.IsOutboundRuleItem())
{
baseRules = cache.GetOutboundRules();
if (baseRules == null)
{
baseRules = GetOutboundRules();
}
}
if (baseRules != null)
{
var rules = baseRules.ToList();
action(item, redirectFolderItem, rules);
Log.Debug(this, item.Database, "Updating Rules Cache - count: {0}", rules.Count());
// update the cache
if (item.IsSimpleRedirectItem() || item.IsInboundRuleItem())
{
cache.SetInboundRules(rules.OfType<InboundRule>());
}
else if (item.IsOutboundRuleItem())
{
cache.SetOutboundRules(rules.OfType<OutboundRule>());
}
}
}
示例3: RunItemDeleted
private void RunItemDeleted(Item item)
{
var rulesEngine = new RulesEngine(item.Database);
try
{
using (new SecurityDisabler())
{
if (item.IsInboundRuleItem() || item.IsSimpleRedirectItem() || item.IsInboundRuleItemChild())
{
Log.Info(this, item.Database, "Refreshing inbound rules cache after delete event",
item.Paths.FullPath);
rulesEngine.GetCachedInboundRules();
}
else if (item.IsOutboundRuleItem() || item.IsOutboundRuleItemChild())
{
Log.Info(this, item.Database, "Refreshing outbound rules cache after delete event",
item.Parent.Paths.FullPath);
rulesEngine.GetCachedOutboundRules();
}
}
}
catch (Exception ex)
{
Log.Error(this, ex, item.Database, "Exception occured which deleting item after publish Item ID: {0} Item Path: {1}", item.ID, item.Paths.FullPath);
}
}
示例4: RunItemSaved
private void RunItemSaved(Item item, ItemChanges itemChanges)
{
var db = item.Database;
var rulesEngine = new RulesEngine(db);
try
{
using (new SecurityDisabler())
{
var redirectFolderItem = item.Axes.GetAncestors()
.FirstOrDefault(a => a.TemplateID.Equals(new ID(RedirectFolderItem.TemplateId)));
if (redirectFolderItem == null) return;
if (item.IsRedirectFolderItem())
{
Log.Info(this, db, "Refreshing Redirect Folder [{0}] after save event", item.Paths.FullPath);
rulesEngine.GetCachedInboundRules();
}
else if (item.IsOutboundRuleItem())
{
Log.Info(this, db, "Refreshing Outbound Rule [{0}] after save event", item.Paths.FullPath);
rulesEngine.RefreshRule(item, redirectFolderItem);
}
else if (item.IsSimpleRedirectItem())
{
Log.Info(this, db, "Refreshing Simple Redirect [{0}] after save event", item.Paths.FullPath);
rulesEngine.RefreshRule(item, redirectFolderItem);
}
else if (item.IsInboundRuleItem())
{
Log.Info(this, db, "Refreshing Inbound Rule [{0}] after save event", item.Paths.FullPath);
rulesEngine.RefreshRule(item, redirectFolderItem);
}
else if (item.IsRedirectType() && item.IsInboundRuleItemChild() && db.Name.Equals("master", StringComparison.CurrentCultureIgnoreCase))
{
var inboundRuleItem = item.Parent;
var inboundRule = new InboundRuleItem(inboundRuleItem);
inboundRule.BeginEdit();
inboundRule.Action.InnerField.SetValue(item.ID.ToString(), false);
inboundRule.EndEdit();
}
else if (item.IsInboundRuleItemChild())
{
Log.Info(this, db, "Refreshing Inbound Rule [{0}] after save event", item.Parent.Paths.FullPath);
rulesEngine.RefreshRule(item.Parent, redirectFolderItem);
}
else if (item.IsOutboundRuleItemChild())
{
Log.Info(this, db, "Refreshing Outbound Rule [{0}] after save event", item.Parent.Paths.FullPath);
rulesEngine.RefreshRule(item.Parent, redirectFolderItem);
}
}
}
catch (Exception ex)
{
Log.Error(this, ex, db, "Exception occured when saving item after save - Item ID: {0} Item Path: {1}", item.ID, item.Paths.FullPath);
}
}
示例5: RunItemDeleted
private void RunItemDeleted(Item item)
{
var rulesEngine = new RulesEngine(item.Database);
try
{
using (new SecurityDisabler())
{
var redirectFolderItem = item.Axes.GetAncestors()
.FirstOrDefault(a => a.TemplateID.Equals(new ID(RedirectFolderItem.TemplateId)));
if (redirectFolderItem != null)
{
if (item.IsInboundRuleItem() || item.IsSimpleRedirectItem() || item.IsOutboundRuleItem())
{
Log.Info(this, item.Database, "Removing Rule [{0}] after delete event",
item.Paths.FullPath);
rulesEngine.DeleteRule(item, redirectFolderItem);
}
else if (item.IsInboundRuleItemChild() || item.IsOutboundRuleItemChild())
{
Log.Info(this, item.Database, "Removing Rule [{0}] after delete event",
item.Parent.Paths.FullPath);
rulesEngine.RefreshRule(item.Parent, redirectFolderItem);
}
}
}
}
catch (Exception ex)
{
Log.Error(this, ex, item.Database, "Exception occured which deleting item after publish Item ID: {0} Item Path: {1}", item.ID, item.Paths.FullPath);
}
}