private IMultiVariateTestStrategy GetStrategy(Item multiVariateTest) { Assert.ArgumentNotNull(multiVariateTest, "multiVariateTest"); string str = multiVariateTest["Test Strategy"]; if (string.IsNullOrEmpty(str)) { return(this); } Item item = multiVariateTest.Database.GetItem(str); if (item == null) { Log.Error("Multivariate Test Strategy with id {0} not found. Using Random strategy instead.".FormatWith(new object[] { str }), base.GetType()); return(this); } if (!ItemScripts.HasScript(item)) { return(this); } var strategy = ItemScripts.CreateObject(item) as IMultiVariateTestStrategy; if (strategy == null) { Log.Error("Multivariate Test Strategy with id {0} is invalid (returns null). Using Random strategy instead.".FormatWith(new object[] { str }), base.GetType()); strategy = this; } return(strategy); }
public virtual IRuleMacro GetMacro(Type type) { var macroItem = Sitecore.Client.ContentDatabase.GetItem(RuleIds.MacrosesFolder).Axes.SelectSingleItem(this.MacroName); if (macroItem == null) { return(null); } var macro = ItemScripts.CreateObject(macroItem) as IRuleMacro; return(macro); }