Exemplo n.º 1
0
        public UpdateRecipientsResponse UpdateRecipients(UpdateRecipientsRequest request)
        {
            VerifyPermission(Permissions.Send, Modules.MassMessageTool);
            request.IpAddress = HttpContext.Current.Request.UserHostAddress;
            var validationResult = _massMessageQueries.GetValidationResult(request);

            if (!validationResult.IsValid)
            {
                return(ValidationErrorResponse <UpdateRecipientsResponse>(validationResult));
            }

            var response = _massMessageCommands.UpdateRecipients(request);

            return(response);
        }
Exemplo n.º 2
0
        private void SendMassMessage(Guid brandId, string subject, string content)
        {
            var updateRecipientsResponse = _massMessageCommands.UpdateRecipients(new UpdateRecipientsRequest
            {
                UpdateRecipientsType = UpdateRecipientsType.SearchResultSelectAll,
                SearchPlayersRequest = new SearchPlayersRequest
                {
                    BrandId = brandId
                }
            });

            _massMessageCommands.Send(new SendMassMessageRequest
            {
                Id      = updateRecipientsResponse.Id,
                Content = updateRecipientsResponse.Languages.Select(x => new SendMassMessageContent
                {
                    LanguageCode  = x.Code,
                    OnSite        = true,
                    OnSiteSubject = subject,
                    OnSiteContent = content
                }).ToArray()
            });
        }