@Override public boolean delProductsCategory(String id) { if (id != null && id.trim().length() > 0) { ProductsCategory category = this.readProductsCategory(id); List<Products> list = this.productsDAO.readProductsList(id); if (category != null && list.size() == 0) { this.productsCategoryDAO.saveProductCategoryHql( "update ProductsCategory set status = 0 where id = '" + category.getId() + "'"); return true; } } return false; }
@Override public PageResult readAllPages(Integer pageSize, Integer currentPage, SearchFilter filter) { PageResult rows = this.productsCategoryDAO.readAllPages(pageSize, currentPage, filter); if (rows != null && rows.getRows().size() > 0) { List<ProductsCategory> list = new ArrayList<ProductsCategory>(); for (Object o : rows.getRows()) { ProductsCategory details = (ProductsCategory) o; String cid = details.getOperator().getChamber(); Chamber chamber = this.chamberDAO.readChamber(cid); if (chamber != null) details.setChamber(chamber.getName()); list.add(details); } rows.setRows(list); } return rows; }
@Override public boolean addProductsCategory(String id, String name, String navigtor, Operator operator) { ProductsCategory category = new ProductsCategory(); if (id != null && id.trim().length() > 0) { ProductsCategory $category = this.readProductsCategory(id); if ($category != null) { $category.setName(name); $category.setNavigtor(navigtor); category = $category; } } else { category.setOperator(operator); category.setNavigtor(navigtor); category.setName(name); } return this.productsCategoryDAO.saveProductCategory(category); }