Beispiel #1
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);
        }
Beispiel #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);

            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 static XConnectClient GetClient()
        {
            if (singleRef == null)
            {
                XConnectClientReference reference = new XConnectClientReference();
                singleRef = reference.BuildClient();
            }

            return(singleRef);
        }
Beispiel #4
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);
        }
Beispiel #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(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);
        }