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

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

Public Member Functions

 Bids (IConfiguration configuration)
 Initializes a new instance of the Bids class. More...
 
async Task CreateBidderGroupAsync ()
 Creates a dictionary of auctions and their bidders asynchonously. More...
 
async Task AddBidderToBidderGroupAsync (int clientId, int auctionId)
 Adds a bidder to the biddersGroup dictionary asynchonously. More...
 
List< int > GetBiddersFromAuction (int auctionId)
 Returns a list of bidders from the specified auction. More...
 
List< Dictionary< int, List< Dictionary< string, object > > > > GetClientBids (int clientId)
 Returns a list of bidders organized by auction. More...
 
void PrintBiddersGroup ()
 Prints the biddersGroup dictionary. More...
 

Properties

static Dictionary< int, List< int > > BiddersGroup = [] [get, set]
 The dictionary of auctions and their bidders. More...
 

Private Attributes

readonly IConfiguration configuration
 The IConfiguration instance. More...
 

Detailed Description

Provides utility functions for handling bids-related operations.

Constructor & Destructor Documentation

◆ Bids()

BetterFinds.Utils.Bids.Bids ( IConfiguration  configuration)

Initializes a new instance of the Bids class.

Parameters
configurationThe IConfiguration instance.

Member Function Documentation

◆ AddBidderToBidderGroupAsync()

async Task BetterFinds.Utils.Bids.AddBidderToBidderGroupAsync ( int  clientId,
int  auctionId 
)
inline

Adds a bidder to the biddersGroup dictionary asynchonously.

Used to add a bidder to the biddersGroup dictionary when a bid is placed.

The dictionary is stored in the BiddersGroup property.

Parameters
clientIdThe ClientId of the bidder.
auctionIdThe AuctionId related to the bid.
Returns
A task that represents the asynchronous operation.

◆ CreateBidderGroupAsync()

async Task BetterFinds.Utils.Bids.CreateBidderGroupAsync ( )
inline

Creates a dictionary of auctions and their bidders asynchonously.

This method is called from Program when the application starts.

It retrieves all bids from the database and creates a dictionary of auctions and their bidders.

The dictionary is stored in the BiddersGroup property.

Returns
A task that represents the asynchronous operation.

◆ GetBiddersFromAuction()

List<int> BetterFinds.Utils.Bids.GetBiddersFromAuction ( int  auctionId)
inline

Returns a list of bidders from the specified auction.

Used to get a list of bidders to notify from the specified auction.

If the auctionId is not present in the dictionary, it returns an empty list.

The dictionary is stored in the BiddersGroup property.

Parameters
auctionIdThe AuctionId to get bidders from.
Returns
A list of bidders from the specified auction.

◆ GetClientBids()

List<Dictionary<int, List<Dictionary<string, object> > > > BetterFinds.Utils.Bids.GetClientBids ( int  clientId)
inline

Returns a list of bidders organized by auction.

Used to get a list of bidders organized by auction in the Pages.MyBidsModel page.

The list is structured as follows:

  • Key: AuctionId
  • Value: List of dictionaries containing the bid information

The dictionaries containing the bid information are structured as follows:

  • BidTime: The time the bid was placed
  • BidValue: The value of the bid
  • ProductName: The name of the product
Parameters
clientIdThe ClientId of the client to get bids organized by auction from.
Returns
A list of bids organized by auction.

◆ PrintBiddersGroup()

void BetterFinds.Utils.Bids.PrintBiddersGroup ( )
inline

Prints the biddersGroup dictionary.

Used for debugging purposes.

Prints the contents of the BiddersGroup dictionary.

Member Data Documentation

◆ configuration

readonly IConfiguration BetterFinds.Utils.Bids.configuration
private

The IConfiguration instance.

Property Documentation

◆ BiddersGroup

Dictionary<int, List<int> > BetterFinds.Utils.Bids.BiddersGroup = []
staticgetsetprivate

The dictionary of auctions and their bidders.

This property can only be set from within the class.

This dictionary BiddersGroup is initialized when the application starts.

Used to notify clients when a bid is placed on an auction they are participating in.

Dictionary structure:

  • Key: AuctionId
  • Value: List of ClientId's

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