Package com.masai.Dao

Interface BuyerDao

All Known Implementing Classes:
BuyerDaoImpl

public interface BuyerDao
  • Method Details

    • loginBuyer

      Buyer loginBuyer(String username, String password)
      Login as a buyer.
      Parameters:
      username - The buyer's username.
      password - The buyer's password.
      Returns:
      The Buyer object representing the logged-in buyer.
      Throws:
      InvalidCredentialsException - If the username or password is invalid.
    • getBalance

      double getBalance(String username)
      Retrieve buyer balance by username.
      Parameters:
      username - The username of the buyer.
      Returns:
      The balance of the buyer with the specified username.
    • getBuyerByUsername

      Buyer getBuyerByUsername(String username)
      Retrieve buyer details by username.
      Parameters:
      username - The username of the buyer.
      Returns:
      The Buyer object representing the buyer with the specified username.
    • registerNewBuyer

      String registerNewBuyer(Buyer u)
      Register a new buyer.
      Parameters:
      buyer - The Buyer object containing the buyer's information.
      Returns:
      A message indicating the success or failure of the registration process.
    • updateBuyerDetails

      String updateBuyerDetails(Buyer u)
      Update buyer details.
      Parameters:
      buyer - The Buyer object containing the updated buyer's information.
      Returns:
      A message indicating the success or failure of the update process.
    • getAllProductForSell

      ResultSet getAllProductForSell()
      Retrieve all products available for sale.
      Returns:
      A ResultSet containing information about all products available for sale.
      Throws:
      RecordNotFoundException - If no products for sale are found.
    • purchaseReturnItem

      boolean purchaseReturnItem(int productId, int quantity)
      Purchase return items.
      Parameters:
      productId - The ID of the product to return.
      quantity - Thequantity to return.
      Returns:
      True if the return is successful, False otherwise.
    • purchaseItem

      String purchaseItem(int productId, int quantity)
      Purchase an item.
      Parameters:
      productId - The ID of the product to purchase.
      quantity - The quantity to purchase.
      Returns:
      A message indicating the success or failure of the purchase process.
    • unhideTransactions

      boolean unhideTransactions(String username)
      Unhide buyer transactions .
      Parameters:
      username - The username of the buyer.
      Returns:
      True if the transactions are successfully unhidden, False otherwise.
    • hideTransactions

      boolean hideTransactions(String username)
      Hide buyer transactions .
      Parameters:
      username - The username of the buyer.
      Returns:
      True if the transactions are successfully hidden, False otherwise.
    • viewAllTransactions

      ResultSet viewAllTransactions()
      View all transactions.
      Returns:
      A ResultSet containing information about all transactions.
    • getAllProductsByCategory

      ResultSet getAllProductsByCategory(String item)
      Retrieve all products by category.
      Parameters:
      category - The category of the products.
      Returns:
      A ResultSet containing information about all products in the specified category.
      Throws:
      RecordNotFoundException - If no products are found in the specified category.
    • getProductsByProductId

      ResultSet getProductsByProductId(int id)
      Retrieve product by product ID.
      Parameters:
      id - The ID of the product.
      Returns:
      A ResultSet containing information about the product with the specified ID.
      Throws:
      RecordNotFoundException - If no product is found with the specified ID.
    • addAmountToBuyerBalance

      boolean addAmountToBuyerBalance(double amount, String unsername)
      Adds a specified amount to the buyer's balance.
      Parameters:
      amount - The amount to add to the buyer's balance.
      username - The username of the buyer.
      Returns:
      true if the balance was successfully updated, false otherwise.
    • deleteBuyer

      boolean deleteBuyer(String username, String password)
      Deletes a buyer based on their username and password.
      Parameters:
      username - The username of the buyer.
      password - The password of the buyer.
      Returns:
      true if the buyer was successfully deleted, false otherwise.
    • recoverBuyerAcount

      String recoverBuyerAcount(String username, String password, LocalDate date)
      Recovers a buyer's account based on their username, password, and recovery date.
      Parameters:
      username - The username of the buyer.
      password - The password of the buyer.
      date - The recovery date of the buyer's account.
      Returns:
      The recovered buyer account as a string.
    • getBuyerAllTransactionbyDateRange

      ResultSet getBuyerAllTransactionbyDateRange(LocalDate startDate, LocalDate endDate, String username) throws RecordNotFoundException
      Retrieves all transactions of a buyer within a specified date range.
      Parameters:
      startDate - The start date of the date range.
      endDate - The end date of the date range.
      username - The username of the buyer.
      Returns:
      A ResultSet containing the transactions within the date range.
      Throws:
      RecordNotFoundException - If no transactions are found within the specified date range.
    • getBuyerAllTransactionByPurchaseDate

      ResultSet getBuyerAllTransactionByPurchaseDate(String username) throws RecordNotFoundException
      Retrieves all transactions of a buyer based on the purchase date of the transactions.
      Parameters:
      username - The username of the buyer.
      Returns:
      A ResultSet containing the transactions.
      Throws:
      RecordNotFoundException - If no transactions are found for the buyer.
    • getBuyerAllTransactionByQuantity

      ResultSet getBuyerAllTransactionByQuantity(String username) throws RecordNotFoundException
      Retrieves all transactions of a buyer based on the quantity of the transactions.
      Parameters:
      username - The username of the buyer.
      Returns:
      A ResultSet containing the transactions.
      Throws:
      RecordNotFoundException - If no transactions are found for the buyer.
    • getBuyerAllTransactionByGSTPercentage

      ResultSet getBuyerAllTransactionByGSTPercentage(String username) throws RecordNotFoundException
      Retrieves all transactions of a buyer based on the GST percentage of the transactions.
      Parameters:
      username - The username of the buyer.
      Returns:
      A ResultSet containing the transactions.
      Throws:
      RecordNotFoundException - If no transactions are found for the buyer.
    • getBuyerAllTransactionByTotalPrice

      ResultSet getBuyerAllTransactionByTotalPrice(String username) throws RecordNotFoundException
      Retrieves all transactions of a buyer based on the total price of the transactions.
      Parameters:
      username - The username of the buyer.
      Returns:
      A ResultSet containing the transactions.
      Throws:
      RecordNotFoundException - If no transactions are found for the buyer.
    • getAllReturnProduct

      ResultSet getAllReturnProduct(String username)
      Retrieves all return products for a buyer.
      Parameters:
      username - The username of the buyer.
      Returns:
      A ResultSet containing the return products.
    • getAllReturnProductOfBuyerByType

      ResultSet getAllReturnProductOfBuyerByType(String username, String type)
      Retrieves all return products of a buyer by the specified type.
      Parameters:
      username - The username of the buyer.
      type - The type of return products to retrieve.
      Returns:
      A ResultSet containing the return products.