/// <summary> /// Checks a level for the action. /// </summary> /// <param name="context">The context.</param> /// <param name="levelToCheck">The level to check.</param> /// <param name="actionName">Name of the action.</param> /// <param name="clearProperty">The clear property.</param> /// <returns> /// <c>true</c> if the level was matched; <c>false</c> otherwise. /// </returns> private static bool CheckLevelForAction(ActionRequestContext context, ActionHandlerTargets levelToCheck, string actionName, Action clearProperty) { context.Level = levelToCheck; var reportLevel = Manager.Current.ReportLevels.FirstOrDefault(level => level.Target == levelToCheck) ?? new ReportLevel(); if (actionName == null) { RetrieveDefaultAction(context, reportLevel); return(true); } var action = reportLevel .Reports .FirstOrDefault( rep => string.Equals(rep.ActionName, actionName, StringComparison.InvariantCultureIgnoreCase)); if (action != null) { context.Report = actionName; clearProperty(); return(true); } return(false); }
private void AppendReportLevel(ActionHandlerTargets level, params Report[] reports) { var reportLevel = new ReportLevel { Target = level }; foreach (var report in reports) { reportLevel.Reports.Add(report); } Manager.Current.ReportLevels.Add(reportLevel); }
/// <summary> /// Checks a level for the action. /// </summary> /// <param name="context">The context.</param> /// <param name="levelToCheck">The level to check.</param> /// <param name="actionName">Name of the action.</param> /// <param name="clearProperty">The clear property.</param> /// <returns> /// <c>true</c> if the level was matched; <c>false</c> otherwise. /// </returns> private static bool CheckLevelForAction(ActionRequestContext context, ActionHandlerTargets levelToCheck, string actionName, Action clearProperty) { context.Level = levelToCheck; var reportLevel = Manager.Current.ReportLevels.FirstOrDefault(level => level.Target == levelToCheck) ?? new ReportLevel(); if (actionName == null) { RetrieveDefaultAction(context, reportLevel); return true; } var action = reportLevel .Reports .FirstOrDefault( rep => string.Equals(rep.ActionName, actionName, StringComparison.InvariantCultureIgnoreCase)); if (action != null) { context.Report = actionName; clearProperty(); return true; } return false; }
private void AppendReportLevel(ActionHandlerTargets level, params Report[] reports) { var reportLevel = new ReportLevel {Target = level}; foreach (var report in reports) { reportLevel.Reports.Add(report); } Manager.Current.ReportLevels.Add(reportLevel); }
/// <summary> /// Initializes a new instance of the <see cref="ActionHandlerAttribute"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="targets">The targets.</param> public ActionHandlerAttribute(string name, ActionHandlerTargets targets) { this.Name = name; this.Targets = targets; }