protected override void DoWork() { var subscriptionRemainingDayCount = Convert.ToInt32(SettingManager.GetSettingValueForApplication(AppSettings.TenantManagement.SubscriptionExpireNotifyDayCount)); var dateToCheckRemainingDayCount = Clock.Now.AddDays(subscriptionRemainingDayCount).ToUniversalTime(); var subscriptionExpiredTenants = _tenantRepository.GetAllList( tenant => tenant.SubscriptionEndDateUtc != null && tenant.SubscriptionEndDateUtc.Value.Date == dateToCheckRemainingDayCount.Date && tenant.IsActive && tenant.EditionId != null ); foreach (var tenant in subscriptionExpiredTenants) { Debug.Assert(tenant.EditionId.HasValue); try { AsyncHelper.RunSync(() => _userEmailer.TryToSendSubscriptionExpiringSoonEmail(tenant.Id, dateToCheckRemainingDayCount)); } catch (Exception exception) { Logger.Error(exception.Message, exception); } } }
protected override void DoWork() { var dateToCheckRemainingDayCount = Clock.Now.AddDays(SubscriptionRemainingDayCount).ToUniversalTime(); var subscriptionExpiredTenants = _tenantRepository.GetAllList( tenant => tenant.SubscriptionEndDateUtc != null && tenant.SubscriptionEndDateUtc.Value.Date == dateToCheckRemainingDayCount.Date && tenant.IsActive && tenant.EditionId != null ); foreach (var tenant in subscriptionExpiredTenants) { Debug.Assert(tenant.EditionId.HasValue); try { _userEmailer.TryToSendSubscriptionExpiringSoonEmail(tenant.Id, dateToCheckRemainingDayCount); } catch (Exception exception) { Logger.Error(exception.Message, exception); } } }