Example #1
0
    /// <summary>
    /// Unigrid button clicked.
    /// </summary>
    protected void gridElem_OnAction(string actionName, object actionArgument)
    {
        if (actionName == "delete")
        {
            int groupId          = ValidationHelper.GetInteger(actionArgument, 0);
            ContactGroupInfo cgi = ContactGroupInfoProvider.GetContactGroupInfo(groupId);

            // Check permission
            if ((cgi != null) && ContactGroupHelper.AuthorizedModifyContactGroup(cgi.ContactGroupSiteID, true))
            {
                // Delete contact group
                ContactGroupInfoProvider.DeleteContactGroupInfo(groupId);
            }
        }
    }
Example #2
0
        private ContactGroupInfo CreateContactGroup(
            string contactGroupCodeName,
            string contactGroupName)
        {
            var contactGroupInfo = ContactGroupInfoProvider.GetContactGroupInfo(contactGroupCodeName);

            if (contactGroupInfo != null)
            {
                ContactGroupInfoProvider.DeleteContactGroupInfo(contactGroupInfo);
            }

            var groupObj = new ContactGroupInfo();

            groupObj.ContactGroupDisplayName = contactGroupName;
            groupObj.ContactGroupName        = contactGroupCodeName;
            groupObj.ContactGroupEnabled     = true;
            ContactGroupInfoProvider.SetContactGroupInfo(groupObj);
            return(groupObj);
        }
Example #3
0
        private static ContactGroupInfo CreateContactGroup(PersonaInfo persona)
        {
            var contactGroupInfo = ContactGroupInfoProvider.GetContactGroupInfo(CoffeeGeekPersonaContactGroupName);

            if (contactGroupInfo != null)
            {
                ContactGroupInfoProvider.DeleteContactGroupInfo(contactGroupInfo);
            }

            var groupObj = new ContactGroupInfo();

            groupObj.ContactGroupDisplayName = "Is in persona 'Martina, the Coffee Geek'";
            groupObj.ContactGroupName        = CoffeeGeekPersonaContactGroupName;
            groupObj.ContactGroupEnabled     = true;
            var str = MacroSecurityProcessor.AddSecurityParameters(
                string.Format(
                    "{{%Rule(\"(Contact.IsInPersona(\\\"{0}\\\"))\", \"<rules><r pos=\\\"0\\\" par=\\\"\\\" op=\\\"and\\\" n=\\\"ContactIsInPersona\\\" ><p n=\\\"_is\\\"><t>is</t><v></v><r>0</r><d>select operation</d><vt>text</vt><tv>0</tv></p><p n=\\\"personaguid\\\"><t>{1}</t><v>{0}</v><r>1</r><d>select persona</d><vt>text</vt><tv>0</tv></p></r></rules>\") %}}",
                    persona.PersonaGUID, persona.PersonaDisplayName),
                MacroIdentityOption.FromUserInfo(UserInfoProvider.AdministratorUser), null);

            groupObj.ContactGroupDynamicCondition = str;
            ContactGroupInfoProvider.SetContactGroupInfo(groupObj);
            return(groupObj);
        }