示例#1
0
        public void NotifyApprovedKudosRecipient(KudosLog kudosLog)
        {
            var organizationName            = GetOrganizationName(kudosLog.OrganizationId).ShortName;
            var sendingUserFullName         = GetUserFullName(kudosLog.CreatedBy);
            var userNotificationSettingsUrl = _appSettings.UserNotificationSettingsUrl(organizationName);
            var kudosProfileUrl             = _appSettings.KudosProfileUrl(organizationName, kudosLog.EmployeeId);
            var subject = Resources.Models.Kudos.Kudos.EmailSubject;

            var emailTemplateViewModel = new KudosReceivedDecreasedEmailTemplateViewModel(
                userNotificationSettingsUrl,
                kudosLog.Points,
                kudosLog.KudosTypeName,
                sendingUserFullName == null ? ConstBusinessLayer.DeletedUserName : sendingUserFullName,
                kudosLog.Comments,
                kudosProfileUrl);
            var body = _mailTemplate.Generate(emailTemplateViewModel, EmailTemplateCacheKeys.KudosReceived);

            _mailingService.SendEmail(new EmailDto(kudosLog.Employee.Email, subject, body));
        }
        public async Task NotifyApprovedKudosDecreaseRecipientAsync(KudosLog kudosLog)
        {
            var organizationName    = (await GetOrganizationNameAsync(kudosLog.OrganizationId)).ShortName;
            var sendingUserFullName = await GetUserFullNameAsync(kudosLog.CreatedBy);

            var userNotificationSettingsUrl = _appSettings.UserNotificationSettingsUrl(organizationName);
            var kudosProfileUrl             = _appSettings.KudosProfileUrl(organizationName, kudosLog.EmployeeId);
            var subject = Resources.Models.Kudos.Kudos.MinusKudosEmailSubject;

            var emailTemplateViewModel = new KudosReceivedDecreasedEmailTemplateViewModel(userNotificationSettingsUrl,
                                                                                          kudosLog.Points,
                                                                                          kudosLog.KudosTypeName,
                                                                                          sendingUserFullName ?? BusinessLayerConstants.DeletedUserName,
                                                                                          kudosLog.Comments,
                                                                                          kudosProfileUrl);

            var body = _mailTemplate.Generate(emailTemplateViewModel, EmailTemplateCacheKeys.KudosDecreased);

            await _mailingService.SendEmailAsync(new EmailDto(kudosLog.Employee.Email, subject, body));
        }