Example #1
0
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        if (StopProcessing)
        {
            // Do not process
        }
        else
        {
            if (!string.IsNullOrEmpty(TrackingConsent))
            {
                UseDefaultCookieLevelWhenConsentIsNotAgreed();
            }

            int currentCookieLevel = GetCurrentCookieLevel();

            if (!string.IsNullOrEmpty(TrackingConsent) && currentCookieLevel < CookieLevel.Visitor)
            {
                DisplayTrackingConsent();
            }
            else
            {
                pnlTrackingConsent.Visible = false;
            }

            int matchLevel = CookieHelper.ConvertCookieLevelToIntegerValue(MatchLevel, currentCookieLevel);

            if (currentCookieLevel < matchLevel)
            {
                // Set the components to the Above level
                SetComponents(BelowLevelVisible, BelowLevelText, BelowShowAll, BelowShowSpecific, BelowShowDeny);
            }
            else if (currentCookieLevel == matchLevel)
            {
                // Set the components to the Above level
                SetComponents(ExactLevelVisible, ExactLevelText, ExactShowAll, ExactShowSpecific, ExactShowDeny);
            }
            else
            {
                // Set the components to the Above level
                SetComponents(AboveLevelVisible, AboveLevelText, AboveShowAll, AboveShowSpecific, AboveShowDeny);
            }
        }
    }
Example #2
0
    /// <summary>
    /// Allow Specific click
    /// </summary>
    protected void btnAllowSpecific_Click(object sender, EventArgs e)
    {
        int specificLevel = CookieHelper.ConvertCookieLevelToIntegerValue(AllowSpecificSetLevel, CookieLevel.Essential);

        ChangeLevel(specificLevel);
    }