Skip to content

Instantly share code, notes, and snippets.

View mhwelander's full-sized avatar

Martina Welander mhwelander

View GitHub Profile
c:\path\to\doc\root>make html > log.txt 2>&1
public class Contacts : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
try
{
bool flag = false;
ID id;
// Get contact data from query string
[HttpPost]
public ActionResult ImportContacts()
{
// For the purposes of this example, the dictionary key represents the contact identifier
// and the value represents their first name
var contacts = new Dictionary<string, string>();
contacts.Add("martina_welander", "Martina");
contacts.Add("bob_mcbob", "Bob");
[HttpPost]
public ActionResult SubmitForm(string jobRole)
{
if (Tracker.Current != null &&
Tracker.IsActive == true &&
Tracker.Current.Contact != null)
{
var personalFacet = Tracker.Current.Contact.GetFacet<IContactPersonalInfo>("Personal");
personalFacet.JobTitle = jobRole;
@mhwelander
mhwelander / identify
Last active August 26, 2016 12:03
Identifies contact
[HttpPost]
public ActionResult LoginUser(string username)
{
if (Tracker.Current != null &&
Tracker.IsActive == true)
{
Tracker.Current.Session.Identify(username);
}
// The user is also logged in using normal ASP.NET membership; this is a completely separate process from identifying
@mhwelander
mhwelander / flushsession.cs
Created August 24, 2016 16:21
Flush session data without ending session.
ContactManager contactManager = Sitecore.Configuration.Factory.CreateObject("tracking/contactManager", true) as ContactManager;
contactManager.FlushContactToXdb(contact);
contactManager.SaveAndReleaseContactToXdb(contact);
@mhwelander
mhwelander / xdbfacet.cs
Last active August 23, 2016 10:58
xDB facet
using Sitecore.Analytics.Model.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace xDB.Workshop.Facets
{
/// <summary>
///
namespace TC.ServicesPortal.ModelBinders
{
public class InterfaceModelBinder : DefaultModelBinder
{
protected override object CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType)
{
var type = bindingContext.ModelType;
if (type.IsInterface)
{