private void GenerateRealFemalePersona(int siteId) { PersonalDataStructure personalData = new RealPersonalDataGenerator().GeneratePersonalData(UserGenderEnum.Female); PersonaInfo persona = new PersonaInfo { PersonaDisplayName = personalData.FirstName + " " + personalData.LastName + " (female)", PersonaName = "Persona-" + Guid.NewGuid(), PersonaSiteID = siteId, PersonaPointsThreshold = 100, PersonaEnabled = true }; persona.Insert(); var rule = new RuleInfo { RuleScoreID = persona.PersonaScoreID, RuleDisplayName = "Is female", RuleName = "Rule-" + Guid.NewGuid(), RuleValue = 1000, RuleType = RuleTypeEnum.Attribute, RuleParameter = "ContactGender", RuleCondition = "<condition><attribute name=\"ContactGender\"><value>2</value></attribute><wherecondition>ContactGender = 2</wherecondition></condition>", RuleSiteID = siteId }; rule.Insert(); }
private void GenerateDisabledPersona(int siteId) { var realPerson = new RealPersonalDataGenerator().GeneratePersonalData(); PersonaInfo persona = new PersonaInfo { PersonaDisplayName = realPerson.FirstName + " " + realPerson.LastName + " (disabled)", PersonaName = "Persona-" + Guid.NewGuid(), PersonaSiteID = siteId, PersonaPointsThreshold = 100, PersonaEnabled = false }; persona.Insert(); }
private void GenerateRealMalePersona(int siteId) { PersonalDataStructure personalData = new RealPersonalDataGenerator().GeneratePersonalData(UserGenderEnum.Male); PersonaInfo persona = new PersonaInfo { PersonaDisplayName = personalData.FirstName + " " + personalData.LastName + " (male)", PersonaName = "Persona-" + Guid.NewGuid(), PersonaSiteID = siteId, PersonaPointsThreshold = 100, PersonaEnabled = true }; persona.Insert(); var rule = new RuleInfo { RuleScoreID = persona.PersonaScoreID, RuleDisplayName = "Is male", RuleName = "Rule-" + Guid.NewGuid(), RuleValue = 1000, RuleType = RuleTypeEnum.Attribute, RuleParameter = "ContactGender", RuleCondition = "<condition><attribute name=\"ContactGender\"><value>1</value></attribute><wherecondition>ContactGender = 1</wherecondition></condition>", RuleSiteID = siteId }; rule.Insert(); }
private void GenerateDisabledPersona(int siteId) { var realPerson = new RealPersonalDataGenerator().GeneratePersonalData(); PersonaInfo persona = new PersonaInfo { PersonaDisplayName = realPerson.FirstName + " " + realPerson.LastName + " (disabled)", PersonaName = "Persona-" + Guid.NewGuid(), PersonaSiteID = siteId, PersonaPointsThreshold = 100, PersonaEnabled = false }; persona.Insert(); }
private static void GenerateVisitorAndContentRaterPersona() { var persona = new PersonaInfo { PersonaDisplayName = "Page visitor and Content rater", PersonaName = "Persona-" + Guid.NewGuid(), PersonaSiteID = SiteContext.CurrentSiteID, PersonaPointsThreshold = 75, PersonaEnabled = true }; persona.Insert(); GenerateBasicRule( persona, "100 points for content rating activity", 100, RuleTypeEnum.Activity, "<condition><activity name=\"rating\"><field name=\"ActivityValue\"><value>0</value><params><operator>11</operator></params></field><field name=\"ActivityCreated\"><params><seconddatetime>1/1/0001 12:00:00 AM</seconddatetime></params></field><field name=\"ActivityURL\"><params><operator>0</operator></params></field><field name=\"ActivityTitle\"><params><operator>0</operator></params></field><field name=\"ActivityComment\"><params><operator>0</operator></params></field><field name=\"ActivityCampaign\"><params><operator>0</operator></params></field><field name=\"ActivityIPAddress\"><params><operator>0</operator></params></field><field name=\"ActivityURLReferrer\"><params><operator>0</operator></params></field></activity><wherecondition>(ActivityType='rating') AND (CASE ISNUMERIC([ActivityValue]) WHEN 1 THEN CAST([ActivityValue] AS FLOAT) ELSE NULL END > CAST(0 AS FLOAT))</wherecondition></condition>", "rating" ); GenerateBasicRule( persona, "15 points for Home landing page", 15, RuleTypeEnum.Activity, "<condition><activity name=\"landingpage\"><field name=\"ActivityCreated\"><params><seconddatetime>1/1/0001 12:00:00 AM</seconddatetime></params></field><field name=\"ActivityURL\"><value>Home</value><params><operator>0</operator></params></field><field name=\"ActivityTitle\"><params><operator>0</operator></params></field><field name=\"ActivityComment\"><params><operator>0</operator></params></field><field name=\"ActivityCampaign\"><params><operator>0</operator></params></field><field name=\"ActivityIPAddress\"><params><operator>0</operator></params></field><field name=\"ActivityURLReferrer\"><params><operator>0</operator></params></field><field name=\"PageVisitDetail\"><params><operator>0</operator></params></field><field name=\"PageVisitABVariantName\"><params><operator>0</operator></params></field><field name=\"PageVisitMVTCombinationName\"><params><operator>0</operator></params></field></activity><wherecondition>(ActivityType='landingpage') AND (ISNULL([ActivityURL], '') LIKE N'%Home%')</wherecondition></condition>", "landingpage" ); GenerateBasicRule( persona, "Always satisfied macro rule for 30 points", 30, RuleTypeEnum.Macro, "<condition><macro><value>{%Rule(\"Contact.ContactLastName.Contains(\\\"Anonym\\\") || Contact.ContactLastName.NotContains(\\\"Anonym\\\")\", \"<rules><r pos=\\\"0\\\" par=\\\"\\\" op=\\\"or\\\" n=\\\"CMSContactFieldContainsValue\\\" ><p n=\\\"field\\\"><t>Last name</t><v>ContactLastName</v><r>1</r><d>select field</d><vt>text</vt><tv>0</tv></p><p n=\\\"op\\\"><t>contains</t><v>Contains</v><r>0</r><d>select operator</d><vt>text</vt><tv>0</tv></p><p n=\\\"value\\\"><t>Anonym</t><v>Anonym</v><r>0</r><d>enter value</d><vt>text</vt><tv>1</tv></p></r><r pos=\\\"1\\\" par=\\\"\\\" op=\\\"or\\\" n=\\\"CMSContactFieldContainsValue\\\" ><p n=\\\"field\\\"><t>Last name</t><v>ContactLastName</v><r>1</r><d>select field</d><vt>text</vt><tv>0</tv></p><p n=\\\"op\\\"><t>does not contain</t><v>NotContains</v><r>0</r><d>select operator</d><vt>text</vt><tv>0</tv></p><p n=\\\"value\\\"><t>Anonym</t><v>Anonym</v><r>0</r><d>enter value</d><vt>text</vt><tv>1</tv></p></r></rules>\")%}</value></macro></condition>" ); var pageVisitRule = GenerateBasicRule( persona, "10 points per every page visit", 10, RuleTypeEnum.Activity, "<condition><activity name=\"pagevisit\"><field name=\"ActivityCreated\"><params><seconddatetime>1/1/0001 12:00:00 AM</seconddatetime></params></field><field name=\"ActivityURL\"><value>XXXYYYZZZ</value><params><operator>1</operator></params></field><field name=\"ActivityTitle\"><params><operator>0</operator></params></field><field name=\"ActivityComment\"><params><operator>0</operator></params></field><field name=\"ActivityCampaign\"><params><operator>0</operator></params></field><field name=\"ActivityIPAddress\"><params><operator>0</operator></params></field><field name=\"ActivityURLReferrer\"><params><operator>0</operator></params></field><field name=\"PageVisitDetail\"><params><operator>0</operator></params></field><field name=\"PageVisitABVariantName\"><params><operator>0</operator></params></field><field name=\"PageVisitMVTCombinationName\"><params><operator>0</operator></params></field></activity><wherecondition>(ActivityType='pagevisit') AND (ISNULL([ActivityURL], '') NOT LIKE N'%XXXYYYZZZ%')</wherecondition></condition>", "pagevisit" ); pageVisitRule.RuleMaxPoints = 35; pageVisitRule.RuleIsRecurring = true; pageVisitRule.Update(); }
private static void GenerateDisabledPersona() { var persona = new PersonaInfo { PersonaDisplayName = "Disabled persona with various rules", PersonaName = "Persona-" + Guid.NewGuid(), PersonaSiteID = SiteContext.CurrentSiteID, PersonaPointsThreshold = 5, PersonaEnabled = false }; persona.Insert(); GenerateBasicRule( persona, "100 points for content rating activity", 100, RuleTypeEnum.Activity, "<condition><activity name=\"rating\"><field name=\"ActivityValue\"><value>0</value><params><operator>11</operator></params></field><field name=\"ActivityCreated\"><params><seconddatetime>1/1/0001 12:00:00 AM</seconddatetime></params></field><field name=\"ActivityURL\"><params><operator>0</operator></params></field><field name=\"ActivityTitle\"><params><operator>0</operator></params></field><field name=\"ActivityComment\"><params><operator>0</operator></params></field><field name=\"ActivityCampaign\"><params><operator>0</operator></params></field><field name=\"ActivityIPAddress\"><params><operator>0</operator></params></field><field name=\"ActivityURLReferrer\"><params><operator>0</operator></params></field></activity><wherecondition>(ActivityType='rating') AND (CASE ISNUMERIC([ActivityValue]) WHEN 1 THEN CAST([ActivityValue] AS FLOAT) ELSE NULL END > CAST(0 AS FLOAT))</wherecondition></condition>", "rating" ); GenerateBasicRule( persona, "Always satisfied macro rule for 30 points", 30, RuleTypeEnum.Macro, "<condition><macro><value>{%Rule(\"Contact.ContactLastName.Contains(\\\"Anonym\\\") || Contact.ContactLastName.NotContains(\\\"Anonym\\\")\", \"<rules><r pos=\\\"0\\\" par=\\\"\\\" op=\\\"or\\\" n=\\\"CMSContactFieldContainsValue\\\" ><p n=\\\"field\\\"><t>Last name</t><v>ContactLastName</v><r>1</r><d>select field</d><vt>text</vt><tv>0</tv></p><p n=\\\"op\\\"><t>contains</t><v>Contains</v><r>0</r><d>select operator</d><vt>text</vt><tv>0</tv></p><p n=\\\"value\\\"><t>Anonym</t><v>Anonym</v><r>0</r><d>enter value</d><vt>text</vt><tv>1</tv></p></r><r pos=\\\"1\\\" par=\\\"\\\" op=\\\"or\\\" n=\\\"CMSContactFieldContainsValue\\\" ><p n=\\\"field\\\"><t>Last name</t><v>ContactLastName</v><r>1</r><d>select field</d><vt>text</vt><tv>0</tv></p><p n=\\\"op\\\"><t>does not contain</t><v>NotContains</v><r>0</r><d>select operator</d><vt>text</vt><tv>0</tv></p><p n=\\\"value\\\"><t>Anonym</t><v>Anonym</v><r>0</r><d>enter value</d><vt>text</vt><tv>1</tv></p></r></rules>\")%}</value></macro></condition>" ); GenerateBasicRule( persona, "Contact has got e-mail address filled for 50p", 50, RuleTypeEnum.Attribute, "<condition><attribute name=\"ContactEmail\"><value>@</value><params><Operator>0</Operator></params></attribute><wherecondition>ISNULL([ContactEmail], '') LIKE N'%@%'</wherecondition></condition>", "ContactEmail" ); GenerateBasicRule( persona, "Contact has filled \"Contact us\" form for 50p", 50, RuleTypeEnum.Macro, "<condition><macro><value>{%Rule(\"Contact.SubmittedForm(\\\"ContactUs\\\", ToInt(150))\", \"<rules><r pos=\\\"0\\\" par=\\\"\\\" op=\\\"and\\\" n=\\\"CMSContactHasSubmittedSpecifiedFormInLastXDays\\\" ><p n=\\\"_perfectum\\\"><t>has</t><v></v><r>0</r><d>select operation</d><vt>text</vt><tv>0</tv></p><p n=\\\"days\\\"><t>150</t><v>150</v><r>0</r><d>enter days</d><vt>integer</vt><tv>1</tv></p><p n=\\\"item\\\"><t>&lt;Contact Us&gt;</t><v>ContactUs</v><r>1</r><d>select form</d><vt>text</vt><tv>0</tv></p></r></rules>\")%}</value></macro></condition>" ); var pageVisitRule = GenerateBasicRule( persona, "5 points per every page visit", 5, RuleTypeEnum.Activity, "<condition><activity name=\"pagevisit\"><field name=\"ActivityCreated\"><params><seconddatetime>1/1/0001 12:00:00 AM</seconddatetime></params></field><field name=\"ActivityURL\"><value>XXXYYYZZZ</value><params><operator>1</operator></params></field><field name=\"ActivityTitle\"><params><operator>0</operator></params></field><field name=\"ActivityComment\"><params><operator>0</operator></params></field><field name=\"ActivityCampaign\"><params><operator>0</operator></params></field><field name=\"ActivityIPAddress\"><params><operator>0</operator></params></field><field name=\"ActivityURLReferrer\"><params><operator>0</operator></params></field><field name=\"PageVisitDetail\"><params><operator>0</operator></params></field><field name=\"PageVisitABVariantName\"><params><operator>0</operator></params></field><field name=\"PageVisitMVTCombinationName\"><params><operator>0</operator></params></field></activity><wherecondition>(ActivityType='pagevisit') AND (ISNULL([ActivityURL], '') NOT LIKE N'%XXXYYYZZZ%')</wherecondition></condition>", "pagevisit" ); pageVisitRule.RuleMaxPoints = 100000; pageVisitRule.RuleIsRecurring = true; pageVisitRule.Update(); }