Interface INotificationsController
Defines the methods to work with Notifications, NotificationTypes, NotificationTypeActions and NotificationActions.
Namespace: DotNetNuke.Services.Social.Notifications
Assembly: DotNetNuke.dll
Syntax
public interface INotificationsController
Methods
| Improve this Doc View SourceCountNotifications(Int32, Int32)
Counts the notifications sent to the provided user in the specified portal.
Declaration
int CountNotifications(int userId, int portalId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | userId | The user identifier. |
System.Int32 | portalId | The portal identifier. |
Returns
Type | Description |
---|---|
System.Int32 | The number of notifications sent to the provided user in the specified portal. |
CreateNotificationType(NotificationType)
Creates a new notification type.
Declaration
void CreateNotificationType(NotificationType notificationType)
Parameters
Type | Name | Description |
---|---|---|
NotificationType | notificationType |
DeleteAllNotificationRecipients(Int32)
Deletes all NotificationRecipient for the NotificationId.
Declaration
void DeleteAllNotificationRecipients(int notificationId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | notificationId | The notification identifier. |
Remarks
It also deletes the notification.
DeleteNotification(Int32)
Deletes an existing notification.
Declaration
void DeleteNotification(int notificationId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | notificationId | The notification identifier. |
Remarks
It does not delete NotificationRecipient.
DeleteNotificationRecipient(Int32, Int32)
Deletes an individual notification recipient.
Declaration
void DeleteNotificationRecipient(int notificationId, int userId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | notificationId | The notification identifier. |
System.Int32 | userId | The user identifier. |
Remarks
It also deletes the notification if there are no more recipients.
DeleteNotificationRecipient(Int32, String, Int32)
Deletes an individual notification recipient based on NotificationTypeId, Context and UserId.
Declaration
void DeleteNotificationRecipient(int notificationTypeId, string context, int userId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | notificationTypeId | Id of the notification type. |
System.String | context | Context set by creator of the notification. |
System.Int32 | userId | The user identifier. |
Remarks
It also deletes the notification if there are no more recipients.
DeleteNotificationType(Int32)
Deletes an existing notification type.
Declaration
void DeleteNotificationType(int notificationTypeId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | notificationTypeId | The notification type identifier. |
DeleteNotificationTypeAction(Int32)
Deletes an existing notification type action.
Declaration
void DeleteNotificationTypeAction(int notificationTypeActionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | notificationTypeActionId | The notification type action identifier. |
DeleteUserNotifications(UserInfo)
Deletes all user notifications in a specific portal.
Declaration
int DeleteUserNotifications(UserInfo user)
Parameters
Type | Name | Description |
---|---|---|
UserInfo | user | The user to delete notifications for. |
Returns
Type | Description |
---|---|
System.Int32 | Number of deleted notifications. |
GetNotification(Int32)
Get a Notification.
Declaration
Notification GetNotification(int notificationId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | notificationId | The notificationId. |
Returns
Type | Description |
---|---|
Notification | A notification. |
GetNotificationByContext(Int32, String)
Get a Notification by NotificationTypeId and Context.
Declaration
IList<Notification> GetNotificationByContext(int notificationTypeId, string context)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | notificationTypeId | Id of the notification type. |
System.String | context | Context set by creator of the notification. |
Returns
Type | Description |
---|---|
IList<Notification> | The filtered list of notifications sent to the provided user in the specified portal. |
GetNotifications(Int32, Int32, Int32, Int32)
Gets a list of notifications sent to the provided user in the specified portal.
Declaration
IList<Notification> GetNotifications(int userId, int portalId, int afterNotificationId, int numberOfRecords)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | userId | The user identifier. |
System.Int32 | portalId | The portal identifier. |
System.Int32 | afterNotificationId | The notification identifier of the last notification displayed. Use -1 to start from the beggining of the list. |
System.Int32 | numberOfRecords | The number of results to retrieve. |
Returns
Type | Description |
---|---|
IList<Notification> | The filtered list of notifications sent to the provided user in the specified portal. |
Examples
For example, if we have the following ordered notification identifiers: 4, 6, 2, 12, 45, and we pass 2 as the afterNotificationId and 2 as the numberOfRecords, the method will return the notifications 12 and 45.
| Improve this Doc View SourceGetNotificationType(Int32)
Gets a notification type by identifier.
Declaration
NotificationType GetNotificationType(int notificationTypeId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | notificationTypeId | The notification type identifier. |
Returns
Type | Description |
---|---|
NotificationType | The notification type with the provided identifier. |
GetNotificationType(String)
Gets a notification type by name.
Declaration
NotificationType GetNotificationType(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The notification type name. |
Returns
Type | Description |
---|---|
NotificationType | The notification type with the provided name. |
GetNotificationTypeAction(Int32, String)
Gets a notification type action by notification type and name.
Declaration
NotificationTypeAction GetNotificationTypeAction(int notificationTypeId, string name)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | notificationTypeId | The notification type identifier. |
System.String | name | The notification type action name. |
Returns
Type | Description |
---|---|
NotificationTypeAction | The notification type action with the provided notification type and name. |
GetNotificationTypeAction(Int32)
Gets a notification type action by identifier.
Declaration
NotificationTypeAction GetNotificationTypeAction(int notificationTypeActionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | notificationTypeActionId | The notification type action identifier. |
Returns
Type | Description |
---|---|
NotificationTypeAction | The notification type action with the provided identifier. |
GetNotificationTypeActions(Int32)
Gets the list of notification type actions for the provided notification type.
Declaration
IList<NotificationTypeAction> GetNotificationTypeActions(int notificationTypeId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | notificationTypeId | The notification type identifier. |
Returns
Type | Description |
---|---|
IList<NotificationTypeAction> | An ordered list of notification type actions for the provided notification type. |
GetToasts(UserInfo)
Get a list of Toasts that have not been delivered yet.
Declaration
IList<Notification> GetToasts(UserInfo userInfo)
Parameters
Type | Name | Description |
---|---|---|
UserInfo | userInfo | UserInfo object. |
Returns
Type | Description |
---|---|
IList<Notification> | List of Undelivered Toasts for the user specific to the portal. |
IsToastPending(Int32)
Is there a Toast that needs to be sent for a Notification.
Declaration
bool IsToastPending(int notificationId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | notificationId | The Notification Id. |
Returns
Type | Description |
---|---|
System.Boolean | True if Toast needs to be sent. False otherwise. |
MarkReadyForToast(Notification, UserInfo)
Mark a Toast ready for sending.
Declaration
void MarkReadyForToast(Notification notification, UserInfo userInfo)
Parameters
Type | Name | Description |
---|---|---|
Notification | notification | The notification Object. |
UserInfo | userInfo | The Recipient User Info Object. |
MarkToastSent(Int32, Int32)
Mark Toast being already sent.
Declaration
void MarkToastSent(int notificationId, int userId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | notificationId | The notification Id. |
System.Int32 | userId | The Recipient User Id. |
SendNotification(Notification, Int32, IList<RoleInfo>, IList<UserInfo>)
Creates a new notification and sets is sender as the portal administrator.
Declaration
void SendNotification(Notification notification, int portalId, IList<RoleInfo> roles, IList<UserInfo> users)
Parameters
Type | Name | Description |
---|---|---|
Notification | notification | The notification. |
System.Int32 | portalId | The portalId. |
IList<RoleInfo> | roles | The list of roles to send the notification to. Leave it as null to send only to individual users. |
IList<UserInfo> | users | The list of users to send the notification to. Leave it as null to send only to roles. |
SetNotificationTypeActions(IList<NotificationTypeAction>, Int32)
Set the actions for a NotificationType.
Declaration
void SetNotificationTypeActions(IList<NotificationTypeAction> actions, int notificationTypeId)
Parameters
Type | Name | Description |
---|---|---|
IList<NotificationTypeAction> | actions | The actions. |
System.Int32 | notificationTypeId | Id of the notification type. |