private void SendNotification(Request Record, ClaimsPrincipal user, string actionMessage, DateTime?reminderDate, bool isAchieved, string notificationType, string groupType, string notificationSubtype) { var notification = new NotificationEntryDTO() { Code = Record.Code, // this is important // The external ID of the notification record is the one of the Reqest // so we can easily link the two ExternalID = Record.ExternalID, Description = Record.Description, Duedate = reminderDate.Value, Enddate = reminderDate, ExpectedAction = actionMessage, ID = Record.ID, NotificationType = notificationType, NotificationSubtype = notificationSubtype, // this particular subscription is for a group of people SubscriptionGroup = groupType, //Salutation = user.FindFirst(c => c.Type.Contains("givenname"))?.Value ?? "team member", Startdate = DateTime.Today, // this is safe - users are identified by their email address //SubscriptionID = user.FindFirst(c => c.Type.Contains("emailaddress")).Value, URL = "" // TODO }; // if achieved, remove notification // otherwise add/update it var busChannel = isAchieved ? uPromis.Services.Queues.MessageBusQueueNames.REMOVENOTIFYITEM : uPromis.Services.Queues.MessageBusQueueNames.ADDNOTIFYITEM; SendMessageToNotificationServer(notification, busChannel); }
private async void SendMessageToNotificationServer(NotificationEntryDTO notification, string busChannel) { Uri uri = new("rabbitmq://localhost/" + busChannel); var endPoint = await NotificationServerBus.GetSendEndpoint(uri); await endPoint.Send(notification); }
partial void OnApplyBusinessRules(Models.NotificationEntry Record, NotificationEntryDTO DTORecord, ClaimsPrincipal user) { }