// Evaluates condition for single contact
        public bool Evaluate(IRuleExecutionContext context)
        {
            var contact             = context.Fact <Contact>();
            EmailAddressList emails = CollectionModel.Emails(RuleExecutionContextExtensions.Fact <Contact>(context, null));

            return(emails?.PreferredEmail == null ? false : emails.PreferredEmail.Validated);
        }
Пример #2
0
        public bool Evaluate(IRuleExecutionContext context)
        {
            var contact = RuleExecutionContextExtensions.Fact <Contact>(context);

            XConnectClient client = XConnectClientReference.GetClient();

            Contact existingContact = client.Get <Contact>(contact, new ContactExpandOptions(CvPersonFacet.DefaultFacetKey));

            CvPersonFacet personFacet = existingContact.GetFacet <CvPersonFacet>(CvPersonFacet.DefaultFacetKey);

            if (string.IsNullOrEmpty(personFacet?.Company))
            {
                return(false);
            }

            //string[] partnersList = Partners.Split(';');

            //bool result = partnersList.Any(p => p.IndexOf(personFacet.Company, StringComparison.OrdinalIgnoreCase) > 0);

            bool result = Partners.IndexOf(personFacet.Company, StringComparison.OrdinalIgnoreCase) > 0;

            Log.Information("PartnerListMatches result ==  " + (result).ToString());

            return(result);
        }
Пример #3
0
        public bool Evaluate(IRuleExecutionContext context)
        {
            var contact = RuleExecutionContextExtensions.Fact <Contact>(context);

            XConnectClient client = XConnectClientReference.GetClient();

            Contact existingContact = client.Get <Contact>(contact, new ContactExpandOptions(CvPersonFacet.DefaultFacetKey));

            CvPersonFacet personFacet = existingContact.GetFacet <CvPersonFacet>(CvPersonFacet.DefaultFacetKey);

            Log.Information("AgeMatches personFacet is null ==  " + (personFacet == null).ToString());

            if (personFacet == null || personFacet.Age == 0)
            {
                return(false);
            }

            Log.Information("AgeMatches personFacet.Age ==  " + personFacet.Age);

            bool result = NumericOperationTypeExtensions.Evaluate(this.Comparison, personFacet.Age, this.Age);

            Log.Information("AgeMatches result ==  " + result.ToString());

            return(result);
        }
        public bool Evaluate(IRuleExecutionContext context)
        {
            var contact    = RuleExecutionContextExtensions.Fact <Contact>(context, null);
            int airQuality = _airService.GetAirQualityForContact(contact);


            if (Comparison == NumericOperationType.IsNotEqualTo)
            {
                return(airQuality != AirQuality);
            }
            return(NumericOperationTypeExtensions.Evaluate(Comparison, airQuality, AirQuality));
        }
Пример #5
0
        public bool Evaluate(IRuleExecutionContext context)
        {
            var contact = RuleExecutionContextExtensions.Fact <Contact>(context);

            XConnectClient client = XConnectClientReference.GetClient();

            Contact existingContact = client.Get <Contact>(contact, new ContactExpandOptions(PersonalInformation.DefaultFacetKey));

            PersonalInformation personFacet = existingContact.GetFacet <PersonalInformation>(PersonalInformation.DefaultFacetKey);

            if (personFacet == null || string.IsNullOrEmpty(personFacet.JobTitle))
            {
                return(false);
            }

            bool result = personFacet.JobTitle.IndexOf(this.JobTitle, StringComparison.OrdinalIgnoreCase) >= 0;

            Log.Information("JobTitleMatches result ==  " + result);

            return(result);
        }
Пример #6
0
        public bool Evaluate(IRuleExecutionContext context)
        {
            var contact = RuleExecutionContextExtensions.Fact <Contact>(context);

            XConnectClient client = XConnectClientReference.GetClient();

            Contact existingContact = client.Get <Contact>(contact, new ContactExpandOptions(CvPersonFacet.DefaultFacetKey));

            CvPersonFacet personFacet = existingContact.GetFacet <CvPersonFacet>(CvPersonFacet.DefaultFacetKey);

            if (personFacet?.BadgeText == null)
            {
                return(false);
            }

            bool result = personFacet.BadgeText
                          .Any(line => line.IndexOf(this.BadgeText, StringComparison.OrdinalIgnoreCase) >= 0);

            Log.Information("BadgeTextMatches result ==  " + result);

            return(result);
        }