protected void btnRevoke_Click(object sender, EventArgs e) { if (PortalContext.ViewMode.IsLiveSite()) { Button btn = (Button)sender; int consentId = ValidationHelper.GetInteger(btn.CommandArgument, 0); ConsentInfo consent = ConsentInfoProvider.GetConsentInfo(consentId); if ((consent != null) && (CurrentContact != null)) { ConsentAgreementService.Revoke(CurrentContact, consent); SetupControl(); lblInfo.Visible = true; } } }
protected void SetupControl() { if (CurrentContact == null) { return; } var consents = ConsentAgreementService.GetAgreedConsents(CurrentContact); var currentCulture = LocalizationContext.CurrentCulture.CultureCode; var dataSource = consents.Select(consent => new { ConsentID = consent.Id, ConsentDisplayName = consent.DisplayName, ConsentShortText = consent.GetConsentText(currentCulture).ShortText }); rptConsents.DataSource = dataSource; rptConsents.DataBind(); lblNoData.Visible = !consents.Any(); }