/// <summary> /// Unigrid button clicked. /// </summary> protected void gridElem_OnAction(string actionName, object actionArgument) { // Perform 'remove' action if (actionName == "remove") { // Delete the object int accountId = ValidationHelper.GetInteger(actionArgument, 0); AccountInfo account = AccountInfoProvider.GetAccountInfo(accountId); if (account != null) { // User has no permission to modify site accounts if (((account.AccountSiteID > 0) && !modifySiteAccounts) || !ContactGroupHelper.AuthorizedModifyContactGroup(cgi.ContactGroupSiteID, false)) { CMSPage.RedirectToCMSDeskAccessDenied(ModuleEntry.CONTACTMANAGEMENT, "ModifyAccounts"); } // User has no permission to modify global accounts else if ((account.AccountSiteID == 0) && !modifyGlobalAccounts || !ContactGroupHelper.AuthorizedModifyContactGroup(cgi.ContactGroupSiteID, false)) { CMSPage.RedirectToCMSDeskAccessDenied(ModuleEntry.CONTACTMANAGEMENT, "ModifyGlobalAccounts"); } // User has permission else { // Get the relationship object ContactGroupMemberInfo mi = ContactGroupMemberInfoProvider.GetContactGroupMemberInfoByData(cgi.ContactGroupID, accountId, ContactGroupMemberTypeEnum.Account); if (mi != null) { ContactGroupMemberInfoProvider.DeleteContactGroupMemberInfo(mi); } } } } }
/// <summary> /// Attempt to remove user from group event handler. /// </summary> private void cContactGroups_OnRemoveFromGroup(object sender, EventArgs e) { int contactGroupID = ValidationHelper.GetInteger(sender, 0); if (contactGroupID != 0) { ContactGroupInfo removedGroup = ContactGroupInfoProvider.GetContactGroupInfo(contactGroupID); if (UserCanManageGroup(removedGroup) || UserCanManageContact(editedContact)) { // Get the relationship object ContactGroupMemberInfo mi = ContactGroupMemberInfoProvider.GetContactGroupMemberInfoByData(contactGroupID, editedContact.ContactID, ContactGroupMemberTypeEnum.Contact); if (mi != null) { ContactGroupMemberInfoProvider.DeleteContactGroupMemberInfo(mi); } } } }
/// <summary> /// Unigrid button clicked. /// </summary> protected void gridElem_OnAction(string actionName, object actionArgument) { // Perform 'remove' action if (actionName == "remove") { // Delete the object int contactId = ValidationHelper.GetInteger(actionArgument, 0); ContactInfo contact = ContactInfoProvider.GetContactInfo(contactId); if (contact != null) { // User has no permission to modify site contacts if (((contact.ContactSiteID > 0) && !modifySiteContacts) || !ContactGroupHelper.AuthorizedModifyContactGroup(cgi.ContactGroupSiteID, false)) { CMSPage.RedirectToCMSDeskAccessDenied("CMS.ContactManagement", "ModifyContacts"); } // User has no permission to modify global contacts else if ((contact.ContactSiteID == 0) && !modifyGlobalContacts || !ContactGroupHelper.AuthorizedModifyContactGroup(cgi.ContactGroupSiteID, false)) { CMSPage.RedirectToCMSDeskAccessDenied("CMS.ContactManagement", "ModifyGlobalContacts"); } // User has permission else { // Get the relationship object ContactGroupMemberInfo mi = ContactGroupMemberInfoProvider.GetContactGroupMemberInfoByData(cgi.ContactGroupID, contactId, ContactGroupMemberTypeEnum.Contact); if (mi != null) { ContactGroupMemberInfoProvider.DeleteContactGroupMemberInfo(mi); } } } // Check modify permission if ((siteID > 0) && !(CheckPermissions("cms.contactmanagement", "ModifyContactGroups"))) { return; } else if ((siteID == 0) && !(CheckPermissions("cms.contactmanagement", "ModifyGlobalContactGroups"))) { return; } } }
/// <summary> /// Unigrid button clicked. /// </summary> protected void gridElem_OnAction(string actionName, object actionArgument) { // Perform 'remove' action if (actionName == "remove") { // Delete the object int accountId = ValidationHelper.GetInteger(actionArgument, 0); AccountInfo account = AccountInfoProvider.GetAccountInfo(accountId); if (account != null) { CheckModifyPermissions(); // Get the relationship object ContactGroupMemberInfo mi = ContactGroupMemberInfoProvider.GetContactGroupMemberInfoByData(cgi.ContactGroupID, accountId, ContactGroupMemberTypeEnum.Account); if (mi != null) { ContactGroupMemberInfoProvider.DeleteContactGroupMemberInfo(mi); } } } }