Skip to content

Instantly share code, notes, and snippets.

@davidknipe
davidknipe / InsightCommandLine.cs
Last active Oct 12, 2018
Example of using the Episerver Profile store API
View InsightCommandLine.cs
using Newtonsoft.Json.Linq;
using RestSharp;
namespace InsightClient
{
class Program
{
private static string deviceId = "<deviceid>"; // retrive from _madid cookie value
private static string apiRootUrl = "<apiRootUrl>"; // get from Insight / Profile store developer portal
private static string subscriptionKey = "<subscriptionKey>"; // get from Insight / Profile store developer portal
View TrackingExample.cs
using System.Web;
using EPiServer.Core;
using EPiServer.Tracking.Core;
namespace AlloyDemoKit.Business.Insight
{
public class TrackingExample
{
private readonly ITrackingService _trackingService;
private readonly HttpContextBase _httpContextBase;
@davidknipe
davidknipe / ReplacementTokenProperty.cs
Last active Mar 27, 2019
Tokenised Content in Episerver
View ReplacementTokenProperty.cs
using System.ComponentModel.DataAnnotations;
using EPiServer.Core;
using EPiServer.PlugIn;
namespace TokenisedContent.Features.TokenisedContent
{
[PropertyDefinitionTypePlugIn]
public class ReplacementTokenProperty : PropertyList<ReplacementToken> { }
public class ReplacementToken
@davidknipe
davidknipe / CampaignCouponFilter.cs
Last active Oct 28, 2017
Custom promotion to allow unique coupon codes created in Episerver Campaign to be used in Episerver Commerce discounts
View CampaignCouponFilter.cs
using System;
using System.Collections.Generic;
using System.Linq;
using Campaign.CouponServices.Interfaces;
using EPiServer.Commerce.Marketing;
using EPiServer.Reference.Commerce.Site.Features.CampaignCoupons.Discount;
using EPiServer.Security;
using Mediachase.Commerce.Security;
namespace EPiServer.Reference.Commerce.Site.Features.CampaignCoupons.CouponFilter
@davidknipe
davidknipe / ValidatingApprovalEngine.cs
Created Oct 8, 2017
Approval Engine that throws an exception if a user tries to approve their own content
View ValidatingApprovalEngine.cs
using EPiServer.Approvals;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using EPiServer.Framework;
using EPiServer.ServiceLocation;
using EPiServer.Framework.Initialization;
using EPiServer.Security;
namespace ApprovalSequences
@davidknipe
davidknipe / PreventSelfApprovalInit.cs
Last active Oct 7, 2017
Prevent users from starting an approval sequence where there are an approver in Episerver approval sequences
View PreventSelfApprovalInit.cs
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
using EPiServer.Core;
using EPiServer.Security;
using EPiServer.Approvals;
using EPiServer.Approvals.ContentApprovals;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using EPiServer.Cms.UI.AspNetIdentity;
@davidknipe
davidknipe / FilledInFormKpi.cs
Created Sep 1, 2017
A submitted form KPI for Episerver A/B testing
View FilledInFormKpi.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Runtime.Serialization;
using System.Text;
using EPiServer;
using EPiServer.Core;
using EPiServer.Forms.Core;
using EPiServer.Forms.Core.Events;
View LocaleAwarePhraseCriterion.cs
using EPiServer.Find.Framework.BestBets;
using EPiServer.Globalization;
using System;
using System.Globalization;
using System.Linq;
namespace BestBetExtension.Business.CustomPhraseCriterion
{
public class LocaleAwarePhraseCriterion : DefaultPhraseCriterion, IPhraseCriterion
{
View ReplacePhraseCriterionInit.cs
using EPiServer.ServiceLocation;
using EPiServer.Framework.Initialization;
using EPiServer.Find.Framework.BestBets;
using EPiServer.Framework;
namespace BestBetExtension.Business.CustomPhraseCriterion
{
[InitializableModule]
[ModuleDependency(typeof(ServiceContainerInitialization))]
[ModuleDependency(typeof(EPiServer.Find.Framework.FrameworkInitializationModule))]
@davidknipe
davidknipe / IMarketAccessRightsHelper.cs
Last active Jun 29, 2018
Set access rights to Episerver Commerce Markets for specific users
View IMarketAccessRightsHelper.cs
using Mediachase.Commerce;
namespace EPiServer.Reference.Commerce.Site.Features.MarketSecurity
{
public interface IMarketAccessRightsHelper
{
bool IsFilteredMarketsRequest();
bool UserHasAccessToMarket(IMarket market);
}
}
You can’t perform that action at this time.