Created
September 25, 2014 07:45
-
-
Save ivanbuzyka/7f9e9818fdac48332ac9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Sitecore.TestProject.Analytics.Data.Filters | |
{ | |
using Sitecore.Analytics; | |
using Sitecore.Analytics.Data.Filters.Filters; | |
using Sitecore.Diagnostics; | |
/// <summary> | |
/// WherePageEventTextLike: filter class | |
/// </summary> | |
public class WherePageEventTextLike : FilterBase | |
{ | |
/// <summary> | |
/// Gets or sets Text. | |
/// </summary> | |
public string Text { get; set; } | |
/// <summary> | |
/// ApplyFilter: method for applying filter | |
/// </summary> | |
/// <param name="sqlCommand" /> /// The sql command. | |
public override void ApplyFilter(Sitecore.Analytics.Data.Filters.SqlCommand sqlCommand) | |
{ | |
Assert.ArgumentNotNull(sqlCommand, "sqlCommand"); | |
sqlCommand.AddWhereClause("Browser", AnalyticsManager.FormatCommandText("{0}PageEvent{1}.{0}Text{1}") + " LIKE '" + string.Format("%{0}%", EscapeQuote(Text)) + "'", this.Except); | |
} | |
/// <summary> | |
/// IsApplicable: method checks whether the filter is applicable | |
/// </summary> | |
/// <param name="sqlCommand" /> /// The sql command. | |
/// <returns> | |
/// Bool value | |
/// </returns> | |
public override bool IsApplicable(Sitecore.Analytics.Data.Filters.SqlCommand sqlCommand) | |
{ | |
Assert.ArgumentNotNull(sqlCommand, "sqlCommand"); | |
// We are using "Browser" placeholder for our filter | |
return sqlCommand.HasPlaceholder("Browser"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment