Package com.masai.Dao
Class SellerDaoImpl
java.lang.Object
com.masai.Dao.SellerDaoImpl
- All Implemented Interfaces:
SellerDao
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
addSellerPendingAmount
(String username, double newPaidAmount) Adds a new pending amount to be paid to the seller.boolean
amountWithrowBySeller
(double amount, String unsername) Withdraws a specified amount from the seller's account balance.boolean
deleteSeller
(String username, String password) Deletes a seller based on their username and password.getAllSellerProducts
(String username) Retrieves all products of a seller.getAllSellerProductsOrderByPrice
(String username) Retrieves all seller products ordered by price.getAllSellerProductsOrderByQuantity
(String username) Retrieves all seller products ordered by quantity.getSellerAllProductsByCategory
(String item, String username) Retrieves all products of a seller belonging to a specific category.getSellerByUsername
(String username) Retrieves the seller details based on the username.double
getSellerIncome
(String username) Retrieves the income earned by the seller username.double
getSellerPendingAmount
(String username) Adds a new pending amount to be paid to the seller.getSellerProductsID
(String username) Retrieves the IDs of all products belonging to a seller.boolean
hideSellerProducts
(String username) Hides the products of a seller.loginSeller
(String username, String password) Validates the seller's login credentials.double
refundToBuyer
(int productId, int quantity) Initiates a refund to the buyer for a specific product and quantity.Registers a new seller.boolean
reopenSeller
(String username, String password) Reopens the seller's account after it was closed.boolean
sellerPaidPendingAmount
(double pendingAamount, String username, double income) Marks a pending amount as paid to the seller.boolean
unhideSellerProducts
(String username) Unhides the products of a seller.Updates the details of a seller.
-
Constructor Details
-
SellerDaoImpl
public SellerDaoImpl()
-
-
Method Details
-
loginSeller
Validates the seller's login credentials.- Specified by:
loginSeller
in interfaceSellerDao
- Parameters:
username
- The username of the seller.password
- The password of the seller.- Returns:
- The authenticated seller object.
-
getSellerIncome
Retrieves the income earned by the seller username.- Specified by:
getSellerIncome
in interfaceSellerDao
- Parameters:
username
- The username of the seller.- Returns:
- The total income of the seller.
-
refundToBuyer
public double refundToBuyer(int productId, int quantity) Initiates a refund to the buyer for a specific product and quantity.- Specified by:
refundToBuyer
in interfaceSellerDao
- Parameters:
productId
- The ID of the product to be refunded.quantity
- The quantity of the product to be refunded.- Returns:
- The refund amount.
-
getSellerByUsername
Retrieves the seller details based on the username.- Specified by:
getSellerByUsername
in interfaceSellerDao
- Parameters:
username
- The username of the seller.- Returns:
- The seller object.
-
updateSellerDetails
Updates the details of a seller.- Specified by:
updateSellerDetails
in interfaceSellerDao
- Parameters:
seller
- The updated seller object.- Returns:
- The updated seller details as a string.
-
registerNewSeller
Registers a new seller.- Specified by:
registerNewSeller
in interfaceSellerDao
- Parameters:
seller
- The seller object to register.- Returns:
- A success message upon successful registration.
-
getAllSellerProducts
Retrieves all products of a seller.- Specified by:
getAllSellerProducts
in interfaceSellerDao
- Parameters:
username
- The username of the seller.- Returns:
- A ResultSet containing all the products of the seller.
-
getAllSellerProductsOrderByQuantity
Retrieves all seller products ordered by quantity.- Specified by:
getAllSellerProductsOrderByQuantity
in interfaceSellerDao
- Parameters:
username
- The username of the seller.- Returns:
- A ResultSet containing the products.
-
unhideSellerProducts
Unhides the products of a seller.- Specified by:
unhideSellerProducts
in interfaceSellerDao
- Parameters:
username
- The username of the seller.- Returns:
true
if the products were successfully unhidden,false
otherwise.
-
hideSellerProducts
Hides the products of a seller.- Specified by:
hideSellerProducts
in interfaceSellerDao
- Parameters:
username
- The username of the seller.- Returns:
true
if the products were successfully hidden,false
otherwise.
-
getSellerAllProductsByCategory
Retrieves all products of a seller belonging to a specific category.- Specified by:
getSellerAllProductsByCategory
in interfaceSellerDao
- Parameters:
item
- The category of the products.username
- The username of the seller.- Returns:
- A ResultSet containing the products.
-
amountWithrowBySeller
Withdraws a specified amount from the seller's account balance.- Specified by:
amountWithrowBySeller
in interfaceSellerDao
- Parameters:
amount
- The amount to withdraw.username
- The username of the seller.- Returns:
true
if the withdrawal was successful,false
otherwise.
-
deleteSeller
Deletes a seller based on their username and password.- Specified by:
deleteSeller
in interfaceSellerDao
- Parameters:
username
- The username of the seller.password
- The password of the seller.- Returns:
true
if the seller was successfully deleted,false
otherwise.
-
reopenSeller
Reopens the seller's account after it was closed.- Specified by:
reopenSeller
in interfaceSellerDao
- Parameters:
username
- The username of the seller.password
- The password of the seller.- Returns:
true
if the seller's account was successfully reopened,false
otherwise.
-
getSellerPendingAmount
Adds a new pending amount to be paid to the seller.- Specified by:
getSellerPendingAmount
in interfaceSellerDao
- Parameters:
username
- The username of the seller.newPaidAmount
- The new pending amount to be paid.- Returns:
true
if the pending amount was successfully added,false
otherwise.
-
addSellerPendingAmount
Adds a new pending amount to be paid to the seller.- Specified by:
addSellerPendingAmount
in interfaceSellerDao
- Parameters:
username
- The username of the seller.newPaidAmount
- The new pending amount to be paid.- Returns:
true
if the pending amount was successfully added,false
otherwise.
-
getSellerProductsID
Retrieves the IDs of all products belonging to a seller.- Specified by:
getSellerProductsID
in interfaceSellerDao
- Parameters:
username
- The username of the seller.- Returns:
- A list of product IDs.
-
getAllSellerProductsOrderByPrice
Retrieves all seller products ordered by price.- Specified by:
getAllSellerProductsOrderByPrice
in interfaceSellerDao
- Parameters:
username
- The username of the seller.- Returns:
- A ResultSet containing the products.
-
sellerPaidPendingAmount
Marks a pending amount as paid to the seller.- Specified by:
sellerPaidPendingAmount
in interfaceSellerDao
- Parameters:
pendingAmount
- The pending amount to be paid.username
- The username of the seller.income
- The income earned by the- Returns:
true
if the pending amount was successfully marked as paid,false
otherwise.
-