Package com.masai.Dao
Class ProductDaoImpl
java.lang.Object
com.masai.Dao.ProductDaoImpl
- All Implemented Interfaces:
ProductDao
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddProductBySeller(Product product) Adds a new product by a seller.intgetGStPercentage(int productId) Retrieves the GST percentage of a product based on its product ID.getProductById(int productId) Retrieves a product based on its product ID.intgetProductIdByCategoryName(String catgoryName) Retrieves the product ID based on the category name.booleanreturnProduct(ReturnProduct returnProduct) Processes the return of a product.booleanupdateProductBySeller(Product product, int id) Updates a product by a seller.booleanupdateQuantity(int productId, int quantity) Updates the quantity of a product based on its product ID.
-
Constructor Details
-
ProductDaoImpl
public ProductDaoImpl()
-
-
Method Details
-
updateQuantity
public boolean updateQuantity(int productId, int quantity) Updates the quantity of a product based on its product ID.- Specified by:
updateQuantityin interfaceProductDao- Parameters:
productId- The ID of the product.quantity- The new quantity of the product.- Returns:
trueif the quantity was successfully updated,falseotherwise.
-
getGStPercentage
public int getGStPercentage(int productId) Retrieves the GST percentage of a product based on its product ID.- Specified by:
getGStPercentagein interfaceProductDao- Parameters:
productId- The ID of the product.- Returns:
- The GST percentage of the product.
-
getProductById
Retrieves a product based on its product ID.- Specified by:
getProductByIdin interfaceProductDao- Parameters:
productId- The ID of the product.- Returns:
- The product object.
-
updateProductBySeller
Updates a product by a seller.- Specified by:
updateProductBySellerin interfaceProductDao- Parameters:
product- The updated product object.id- The ID of the product to update.- Returns:
trueif the product was successfully updated,falseotherwise.
-
addProductBySeller
Adds a new product by a seller.- Specified by:
addProductBySellerin interfaceProductDao- Parameters:
product- The product object to add.- Returns:
trueif the product was successfully added,falseotherwise.
-
getProductIdByCategoryName
Retrieves the product ID based on the category name.- Specified by:
getProductIdByCategoryNamein interfaceProductDao- Parameters:
categoryName- The name of the category.- Returns:
- The product ID associated with the category.
-
returnProduct
Processes the return of a product.- Specified by:
returnProductin interfaceProductDao- Parameters:
returnProduct- The return product object.- Returns:
trueif the return was successfully processed,falseotherwise.
-