• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Improve this Doc

Class NotificationsController

Provides the methods to work with Notifications, NotificationTypes, NotificationTypeActions and NotificationActions.

Inheritance
System.Object
ServiceLocator<INotificationsController, NotificationsController>
NotificationsController
Implements
INotificationsController
Inherited Members
ServiceLocator<INotificationsController, NotificationsController>.Instance
ServiceLocator<INotificationsController, NotificationsController>.Factory
ServiceLocator<INotificationsController, NotificationsController>.SetTestableInstance(INotificationsController)
ServiceLocator<INotificationsController, NotificationsController>.ClearInstance()
ServiceLocator<INotificationsController, NotificationsController>.GetFactory()
Namespace: DotNetNuke.Services.Social.Notifications
Assembly: DotNetNuke.dll
Syntax
public class NotificationsController : ServiceLocator<INotificationsController, NotificationsController>, INotificationsController

Constructors

| Improve this Doc View Source

NotificationsController()

Initializes a new instance of the NotificationsController class. Default constructor.

Declaration
public NotificationsController()
| Improve this Doc View Source

NotificationsController(IDataService, IDataService)

Initializes a new instance of the NotificationsController class. Constructor from specifict data service.

Declaration
public NotificationsController(IDataService dataService, IDataService messagingDataService)
Parameters
Type Name Description
IDataService dataService

Class with methods to do CRUD in database for the entities of types NotificationType, NotificationTypeAction and Notification.

IDataService messagingDataService

Class with methods to do CRUD in database for the entities of types Message, MessageRecipient and MessageAttachment and to interact with the stored procedures regarding messaging.

Methods

| Improve this Doc View Source

CountNotifications(Int32, Int32)

Counts the notifications sent to the provided user in the specified portal.

Declaration
public virtual 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.

| Improve this Doc View Source

CreateNotificationType(NotificationType)

Creates a new notification type.

Declaration
public void CreateNotificationType(NotificationType notificationType)
Parameters
Type Name Description
NotificationType notificationType
| Improve this Doc View Source

DeleteAllNotificationRecipients(Int32)

Deletes all NotificationRecipient for the NotificationId.

Declaration
public virtual void DeleteAllNotificationRecipients(int notificationId)
Parameters
Type Name Description
System.Int32 notificationId

The notification identifier.

Remarks

It also deletes the notification.

| Improve this Doc View Source

DeleteNotification(Int32)

Deletes an existing notification.

Declaration
public virtual void DeleteNotification(int notificationId)
Parameters
Type Name Description
System.Int32 notificationId

The notification identifier.

Remarks

It does not delete NotificationRecipient.

| Improve this Doc View Source

DeleteNotificationRecipient(Int32, Int32)

Deletes an individual notification recipient.

Declaration
public virtual 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.

| Improve this Doc View Source

DeleteNotificationRecipient(Int32, String, Int32)

Deletes an individual notification recipient based on NotificationTypeId, Context and UserId.

Declaration
public virtual 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.

| Improve this Doc View Source

DeleteNotificationType(Int32)

Deletes an existing notification type.

Declaration
public virtual void DeleteNotificationType(int notificationTypeId)
Parameters
Type Name Description
System.Int32 notificationTypeId

The notification type identifier.

| Improve this Doc View Source

DeleteNotificationTypeAction(Int32)

Deletes an existing notification type action.

Declaration
public virtual void DeleteNotificationTypeAction(int notificationTypeActionId)
Parameters
Type Name Description
System.Int32 notificationTypeActionId

The notification type action identifier.

| Improve this Doc View Source

DeleteUserNotifications(UserInfo)

Deletes all user notifications in a specific portal.

Declaration
public 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.

| Improve this Doc View Source

GetFactory()

Gets the service locator factory.

Declaration
protected override Func<INotificationsController> GetFactory()
Returns
Type Description
Func<INotificationsController>

A factory function.

Overrides
DotNetNuke.Framework.ServiceLocator<DotNetNuke.Services.Social.Notifications.INotificationsController, DotNetNuke.Services.Social.Notifications.NotificationsController>.GetFactory()
| Improve this Doc View Source

GetNotification(Int32)

Get a Notification.

Declaration
public Notification GetNotification(int notificationId)
Parameters
Type Name Description
System.Int32 notificationId

The notificationId.

Returns
Type Description
Notification

A notification.

| Improve this Doc View Source

GetNotificationByContext(Int32, String)

Get a Notification by NotificationTypeId and Context.

Declaration
public virtual 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.

| Improve this Doc View Source

GetNotifications(Int32, Int32, Int32, Int32)

Gets a list of notifications sent to the provided user in the specified portal.

Declaration
public virtual 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.

| Improve this Doc View Source

GetNotificationType(Int32)

Gets a notification type by identifier.

Declaration
public virtual 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.

| Improve this Doc View Source

GetNotificationType(String)

Gets a notification type by name.

Declaration
public virtual 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.

| Improve this Doc View Source

GetNotificationTypeAction(Int32, String)

Gets a notification type action by notification type and name.

Declaration
public virtual 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.

| Improve this Doc View Source

GetNotificationTypeAction(Int32)

Gets a notification type action by identifier.

Declaration
public virtual 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.

| Improve this Doc View Source

GetNotificationTypeActions(Int32)

Gets the list of notification type actions for the provided notification type.

Declaration
public virtual 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.

| Improve this Doc View Source

GetToasts(UserInfo)

Get a list of Toasts that have not been delivered yet.

Declaration
public 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.

| Improve this Doc View Source

IsToastPending(Int32)

Is there a Toast that needs to be sent for a Notification.

Declaration
public 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.

| Improve this Doc View Source

MarkReadyForToast(Notification, UserInfo)

Mark a Toast ready for sending.

Declaration
public void MarkReadyForToast(Notification notification, UserInfo userInfo)
Parameters
Type Name Description
Notification notification

The notification Object.

UserInfo userInfo

The Recipient User Info Object.

| Improve this Doc View Source

MarkReadyForToast(Notification, Int32)

Provides the methods to work with Notifications, NotificationTypes, NotificationTypeActions and NotificationActions.

Declaration
public void MarkReadyForToast(Notification notification, int userId)
Parameters
Type Name Description
Notification notification
System.Int32 userId
| Improve this Doc View Source

MarkToastSent(Int32, Int32)

Mark Toast being already sent.

Declaration
public void MarkToastSent(int notificationId, int userId)
Parameters
Type Name Description
System.Int32 notificationId

The notification Id.

System.Int32 userId

The Recipient User Id.

| Improve this Doc View Source

SendNotification(Notification, Int32, IList<RoleInfo>, IList<UserInfo>)

Creates a new notification and sets is sender as the portal administrator.

Declaration
public virtual 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.

| Improve this Doc View Source

SetNotificationTypeActions(IList<NotificationTypeAction>, Int32)

Set the actions for a NotificationType.

Declaration
public void SetNotificationTypeActions(IList<NotificationTypeAction> actions, int notificationTypeId)
Parameters
Type Name Description
IList<NotificationTypeAction> actions

The actions.

System.Int32 notificationTypeId

Id of the notification type.

Implements

INotificationsController

Extension Methods

JsonExtensionsWeb.ToJson(Object)
  • View Source
Back to top by the community, for the community... #DNNCMS