示例#1
0
        /// <summary>
        /// Batch job to send all of the nightly/monthly email.
        /// </summary>
        public async void NightlyRun()
        {
            if (ActiveBrand == null)
            {
                ActiveBrand = Branding.CurrentBrand;
            }
            if (TasksToRun == SelectedTasks.All || TasksToRun == SelectedTasks.EmailOnly)
            {
                SendNightlyEmails();
            }

            // Do any Cloud Storage updates
            if (TasksToRun == SelectedTasks.All || TasksToRun == SelectedTasks.CloudStorageOnly)
            {
                await BackupToCloud();
            }

            // Send out any notices of pending gratuity expirations
            EarnedGratuity.SendRemindersOfExpiringGratuities(UserRestriction);

            if (DateTime.Now.Day == 1)
            {
                Clubs.Club.SendMonthlyClubReports();
            }
        }
示例#2
0
        /// <summary>
        /// Batch job to send all of the nightly/monthly email.
        /// </summary>
        public async void NightlyRun()
        {
            EventRecorder.LogCall("Starting nightly run");
            try
            {
                if (ActiveBrand == null)
                {
                    ActiveBrand = Branding.CurrentBrand;
                }
                if (TasksToRun == SelectedTasks.All || TasksToRun == SelectedTasks.EmailOnly)
                {
                    SendNightlyEmails();
                }

                // Do any Cloud Storage updates
                if (TasksToRun == SelectedTasks.All || TasksToRun == SelectedTasks.CloudStorageOnly)
                {
                    await BackupToCloud().ConfigureAwait(false);    // we have no httpcontext.current, so no need to save
                }
                // Send out any notices of pending gratuity expirations
                EarnedGratuity.SendRemindersOfExpiringGratuities(UserRestriction);

                if (DateTime.Now.Day == 1)
                {
                    Clubs.Club.SendMonthlyClubReports();
                }
            }
            catch (Exception ex) when(!(ex is OutOfMemoryException))
            {
                EventRecorder.LogCall("Nightly run had exception: {msg}, {stacktrace} ", ex.Message, ex.StackTrace);
            }

            EventRecorder.LogCall("Ended nightly run");
        }