示例#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);
        }
示例#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);
        }
示例#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(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);
        }
示例#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(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);
        }