Skip to content

Instantly share code, notes, and snippets.

Avatar

Martina Welander mhwelander

View GitHub Profile
View sphinx build results
c:\path\to\doc\root>make html > log.txt 2>&1
View contactshandler
public class Contacts : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
try
{
bool flag = false;
ID id;
// Get contact data from query string
View importcontacts
[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");
View update
[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 Aug 26, 2016
Identifies contact
View identify
[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 Aug 24, 2016
Flush session data without ending session.
View flushsession.cs
ContactManager contactManager = Sitecore.Configuration.Factory.CreateObject("tracking/contactManager", true) as ContactManager;
contactManager.FlushContactToXdb(contact);
contactManager.SaveAndReleaseContactToXdb(contact);
View xdbfacet.cs
using Sitecore.Analytics.Model.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace xDB.Workshop.Facets
{
/// <summary>
///
View modelbinder
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)
{