Quipex

goods

Jun 5th, 2017
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.57 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package classes;
  7.  
  8. import java.sql.SQLException;
  9. import java.util.logging.Level;
  10. import java.util.logging.Logger;
  11.  
  12. /**
  13.  *
  14.  * @author User
  15.  */
  16. public class Goods {
  17.     private int id_goods;
  18.     private String name;
  19.     private int shelf_life;
  20.     private String date;
  21.     private int numSales;
  22.     private int numWarehouse;
  23.     public Goods(int index) {
  24.         try {
  25.             id_goods = (int) Database.getRowFromTable("goods", "id_goods", index);
  26.             name = (String) Database.getRowFromTable("goods", "name", index);
  27.             shelf_life = (int) Database.getRowFromTable("goods", "shelf_life", index);
  28.            
  29.             date = (String) Database.getDate(id_goods);
  30.             numSales = Database.getNumSales(id_goods);
  31.             numWarehouse = Database.getNumWarehouse(id_goods) - numSales;
  32.         } catch (ClassNotFoundException | SQLException ex) {
  33.             Logger.getLogger(Goods.class.getName()).log(Level.SEVERE, null, ex);
  34.         }
  35.     }
  36.    
  37.    
  38.     public String getName() {
  39.         return name;
  40.     }
  41.  
  42.     public int getShelf_life() {
  43.         return shelf_life;
  44.     }
  45.  
  46.     public int getNumSales() {
  47.         return numSales;
  48.     }
  49.     public int getNumWarehouse() {
  50.         return numWarehouse;
  51.     }
  52.  
  53.     public String getDate() {
  54.         return date;
  55.     }
  56.     public int getId_goods() {
  57.         return id_goods;
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment