BetterFinds
Public Member Functions | Private Attributes | List of all members
BetterFinds.Utils.Notification Class Reference

Provides utility functions for handling notifications-related operations. More...

Public Member Functions

 Notification (IConfiguration configuration)
 Initializes a new instance of the Notification class. More...
 
void CreateNotification (int clientId, int auctionId, string message)
 Creates a new notification for the specified client. More...
 
List< Dictionary< string, object > > GetNotifications (int clientId)
 Returns a dictionary list of notifications for a specific client. More...
 
int GetNotificationsCount (int clientId)
 Returns the total number of notifications for a specific client. More...
 
int GetUnreadNotificationsCount (int clientId)
 Returns the number of unread notifications for a specific client. More...
 
void MarkAsRead (int clientId, int notificationId)
 Marks a notification as read. Used in the Pages.NotificationsModel page. More...
 
void MarkAllAsRead (int clientId)
 Marks all notifications as read. Used in the Pages.NotificationsModel page. More...
 

Private Attributes

readonly IConfiguration configuration
 The IConfiguration instance. More...
 

Detailed Description

Provides utility functions for handling notifications-related operations.

Constructor & Destructor Documentation

◆ Notification()

BetterFinds.Utils.Notification.Notification ( IConfiguration  configuration)

Initializes a new instance of the Notification class.

Parameters
configurationThe IConfiguration instance.

Member Function Documentation

◆ CreateNotification()

void BetterFinds.Utils.Notification.CreateNotification ( int  clientId,
int  auctionId,
string  message 
)
inline

Creates a new notification for the specified client.

Creates and inserts a new notification into the database.

A notification has the following properties:

  • NotificationId: The unique identifier of the notification.
  • Message: The message content of the notification.
  • Timestamp: The timestamp of the notification.
  • ClientId: The ClientId of the client.
  • AuctionId: The AuctionId of the auction related to the notification.
  • IsRead: A boolean value indicating whether the notification has been read. Default value: false.
Parameters
clientIdClientId of the client.
auctionIdAuctionId of the auction related to the notification.
messageThe message content of the notification.

◆ GetNotifications()

List<Dictionary<string, object> > BetterFinds.Utils.Notification.GetNotifications ( int  clientId)
inline

Returns a dictionary list of notifications for a specific client.

Parameters
clientIdThe ClientId of the client.

This method is used to display the notifications in the Pages.NotificationsModel page.

The dictionary returned by this method contains the following keys:

{
"NotificationId": int,
"Message": string,
"Timestamp": DateTime,
"IsRead": bool,
"AuctionId": int,
"ProductName": string,
"ProductPrice": decimal
}
Returns
A dictionary list of notifications for a specific client.

◆ GetNotificationsCount()

int BetterFinds.Utils.Notification.GetNotificationsCount ( int  clientId)
inline

Returns the total number of notifications for a specific client.

Currently not being used.

Parameters
clientIdThe ClientId of the client.
Returns
The total number of notifications for a specific client.

◆ GetUnreadNotificationsCount()

int BetterFinds.Utils.Notification.GetUnreadNotificationsCount ( int  clientId)
inline

Returns the number of unread notifications for a specific client.

This method is used to display the number of unread notifications in the navbar.

Parameters
clientIdThe ClientId of the client.
Returns
The number of unread notifications for a specific client.

◆ MarkAllAsRead()

void BetterFinds.Utils.Notification.MarkAllAsRead ( int  clientId)
inline

Marks all notifications as read. Used in the Pages.NotificationsModel page.

Parameters
clientIdThe ClientId of the client to mark all notifications as read.

◆ MarkAsRead()

void BetterFinds.Utils.Notification.MarkAsRead ( int  clientId,
int  notificationId 
)
inline

Marks a notification as read. Used in the Pages.NotificationsModel page.

Parameters
clientIdThe ClientId of the client to mark the notification as read.
notificationIdThe NotificationId of the notification to mark as read.

Member Data Documentation

◆ configuration

readonly IConfiguration BetterFinds.Utils.Notification.configuration
private

The IConfiguration instance.


The documentation for this class was generated from the following file: