Examples of ProductManager


Examples of sg.edu.nus.iss.se07.bc.ProductManager

        public boolean addProduct(String id, String name, String description, int quantity, float price, String barcode, int reorderQty, int orderQty) throws AppException {
                boolean success = true;

                Product dataObject = new Product(id, name, description, quantity, price, barcode, reorderQty, orderQty);
                ProductManager dataObjectManager = new ProductManager();
                try {
                        success = dataObjectManager.addProduct(dataObject);
                } catch (AppException ex) {
                        //Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        //return false;
                }
View Full Code Here

Examples of sg.edu.nus.iss.se07.bc.ProductManager

        }

        public int getProductQty(String id) throws AppException {
                int qty = -99999;

                ProductManager dataObjectManager = new ProductManager();

                Product dataObject = null;
                try {
                        dataObject = dataObjectManager.selectProduct(id);
                } catch (AppException ex) {
                        //Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        return qty;
                }
View Full Code Here

Examples of sg.edu.nus.iss.se07.bc.ProductManager

         * @throws AppException
         */
        public boolean increaseProductQty(String id, int amount) throws AppException {
                boolean success = true;

                ProductManager dataObjectManager = new ProductManager();

                Product dataObject = null;
                try {
                        dataObject = dataObjectManager.selectProduct(id);
                } catch (AppException ex) {
                        //Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        return false;
                }

                if (dataObject != null) {

                        int currQty = dataObject.getQuantityAvailable();
                        int newQty = currQty + amount;

                        Product newDataObject = new Product();
                        newDataObject.setProductID(dataObject.getProductID());
                        newDataObject.setProductName(dataObject.getProductName());
                        newDataObject.setProductDescription(dataObject.getProductDescription());
                        newDataObject.setQuantityAvailable(newQty);
                        newDataObject.setProductPrice(dataObject.getProductPrice());
                        newDataObject.setBarcodeNumber(dataObject.getBarcodeNumber());
                        newDataObject.setReorderQuantity(dataObject.getReorderQuantity());
                        newDataObject.setOrderQuantity(dataObject.getOrderQuantity());

                        try {
                                success = dataObjectManager.updateProduct(dataObject, newDataObject);
                        } catch (AppException ex) {
                                //Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                                return false;
                        }

View Full Code Here

Examples of sg.edu.nus.iss.se07.bc.ProductManager

         * TO DO : Please do necessary change and test it !!!
         */
        public boolean decreaseProductQty(String id, int amount) throws AppException {
                boolean success = true;

                ProductManager dataObjectManager = new ProductManager();

                Product dataObject = null;
                try {
                        dataObject = dataObjectManager.selectProduct(id);
                } catch (AppException ex) {
                        //Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        return false;
                }

                if (dataObject != null) {

                        int currQty = dataObject.getQuantityAvailable();
                        int newQty = currQty - amount;

                        Product newDataObject = new Product();
                        newDataObject.setProductID(dataObject.getProductID());
                        newDataObject.setProductName(dataObject.getProductName());
                        newDataObject.setProductDescription(dataObject.getProductDescription());
                        newDataObject.setQuantityAvailable(newQty);
                        newDataObject.setProductPrice(dataObject.getProductPrice());
                        newDataObject.setBarcodeNumber(dataObject.getBarcodeNumber());
                        newDataObject.setReorderQuantity(dataObject.getReorderQuantity());
                        newDataObject.setOrderQuantity(dataObject.getOrderQuantity());

                        try {
                                success = dataObjectManager.updateProduct(dataObject, newDataObject);
                        } catch (AppException ex) {
                                //Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                                return false;
                        }

View Full Code Here

Examples of sg.edu.nus.iss.se07.bc.ProductManager

        }

        public ArrayList<Product> listProducts() throws AppException {
                ArrayList<Product> dataObjectSet = null;

                ProductManager productManager = new ProductManager();
                try {
                        dataObjectSet = productManager.listProducts();
                } catch (AppException ex) {
                        Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        throw ex;
                }
View Full Code Here

Examples of sg.edu.nus.iss.se07.bc.product.ProductManager

    public ProductRpt() {
    }

    public void generateReport()  {
                String reportFormat = "%1$3d\t%2$3s\t%3$s\n";
                ProductManager productManager = null;
                ProductSet productSet = null;
                try {
                        productManager = new ProductManager();
                        productSet = productManager.list();
                        if (productSet == null) {
                                return;
                        }
                        for (int i = 0; i < productSet.length(); i++) {
                                System.out.format(reportFormat, (i + 1),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.