Package com.masai.Dao
Class SellerDaoImpl
java.lang.Object
com.masai.Dao.SellerDaoImpl
- All Implemented Interfaces:
SellerDao
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddSellerPendingAmount(String username, double newPaidAmount) Adds a new pending amount to be paid to the seller.booleanamountWithrowBySeller(double amount, String unsername) Withdraws a specified amount from the seller's account balance.booleandeleteSeller(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.doublegetSellerIncome(String username) Retrieves the income earned by the seller username.doublegetSellerPendingAmount(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.booleanhideSellerProducts(String username) Hides the products of a seller.loginSeller(String username, String password) Validates the seller's login credentials.doublerefundToBuyer(int productId, int quantity) Initiates a refund to the buyer for a specific product and quantity.Registers a new seller.booleanreopenSeller(String username, String password) Reopens the seller's account after it was closed.booleansellerPaidPendingAmount(double pendingAamount, String username, double income) Marks a pending amount as paid to the seller.booleanunhideSellerProducts(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:
loginSellerin 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:
getSellerIncomein 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:
refundToBuyerin 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:
getSellerByUsernamein interfaceSellerDao- Parameters:
username- The username of the seller.- Returns:
- The seller object.
-
updateSellerDetails
Updates the details of a seller.- Specified by:
updateSellerDetailsin interfaceSellerDao- Parameters:
seller- The updated seller object.- Returns:
- The updated seller details as a string.
-
registerNewSeller
Registers a new seller.- Specified by:
registerNewSellerin interfaceSellerDao- Parameters:
seller- The seller object to register.- Returns:
- A success message upon successful registration.
-
getAllSellerProducts
Retrieves all products of a seller.- Specified by:
getAllSellerProductsin 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:
getAllSellerProductsOrderByQuantityin interfaceSellerDao- Parameters:
username- The username of the seller.- Returns:
- A ResultSet containing the products.
-
unhideSellerProducts
Unhides the products of a seller.- Specified by:
unhideSellerProductsin interfaceSellerDao- Parameters:
username- The username of the seller.- Returns:
trueif the products were successfully unhidden,falseotherwise.
-
hideSellerProducts
Hides the products of a seller.- Specified by:
hideSellerProductsin interfaceSellerDao- Parameters:
username- The username of the seller.- Returns:
trueif the products were successfully hidden,falseotherwise.
-
getSellerAllProductsByCategory
Retrieves all products of a seller belonging to a specific category.- Specified by:
getSellerAllProductsByCategoryin 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:
amountWithrowBySellerin interfaceSellerDao- Parameters:
amount- The amount to withdraw.username- The username of the seller.- Returns:
trueif the withdrawal was successful,falseotherwise.
-
deleteSeller
Deletes a seller based on their username and password.- Specified by:
deleteSellerin interfaceSellerDao- Parameters:
username- The username of the seller.password- The password of the seller.- Returns:
trueif the seller was successfully deleted,falseotherwise.
-
reopenSeller
Reopens the seller's account after it was closed.- Specified by:
reopenSellerin interfaceSellerDao- Parameters:
username- The username of the seller.password- The password of the seller.- Returns:
trueif the seller's account was successfully reopened,falseotherwise.
-
getSellerPendingAmount
Adds a new pending amount to be paid to the seller.- Specified by:
getSellerPendingAmountin interfaceSellerDao- Parameters:
username- The username of the seller.newPaidAmount- The new pending amount to be paid.- Returns:
trueif the pending amount was successfully added,falseotherwise.
-
addSellerPendingAmount
Adds a new pending amount to be paid to the seller.- Specified by:
addSellerPendingAmountin interfaceSellerDao- Parameters:
username- The username of the seller.newPaidAmount- The new pending amount to be paid.- Returns:
trueif the pending amount was successfully added,falseotherwise.
-
getSellerProductsID
Retrieves the IDs of all products belonging to a seller.- Specified by:
getSellerProductsIDin interfaceSellerDao- Parameters:
username- The username of the seller.- Returns:
- A list of product IDs.
-
getAllSellerProductsOrderByPrice
Retrieves all seller products ordered by price.- Specified by:
getAllSellerProductsOrderByPricein 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:
sellerPaidPendingAmountin interfaceSellerDao- Parameters:
pendingAmount- The pending amount to be paid.username- The username of the seller.income- The income earned by the- Returns:
trueif the pending amount was successfully marked as paid,falseotherwise.
-