public async Task <ActionResult> SendPrivateMessageAsync([FromBody] SendPrivateMessageRequest Request)
        {
            if (Request == null)
            {
                return(BadRequest());
            }

            return(Json(await _privateMessageService.SendPrivateMessageAsync(Request)));
        }
        public async Task <ActionResult> SendPrivateMessageAsync([FromBody] SendPrivateMessageRequest Request)
        {
            if (Request == null)
            {
                return(BadRequest());
            }

            if (_apiPrincipal.IsAttendee)
            {
                Request.AuthorName = _apiPrincipal.GivenName;
            }

            return(Json(await _privateMessageService.SendPrivateMessageAsync(Request, _apiPrincipal.Uid)));
        }
Exemplo n.º 3
0
        public async Task <Guid> SendPrivateMessageAsync(SendPrivateMessageRequest request)
        {
            var entity = new PrivateMessageRecord
            {
                AuthorName         = request.AuthorName,
                RecipientUid       = request.RecipientUid,
                Message            = request.Message,
                Subject            = request.Subject,
                CreatedDateTimeUtc = DateTime.UtcNow
            };

            entity.NewId();

            await InsertOneAsync(entity);

            await _pushEventMediator.PushPrivateMessageNotificationAsync(
                request.RecipientUid, request.ToastTitle, request.ToastMessage);

            return(entity.Id);
        }
        private async Task SendItemsSoldNotificationAsync(string recipientUid, IList <ItemActivityRecord> items)
        {
            var title   = $"You have won {items.Count} item(s) from the Art Show";
            var message = new StringBuilder();

            message.AppendLine(
                $"Congratulations! You have won {items.Count} item(s) from the Art Show:\n");

            foreach (var item in items)
            {
                message.AppendLine($"{item.ASIDNO}: \"{item.ArtPieceTitle}\" by \"{item.ArtistName}\"");
            }

            message.AppendLine("\nPlease pick them up at the Art Show during sales hours (these are announced in the event schedule and can be found both in your con book or the mobile app).\n\nThank you!");

            var request = new SendPrivateMessageRequest()
            {
                AuthorName   = "Art Show",
                Subject      = title,
                Message      = message.ToString(),
                RecipientUid = recipientUid,
                ToastTitle   = "Art Show Results",
                ToastMessage = title
            };

            var privateMessageId = await _privateMessageService.SendPrivateMessageAsync(request);

            var now = DateTime.UtcNow;

            foreach (var item in items)
            {
                item.PrivateMessageId        = privateMessageId;
                item.NotificationDateTimeUtc = now;
                await _itemActivityRepository.ReplaceOneAsync(item);
            }
        }
        private async Task SendItemsToAuctionNotificationAsync(string recipientUid, IList <ItemActivityRecord> items)
        {
            var title   = $"{items.Count} item(s) will participate in the auction";
            var message = new StringBuilder();

            message.AppendLine(
                $"{items.Count} item(s) on which you have been the last bidder will be part of the auction.\n");

            foreach (var item in items)
            {
                message.AppendLine($"{item.ASIDNO}: \"{item.ArtPieceTitle}\" by \"{item.ArtistName}\"");
            }

            message.AppendLine("\nIf you wish to defend your current bids against other potential higher bids, please attend the auction.\n\nThank you!");

            var request = new SendPrivateMessageRequest()
            {
                AuthorName   = "Art Show",
                Subject      = title,
                Message      = message.ToString(),
                RecipientUid = recipientUid,
                ToastTitle   = "Art Show Results",
                ToastMessage = title
            };

            var privateMessageId = await _privateMessageService.SendPrivateMessageAsync(request);

            var now = DateTime.UtcNow;

            foreach (var item in items)
            {
                item.PrivateMessageId        = privateMessageId;
                item.NotificationDateTimeUtc = now;
                await _itemActivityRepository.ReplaceOneAsync(item);
            }
        }
Exemplo n.º 6
0
 public void SendPrivateMessage(SendPrivateMessageRequest sendPrivateMessagepRequest)
 {
     SendRequest(sendPrivateMessagepRequest.ToXML());
 }