public override IKpiResult Evaluate(object sender, EventArgs e) { var result = new KpiConversionResult { HasConverted = false, KpiId = Id }; HttpContext current = HttpContext.Current; ContentEventArgs val = e as ContentEventArgs; if (current != null && val != null && TestContentGuid == val.Content.ContentGuid) { if (_visitorGroupRoleRepository.TryGetRole(SelectedVisitorGroup, out var role)) { result.HasConverted = role.IsMatch(current.User, new HttpContextWrapper(current)); } } return(result); }
public override IKpiResult Evaluate(object sender, EventArgs e) { // Used to evalauate if the user has converted // Note: this is called as a result of the event defined in EvaluateProxyEvent var result = new KpiConversionResult { HasConverted = false, KpiId = Id }; if (HttpContext.Current.User != null) { VisitorGroupRole role; if (_visitorGroupRoleRepository.TryGetRole(SelectedVisitorGroup, out role)) { // Check if the user has matched the selected visitor group result.HasConverted = role.IsMatch(PrincipalInfo.CurrentPrincipal, new HttpContextWrapper(HttpContext.Current)); } } return(result); }
public override IKpiResult Evaluate(object sender, EventArgs e) { var conversionResult = new KpiConversionResult() { KpiId = Id, HasConverted = false }; try { var formSubmission = (e as FormsSubmittedEventArgs); if (formSubmission != null) { conversionResult.HasConverted = formSubmission.FormsContent.ContentGuid == FormGuid; } } catch { // ignored } return(conversionResult); }