Esempio n. 1
0
 public CoacheeLeftEventEmailTemplateViewModel(
     string userNotificationSettingsUrl,
     UserEventAttendStatusChangeEmailDto eventAttendStatusDto,
     string eventUrl)
     : base(userNotificationSettingsUrl)
 {
     CoacheeFullName = eventAttendStatusDto.FullName;
     EventName       = eventAttendStatusDto.EventName;
     EventUrl        = eventUrl;
 }
Esempio n. 2
0
        public async Task NotifyManagerAboutEventAsync(UserEventAttendStatusChangeEmailDto userAttendStatusDto, bool isJoiningEvent)
        {
            var organization = await _organizationService.GetOrganizationByIdAsync(userAttendStatusDto.OrganizationId);

            var userNotificationSettingsUrl = _appSettings.UserNotificationSettingsUrl(organization.ShortName);
            var eventUrl = _appSettings.EventUrl(organization.ShortName, userAttendStatusDto.EventId.ToString());

            var emailDto = GetManagerNotifyEmailDto(userAttendStatusDto, userNotificationSettingsUrl, eventUrl, isJoiningEvent);

            await _mailingService.SendEmailAsync(emailDto);
        }
Esempio n. 3
0
        private async Task NotifyManagerAsync(UserEventAttendStatusChangeEmailDto userAttendStatusDto)
        {
            var managerEmail = await _usersDbSet
                               .Where(user => user.Id == userAttendStatusDto.ManagerId)
                               .Select(user => user.Email)
                               .FirstOrDefaultAsync();

            if (managerEmail == null)
            {
                return;
            }

            userAttendStatusDto.ManagerEmail = managerEmail;

            _asyncRunner.Run <IEventNotificationService>(
                async notifier => await notifier.NotifyManagerAboutEventAsync(userAttendStatusDto, false),
                _uow.ConnectionName);
        }
Esempio n. 4
0
        private EmailDto GetManagerNotifyEmailDto(UserEventAttendStatusChangeEmailDto userAttendStatusDto, string userNotificationSettingsUrl, string eventUrl, bool isJoiningEvent)
        {
            if (!isJoiningEvent)
            {
                var emailTemplateLeaveViewModel = new CoacheeLeftEventEmailTemplateViewModel(
                    userNotificationSettingsUrl,
                    userAttendStatusDto,
                    eventUrl);

                var emailLeaveBody = _mailTemplate.Generate(emailTemplateLeaveViewModel, EmailPremiumTemplateCacheKeys.CoacheeLeftEvent);

                var emailLeaveSubject = string.Format(Resources.Models.Events.Events.CoacheeLeftEventEmailSubject,
                                                      userAttendStatusDto.FullName, userAttendStatusDto.EventName);

                return(new EmailDto(new List <string> {
                    userAttendStatusDto.ManagerEmail
                },
                                    emailLeaveSubject,
                                    emailLeaveBody));
            }

            var emailTemplateJoinViewModel = new CoacheeJoinedEventEmailTemplateViewModel(
                userNotificationSettingsUrl,
                userAttendStatusDto,
                eventUrl);

            var emailJoinBody = _mailTemplate.Generate(emailTemplateJoinViewModel, EmailPremiumTemplateCacheKeys.CoacheeJoinedEvent);

            var emailJoinSubject = string.Format(Resources.Models.Events.Events.CoacheeJoinedEventEmailSubject,
                                                 userAttendStatusDto.FullName, userAttendStatusDto.EventName);

            return(new EmailDto(new List <string> {
                userAttendStatusDto.ManagerEmail
            },
                                emailJoinSubject,
                                emailJoinBody));
        }