コード例 #1
0
    /// <summary>
    /// Logs activity for unsubscribing.
    /// </summary>
    /// <param name="sb">Subscriber (optional - can be null if subscriber ID is used)</param>
    /// <param name="subscriberId">Subscriber ID (optional - can be zero if subscriber object is used)</param>
    /// <param name="newsletterId">Newsletter ID</param>
    /// <param name="issueId">Issue ID</param>
    /// <param name="contactId">Contact ID is present if the mail is sent to a contact or a contact group</param>
    private void LogActivity(SubscriberInfo sb, int subscriberId, int newsletterId, int issueId, int contactId)
    {
        bool isFromContactGroup = !string.IsNullOrEmpty(sb.SubscriberType) && sb.SubscriberType.EqualsCSafe(PredefinedObjectType.CONTACTGROUP, true);

        if (contactId <= 0)
        {
            contactId = ActivityTrackingHelper.GetContactID(sb);
        }

        if (sb == null)
        {
            sb = SubscriberInfoProvider.GetSubscriberInfo(subscriberId);
        }

        if (contactId > 0)
        {
            NewsletterInfo news = NewsletterInfoProvider.GetNewsletterInfo(newsletterId);

            Activity activity = new ActivityNewsletterUnsubscribing(sb, news, CMSContext.ActivityEnvironmentVariables);
            if (activity.Data != null)
            {
                activity.Data.ContactID    = contactId;
                activity.Data.ItemDetailID = issueId;
                activity.Data.Value        = isFromContactGroup ? "contactgroup(" + sb.SubscriberRelatedID + ")" : null;
                activity.Log();
            }
        }
    }
コード例 #2
0
    /// <summary>
    /// Logs activity for unsubscribing.
    /// </summary>
    /// <param name="subscriber">Subscriber</param>
    /// <param name="newsletterId">Newsletter ID</param>
    /// <param name="issueId">Issue ID</param>
    /// <param name="contactId">Contact ID is present if the mail is sent to a contact or a contact group</param>
    private void LogActivity(SubscriberInfo subscriber, int newsletterId, int issueId, int contactId)
    {
        if (subscriber == null)
        {
            throw new ArgumentNullException("subscriber");
        }
        if (contactId <= 0)
        {
            contactId = ActivityTrackingHelper.GetContactID(subscriber);
        }

        if (contactId > 0)
        {
            NewsletterInfo news = NewsletterInfoProvider.GetNewsletterInfo(newsletterId);
            bool           isFromContactGroup = subscriber.SubscriberType.EqualsCSafe(PredefinedObjectType.CONTACTGROUP, true);
            bool           isFromPersona      = subscriber.SubscriberType.EqualsCSafe(PredefinedObjectType.PERSONA, true);
            Activity       activity           = new ActivityNewsletterUnsubscribing(subscriber, news, AnalyticsContext.ActivityEnvironmentVariables);
            if (activity.Data != null)
            {
                activity.Data.ContactID    = contactId;
                activity.Data.ItemDetailID = issueId;
                if (isFromContactGroup)
                {
                    activity.Data.Value = "contactgroup(" + subscriber.SubscriberRelatedID + ")";
                }
                else if (isFromPersona)
                {
                    activity.Data.Value = "persona(" + subscriber.SubscriberRelatedID + ")";
                }
                activity.Log();
            }
        }
    }
