Package com.masai.Dao

Class ProductDaoImpl

java.lang.Object
com.masai.Dao.ProductDaoImpl
All Implemented Interfaces:
ProductDao

public class ProductDaoImpl extends Object implements ProductDao
  • 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:
      updateQuantity in interface ProductDao
      Parameters:
      productId - The ID of the product.
      quantity - The new quantity of the product.
      Returns:
      true if the quantity was successfully updated, false otherwise.
    • getGStPercentage

      public int getGStPercentage(int productId)
      Retrieves the GST percentage of a product based on its product ID.
      Specified by:
      getGStPercentage in interface ProductDao
      Parameters:
      productId - The ID of the product.
      Returns:
      The GST percentage of the product.
    • getProductById

      public Product getProductById(int productId)
      Retrieves a product based on its product ID.
      Specified by:
      getProductById in interface ProductDao
      Parameters:
      productId - The ID of the product.
      Returns:
      The product object.
    • updateProductBySeller

      public boolean updateProductBySeller(Product product, int id)
      Updates a product by a seller.
      Specified by:
      updateProductBySeller in interface ProductDao
      Parameters:
      product - The updated product object.
      id - The ID of the product to update.
      Returns:
      true if the product was successfully updated, false otherwise.
    • addProductBySeller

      public boolean addProductBySeller(Product product)
      Adds a new product by a seller.
      Specified by:
      addProductBySeller in interface ProductDao
      Parameters:
      product - The product object to add.
      Returns:
      true if the product was successfully added, false otherwise.
    • getProductIdByCategoryName

      public int getProductIdByCategoryName(String catgoryName)
      Retrieves the product ID based on the category name.
      Specified by:
      getProductIdByCategoryName in interface ProductDao
      Parameters:
      categoryName - The name of the category.
      Returns:
      The product ID associated with the category.
    • returnProduct

      public boolean returnProduct(ReturnProduct returnProduct)
      Processes the return of a product.
      Specified by:
      returnProduct in interface ProductDao
      Parameters:
      returnProduct - The return product object.
      Returns:
      true if the return was successfully processed, false otherwise.