Skip to content

Instantly share code, notes, and snippets.

View jstemerdink's full-sized avatar

Jeroen jstemerdink

View GitHub Profile
protected void Session_Start(object sender, EventArgs e)
{
this.UpdateViewedPagesSession();
this.UpdateViewedCategoriesSession();
}
protected void UpdateViewedPagesSession()
{
HttpCookie myCookie = null;
public void SendCartToQueue()
{
if (this._iMessagingService.MessagingEnabled && this._iMessagingService.SendMessage(this.CartHelper.Cart))
{
return;
}
this.CartHelper.Cart.SaveAsPurchaseOrder();
}
public List<PromotionalBanner> GetAllPromotionalBannersForMarket()
{
List<PromotionalBanner> promotionBanners = new List<PromotionalBanner>();
try
@using EPiServer
@using EPiServer.Commerce.Catalog.ContentTypes
@using EPiServer.Commerce.Marketing
@using EPiServer.Commerce.Marketing.Internal
@using EPiServer.Commerce.Marketing.Promotions
@using EPiServer.Framework.Localization
@using EPiServer.Reference.Commerce.Site.Features.Product.Models
@using EPiServer.Reference.Commerce.Site.Features.Product.Services
@using EPiServer.Reference.Commerce.Site.Features.Search.Models
@using EPiServer.Reference.Commerce.Site.Features.Search.Services
/// <summary>
/// Class PromotionExtensions.
/// </summary>
/// <author>Jeroen Stemerdink</author>
public static class PromotionExtensions
{
/// <summary>
/// The <see cref="ILogger" /> instance
/// </summary>
private static readonly ILogger Log = LogManager.GetLogger();
public class DummyController : Controller
{
public ActionResult Index()
{
// Create an empty Razor view called PartialRender.cshtml in views\shared
return this.PartialView("PartialRender");
}
}
using System.Linq;
using EPiServer.Commerce.Order;
using Mediachase.Commerce.Orders;
using Mediachase.Commerce.Workflow.Activities;
using Mediachase.Commerce.WorkflowCompatibility;
public class ExtendedValidateLineItemsActivity : ValidateLineItemsActivity
{
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FormContainerBlockControl.ascx.cs" Inherits="EPiServerWebForms.Views.Blocks.FormContainerBlockControl" %>
<%@ Import Namespace="EPiServerWebForms.Business.MvcHelpers" %>
<% MvcUtility.RenderPartial("FormsContentArea", this.FakeArea, this.FakeContext); %>
@jstemerdink
jstemerdink / Example.txt
Last active September 29, 2016 13:20
Use an attribute to create facets for an EPiServer Find query
[Facet(1, FacetType.TermsFacetFor)]
public virtual string TermsFacetExample { get; set; }
IClient searchManager = Client.CreateFromConfig();
ITypeSearch<StandardPage> queryTest = searchManager.Search<StandardPage>().For("test");
queryTest = queryTest.AddFacets();
IContentResult<StandardPage> results = queryTest.GetContentResult();
@jstemerdink
jstemerdink / CommentViewModel.cs
Created November 13, 2016 11:07
A validation controller that uses the Moderation API from Microsoft Cognitive services to validate content
public class CommentViewModel
{
/// <summary>Gets the body content of the comment.</summary>
[Remote("IsSafeTextContent", "ModeratorValidation")]
public virtual string Body { get; set; }
}