diff --git a/src/TrainingGuides.Web/Features/Personalization/IsInContactGroupConditionType.cs b/src/TrainingGuides.Web/Features/Personalization/IsInContactGroupConditionType.cs index 8dbe55e2..ce36bb90 100644 --- a/src/TrainingGuides.Web/Features/Personalization/IsInContactGroupConditionType.cs +++ b/src/TrainingGuides.Web/Features/Personalization/IsInContactGroupConditionType.cs @@ -1,5 +1,3 @@ -using System.Collections.Generic; - using CMS.ContactManagement; using CMS.DataEngine; @@ -10,10 +8,10 @@ using Kentico.Xperience.Admin.Base.Forms; [assembly: RegisterPersonalizationConditionType( - "TrainingGuides.Web.Features.Personalization", - typeof(IsInContactGroupConditionType), - "Is in contact group", - Description = "Evaluates if the current contact is in one of the contact groups.", IconClass = "icon-app-contact-groups", Hint = "Display to visitors who match at least one of the selected contact groups:")] + "TrainingGuides.Web.Features.Personalization", + typeof(IsInContactGroupConditionType), + "Is in contact group", + Description = "Evaluates if the current contact is in one of the contact groups.", IconClass = "icon-app-contact-groups", Hint = "Display to visitors who match at least one of the selected contact groups:")] namespace TrainingGuides.Web.Features.Personalization; @@ -22,35 +20,35 @@ namespace TrainingGuides.Web.Features.Personalization; /// public class IsInContactGroupConditionType : ConditionType { - /// - /// Selected contact group code names. - /// - [ObjectSelectorComponent(PredefinedObjectType.CONTACTGROUP, + /// + /// Selected contact group code names. + /// + [ObjectSelectorComponent(PredefinedObjectType.CONTACTGROUP, Label = "Contact groups", Order = 0, MaximumItems = 0)] - public IEnumerable SelectedContactGroups { get; set; } = Enumerable.Empty(); + public IEnumerable SelectedContactGroups { get; set; } = Enumerable.Empty(); - /// - /// Evaluate condition type. - /// - /// Returns true if implemented condition is met. - public override bool Evaluate() - { - var contact = ContactManagementContext.GetCurrentContact(); + /// + /// Evaluate condition type. + /// + /// Returns true if implemented condition is met. + public override bool Evaluate() + { + var contact = ContactManagementContext.GetCurrentContact(); - if (contact == null) - { - return false; - } + if (contact == null) + { + return false; + } - if (SelectedContactGroups == null || !SelectedContactGroups.Any()) - { - return contact.ContactGroups.Count == 0; - } + if (SelectedContactGroups == null || !SelectedContactGroups.Any()) + { + return contact.ContactGroups.Count == 0; + } - return contact.IsInAnyContactGroup(SelectedContactGroups.Select(c => c.ObjectCodeName).ToArray()); - } + return contact.IsInAnyContactGroup(SelectedContactGroups.Select(c => c.ObjectCodeName).ToArray()); + } }