Esempio n. 1
0
        /// <summary>Execute subscription job</summary>
        protected virtual string InternalExecute()
        {
            int num1 = 0;
            int num2 = 0;

label_1:
            int totalRecords;
            ProfileInfoCollection allProfiles = ProfileManager.GetAllProfiles(ProfileAuthenticationOption.All, num2++, 1000, out totalRecords);

            if (allProfiles.Count == 0)
            {
                return(string.Format("{0} user profiles were found. {1} subscription e-mails were sent.", (object)totalRecords, (object)num1));
            }
            IEnumerator enumerator = allProfiles.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    EPiServerProfile profile = EPiServerProfile.Get(((ProfileInfo)enumerator.Current).UserName);
                    if (!SubscriptionJob.IsInInterval(profile.SubscriptionInfo.Interval, profile.SubscriptionInfo.LastMessage))
                    {
                        int num3 = this.SendSubscriptions(profile);
                        if (num3 >= 0)
                        {
                            profile.SubscriptionInfo.LastMessage = DateTime.Now;
                            num1 += num3;
                            profile.Save();
                        }
                    }
                }
                goto label_1;
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }