public override void InteractionBody() { if (XConnectContact != null) { var interaction = new Interaction(IdentifiedContactReference, InteractionInitiator.Contact, CollectionConst.XConnect.Channels.ConcessionStand, string.Empty); var facetHelper = new FacetEditHelper(XConnectFacets); var cinemaInfoFacet = facetHelper.SafeGetFacet <CinemaInfo>(CollectionConst.FacetKeys.CinemaInfo); if (cinemaInfoFacet != null) { Client.SetFacet(IdentifiedContactReference, CinemaInfo.DefaultFacetKey, cinemaInfoFacet); } var visitorInfoFacet = facetHelper.SafeGetFacet <CinemaVisitorInfo>(CollectionConst.FacetKeys.CinemaVisitorInfo); if (visitorInfoFacet != null) { Client.SetFacet(IdentifiedContactReference, CollectionConst.FacetKeys.CinemaVisitorInfo, visitorInfoFacet); } var eventItem = new BuyConcessionOutcome(DateTime.UtcNow, CollectionConst.SitecoreCinema.CurrencyCode, CollectionConst.SitecoreCinema.ConcessionPrices.PopCorn); interaction.Events.Add(eventItem); Client.AddInteraction(interaction); } else { Sitecore.Diagnostics.Log.Error("Contact was null", this); } }
public override void InteractionBody() { if (XConnectContact != null) { var productItem = new ConcessionItemProxy(ProductItemGuid); var priceItem = new ConcessionPriceItemProxy(PriceItemGuid); if (productItem != null && priceItem != null) { decimal?priceValue = priceItem.CostField.DecimalValue; if (priceValue != null) { var interaction = new Interaction(XConnectContact, InteractionInitiator.Contact, CollectionConst.XConnect.Channels.ConcessionStand, string.Empty); Client.SetFacet(interaction, CinemaInfo.DefaultFacetKey, new CinemaInfo() { CinimaId = CollectionConst.XConnect.CinemaId.Theater22 }); var eventItem = new BuyConcessionOutcome(DateTime.UtcNow, CollectionConst.SitecoreCinema.CurrencyCode, (decimal)priceValue); interaction.Events.Add(eventItem); Client.AddInteraction(interaction); } else { Sitecore.Diagnostics.Log.Error(ProjectConst.Logging.prefix + "Price value was null", this); } } else { Sitecore.Diagnostics.Log.Error(ProjectConst.Logging.prefix + "ProductItem or PriceItem was null", this); } } else { Sitecore.Diagnostics.Log.Error("Contact was null", this); } }