コード例 #3
0
    /// <summary>
    /// Logs activity for unsubscribing.
    /// </summary>
    /// <param name="sb">Subscriber (optional - can be null if subscriber ID is used)</param>
    /// <param name="subscriberId">Subscriber ID (optional - can be zero if subscriber object is used)</param>
    /// <param name="newsletterId">Newsletter ID</param>
    /// <param name="siteId">Site ID</param>
    /// <param name="issueId">Issue ID</param>
    /// <param name="issueGuid">Issue GUID</param>
    /// <param name="contactId">Contact ID is present if the mail is sent to a contact or a contact group</param>
    private void LogActivity(SubscriberInfo sb, int subscriberId, int newsletterId, int siteId, int issueId, Guid issueGuid, int contactId)
    {
        // Load subscriber info object according to its ID if not given
        if (sb == null)
        {
            sb = SubscriberInfoProvider.GetSubscriberInfo(subscriberId);
        }

        NewsletterInfo news = NewsletterInfoProvider.GetNewsletterInfo(newsletterId);
        bool           isFromContactGroup = !string.IsNullOrEmpty(sb.SubscriberType) && sb.SubscriberType.EqualsCSafe(PredefinedObjectType.CONTACTGROUP, true);
        bool           isFromPersona      = !string.IsNullOrEmpty(sb.SubscriberType) && sb.SubscriberType.EqualsCSafe(PredefinedObjectType.PERSONA, true);

        if (contactId <= 0)
        {
            contactId = ActivityTrackingHelper.GetContactID(sb);
        }

        if (contactId > 0)
        {
            // Load additional info (issue id)
            if ((issueId <= 0) && (issueGuid != Guid.Empty))
            {
                IssueInfo issue = IssueInfoProvider.GetIssueInfo(issueGuid, siteId);
                if (issue != null)
                {
                    issueId = issue.IssueID;
                }
            }

            Activity activity = new ActivityNewsletterUnsubscribing(sb, news, AnalyticsContext.ActivityEnvironmentVariables);
            if (activity.Data != null)
            {
                activity.Data.ContactID    = contactId;
                activity.Data.ItemDetailID = issueId;
                activity.Data.Value        = isFromContactGroup
                    ? "contactgroup(" + sb.SubscriberRelatedID + ")"
                    : isFromPersona
                        ? "persona(" + sb.SubscriberRelatedID + ")"
                        : null;
                activity.Log();
            }
        }
    }
コード例 #4
0
    /// <summary>
    /// Logs activity for subscribing/unsubscribing
    /// </summary>
    /// <param name="ui">User</param>
    /// <param name="newsletterId">Newsletter ID</param>
    /// <param name="subscribe">Subscribing/unsubscribing flag</param>
    private void LogActivity(UserInfo ui, int newsletterId, bool subscribe)
    {
        if ((sb == null) || (ui == null))
        {
            return;
        }

        if (sb.SubscriberType.Equals(SiteObjectType.USER, StringComparison.InvariantCultureIgnoreCase))
        {
            NewsletterInfo news = NewsletterInfoProvider.GetNewsletterInfo(newsletterId);
            Activity       activity;
            if (subscribe)
            {
                activity = new ActivityNewsletterSubscribing(sb, news, CMSContext.ActivityEnvironmentVariables);
            }
            else
            {
                activity = new ActivityNewsletterUnsubscribing(sb, news, CMSContext.ActivityEnvironmentVariables);
            }
            activity.Log();
        }
    }
コード例 #5
0
    /// <summary>
    /// Logs activity for subscribing/unsubscribing
    /// </summary>
    /// <param name="ui">User</param>
    /// <param name="newsletterId">Newsletter ID</param>
    /// <param name="subscribe">Subscribing/unsubscribing flag</param>
    private void LogActivity(UserInfo ui, int newsletterId, bool subscribe)
    {
        if ((subscriber == null) || (ui == null))
        {
            return;
        }

        // Log activity only if subscriber is User
        if ((subscriber.SubscriberType != null) && subscriber.SubscriberType.Equals(UserInfo.OBJECT_TYPE, StringComparison.InvariantCultureIgnoreCase))
        {
            NewsletterInfo news = NewsletterInfoProvider.GetNewsletterInfo(newsletterId);
            Activity       activity;
            if (subscribe)
            {
                activity = new ActivityNewsletterSubscribing(subscriber, news, AnalyticsContext.ActivityEnvironmentVariables);
            }
            else
            {
                activity = new ActivityNewsletterUnsubscribing(news, AnalyticsContext.ActivityEnvironmentVariables);
            }
            activity.Log();
        }
    }
コード例 #6
0
    /// <summary>
    /// Logs activity for unsubscribing.
    /// </summary>
    /// <param name="sb">Subscriber (optional - can be null if subscriber ID is used)</param>
    /// <param name="subscriberId">Subscriber ID (optional - can be zero if subscriber object is used)</param>
    /// <param name="newsletterId">Newsletter ID</param>
    /// <param name="siteId">Site ID</param>
    /// <param name="issueId">Issue ID</param>
    /// <param name="issueGuid">Issue GUID</param>
    /// <param name="contactId">Contact ID is present if the mail is sent to a contact or a contact group</param>
    private void LogActivity(SubscriberInfo sb, int subscriberId, int newsletterId, int siteId, int issueId, Guid issueGuid, int contactId)
    {
        // Load subscriber info object according to its ID if not given
        if (sb == null)
        {
            sb = SubscriberInfoProvider.GetSubscriberInfo(subscriberId);
        }

        NewsletterInfo news = NewsletterInfoProvider.GetNewsletterInfo(newsletterId);
        bool isFromContactGroup = !string.IsNullOrEmpty(sb.SubscriberType) && sb.SubscriberType.EqualsCSafe(PredefinedObjectType.CONTACTGROUP, true);
        bool isFromPersona = !string.IsNullOrEmpty(sb.SubscriberType) && sb.SubscriberType.EqualsCSafe(PredefinedObjectType.PERSONA, true);
        if (contactId <= 0)
        {
            contactId = ActivityTrackingHelper.GetContactID(sb);
        }

        if (contactId > 0)
        {
            // Load additional info (issue id)
            if ((issueId <= 0) && (issueGuid != Guid.Empty))
            {
                IssueInfo issue = IssueInfoProvider.GetIssueInfo(issueGuid, siteId);
                if (issue != null)
                {
                    issueId = issue.IssueID;
                }
            }

            Activity activity = new ActivityNewsletterUnsubscribing(sb, news, AnalyticsContext.ActivityEnvironmentVariables);
            if (activity.Data != null)
            {
                activity.Data.ContactID = contactId;
                activity.Data.ItemDetailID = issueId;
                activity.Data.Value = isFromContactGroup
                    ? "contactgroup(" + sb.SubscriberRelatedID + ")"
                    : isFromPersona
                        ? "persona(" + sb.SubscriberRelatedID + ")"
                        : null;
                activity.Log();
            }
        }
    }
    /// <summary>
    /// Logs activity for unsubscribing.
    /// </summary>
    /// <param name="subscriber">Subscriber</param>
    /// <param name="newsletterId">Newsletter ID</param>
    /// <param name="issueId">Issue ID</param>
    /// <param name="contactId">Contact ID is present if the mail is sent to a contact or a contact group</param>
    private void LogActivity(SubscriberInfo subscriber, int newsletterId, int issueId, int contactId)
    {
        if (subscriber == null)
        {
            throw new ArgumentNullException("subscriber");
        }
        if (contactId <= 0)
        {
            contactId = ActivityTrackingHelper.GetContactID(subscriber);
        }

        if (contactId > 0)
        {
            NewsletterInfo news = NewsletterInfoProvider.GetNewsletterInfo(newsletterId);
            bool isFromContactGroup = subscriber.SubscriberType.EqualsCSafe(PredefinedObjectType.CONTACTGROUP, true);
            bool isFromPersona = subscriber.SubscriberType.EqualsCSafe(PredefinedObjectType.PERSONA, true);
            Activity activity = new ActivityNewsletterUnsubscribing(subscriber, news, AnalyticsContext.ActivityEnvironmentVariables);
            if (activity.Data != null)
            {
                activity.Data.ContactID = contactId;
                activity.Data.ItemDetailID = issueId;
                if (isFromContactGroup)
                {
                    activity.Data.Value = "contactgroup(" + subscriber.SubscriberRelatedID + ")";
                }
                else if (isFromPersona)
                {
                    activity.Data.Value = "persona(" + subscriber.SubscriberRelatedID + ")";
                }
                activity.Log();
            }
        }
    }
    /// <summary>
    /// Logs activity for subscribing/unsubscribing
    /// </summary>
    /// <param name="ui">User</param>
    /// <param name="newsletterId">Newsletter ID</param>
    /// <param name="subscribe">Subscribing/unsubscribing flag</param>
    private void LogActivity(UserInfo ui, int newsletterId, bool subscribe)
    {
        if ((sb == null) || (ui == null))
        {
            return;
        }

        // Log activity only if subscriber is User
        if ((sb.SubscriberType != null) && sb.SubscriberType.Equals(UserInfo.OBJECT_TYPE, StringComparison.InvariantCultureIgnoreCase))
        {
            NewsletterInfo news = NewsletterInfoProvider.GetNewsletterInfo(newsletterId);
            Activity activity;
            if (subscribe)
            {
                activity = new ActivityNewsletterSubscribing(sb, news, AnalyticsContext.ActivityEnvironmentVariables);
            }
            else
            {
                activity = new ActivityNewsletterUnsubscribing(sb, news, AnalyticsContext.ActivityEnvironmentVariables);
            }
            activity.Log();
        }
    }
コード例 #9
0
    /// <summary>
    /// Logs activity for subscribing/unsubscribing
    /// </summary>
    /// <param name="ui">User</param>
    /// <param name="newsletterId">Newsletter ID</param>
    /// <param name="subscribe">Subscribing/unsubscribing flag</param>
    private void LogActivity(UserInfo ui, int newsletterId, bool subscribe)
    {
        if ((sb == null) || (ui == null))
        {
            return;
        }

        if (sb.SubscriberType.Equals(SiteObjectType.USER, StringComparison.InvariantCultureIgnoreCase))
        {
            NewsletterInfo news = NewsletterInfoProvider.GetNewsletterInfo(newsletterId);
            Activity activity;
            if (subscribe)
            {
                activity = new ActivityNewsletterSubscribing(sb, news, CMSContext.ActivityEnvironmentVariables);
            }
            else
            {
                activity = new ActivityNewsletterUnsubscribing(sb, news, CMSContext.ActivityEnvironmentVariables);
            }
            activity.Log();
        }
    }
コード例 #10
0
    /// <summary>
    /// Logs activity for unsubscribing.
    /// </summary>
    /// <param name="sb">Subscriber (optional - can be null if subscriber ID is used)</param>
    /// <param name="subscriberId">Subscriber ID (optional - can be zero if subscriber object is used)</param>
    /// <param name="newsletterId">Newsletter ID</param>
    /// <param name="issueId">Issue ID</param>
    /// <param name="contactId">Contact ID is present if the mail is sent to a contact or a contact group</param>
    private void LogActivity(SubscriberInfo sb, int subscriberId, int newsletterId, int issueId, int contactId)
    {
        bool isFromContactGroup = !string.IsNullOrEmpty(sb.SubscriberType) && sb.SubscriberType.EqualsCSafe(PredefinedObjectType.CONTACTGROUP, true);
        if (contactId <= 0)
        {
            contactId = ActivityTrackingHelper.GetContactID(sb);
        }

        if (sb == null)
        {
            sb = SubscriberInfoProvider.GetSubscriberInfo(subscriberId);
        }

        if (contactId > 0)
        {
            NewsletterInfo news = NewsletterInfoProvider.GetNewsletterInfo(newsletterId);

            Activity activity = new ActivityNewsletterUnsubscribing(sb, news, CMSContext.ActivityEnvironmentVariables);
            if (activity.Data != null)
            {
                activity.Data.ContactID = contactId;
                activity.Data.ItemDetailID = issueId;
                activity.Data.Value = isFromContactGroup ? "contactgroup(" + sb.SubscriberRelatedID + ")" : null;
                activity.Log();
            }
        }
    }