Quipex icon

goods

Quipex | PRO | 06/06/17 02:32:00 AM UTC | 0 ⭐ | 406 👁️ | Never ⏰ | []
Java |

1.57 KB

|

None

|

0 👍

/

0 👎

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package classes;
 
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
 
/**
 *
 * @author User
 */
public class Goods {
    private int id_goods;
    private String name;
    private int shelf_life;
    private String date;
    private int numSales;
    private int numWarehouse;
    public Goods(int index) {
        try {
            id_goods = (int) Database.getRowFromTable("goods", "id_goods", index);
            name = (String) Database.getRowFromTable("goods", "name", index);
            shelf_life = (int) Database.getRowFromTable("goods", "shelf_life", index);
            
            date = (String) Database.getDate(id_goods);
            numSales = Database.getNumSales(id_goods);
            numWarehouse = Database.getNumWarehouse(id_goods) - numSales;
        } catch (ClassNotFoundException | SQLException ex) {
            Logger.getLogger(Goods.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    
    public String getName() {
        return name;
    }
 
    public int getShelf_life() {
        return shelf_life;
    }
 
    public int getNumSales() {
        return numSales;
    }
    public int getNumWarehouse() {
        return numWarehouse;
    }
 
    public String getDate() {
        return date;
    }
    public int getId_goods() {
        return id_goods;
    }
}

Comments