diff --git a/build/web/WEB-INF/classes/DAO/MagasinHelper.class b/build/web/WEB-INF/classes/DAO/MagasinHelper.class
index 9e73c1a..e3f950b 100644
Binary files a/build/web/WEB-INF/classes/DAO/MagasinHelper.class and b/build/web/WEB-INF/classes/DAO/MagasinHelper.class differ
diff --git a/build/web/WEB-INF/classes/controller/BddController.class b/build/web/WEB-INF/classes/controller/BddController.class
index d297444..f1b11c0 100644
Binary files a/build/web/WEB-INF/classes/controller/BddController.class and b/build/web/WEB-INF/classes/controller/BddController.class differ
diff --git a/build/web/WEB-INF/classes/jsp/detail.jsp b/build/web/WEB-INF/classes/jsp/detail.jsp
index 398d510..25094f9 100644
--- a/build/web/WEB-INF/classes/jsp/detail.jsp
+++ b/build/web/WEB-INF/classes/jsp/detail.jsp
@@ -56,11 +56,19 @@
-
+
-
+
@@ -76,13 +84,56 @@
-
+ checked id="available" />
+
+ result: ${result}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/web/WEB-INF/jsp/detail.jsp b/build/web/WEB-INF/jsp/detail.jsp
index 398d510..17956f9 100644
--- a/build/web/WEB-INF/jsp/detail.jsp
+++ b/build/web/WEB-INF/jsp/detail.jsp
@@ -56,11 +56,19 @@
-
+
-
+
@@ -76,13 +84,55 @@
-
+ checked id="available" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml
index e9dbd15..eb512d4 100644
--- a/nbproject/private/private.xml
+++ b/nbproject/private/private.xml
@@ -3,8 +3,7 @@
- file:/C:/Users/flifloo/Nextcloud/IUT/JEE/JEE%20Project/Code/src/java/DAO/Product.hbm.xml
- file:/C:/Users/flifloo/Nextcloud/IUT/JEE/JEE%20Project/Code/web/WEB-INF/jsp/menu.jsp
+ file:/C:/Users/flifloo/Nextcloud/IUT/JEE/JEE%20Project/Code/web/WEB-INF/jsp/detail.jsp
file:/C:/Users/flifloo/Nextcloud/IUT/JEE/JEE%20Project/Code/web/WEB-INF/jsp/resultat.jsp
file:/C:/Users/flifloo/Nextcloud/IUT/JEE/JEE%20Project/Code/src/java/controller/BddController.java
file:/C:/Users/flifloo/Nextcloud/IUT/JEE/JEE%20Project/Code/src/java/DAO/MagasinHelper.java
diff --git a/src/java/DAO/MagasinHelper.java b/src/java/DAO/MagasinHelper.java
index a0066e0..c766991 100644
--- a/src/java/DAO/MagasinHelper.java
+++ b/src/java/DAO/MagasinHelper.java
@@ -25,7 +25,7 @@ public class MagasinHelper {
this.session = HibernateUtil.getSessionFactory().openSession();
}
- public List getProducts(){
+ public List getProductsColums(){
List resultat=null;
Transaction tx=null;
try{
@@ -46,6 +46,27 @@ public class MagasinHelper {
return resultat;
}
+ public List getProducts(){
+ List resultat=null;
+ Transaction tx=null;
+ try{
+ if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession();
+ session.flush();
+
+ tx=session.beginTransaction();
+ Query q=session.createQuery("from Product p");
+ resultat=q.list();
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally{
+ if (session.isOpen())session.close();
+ }
+
+ return resultat;
+ }
+
public Product getProduct(int id){
Product resultat=null;
Transaction tx=null;
@@ -68,7 +89,7 @@ public class MagasinHelper {
return resultat;
}
- public List getClients(){
+ public List getClientsColums(){
List resultat=null;
Transaction tx=null;
try{
@@ -91,6 +112,30 @@ public class MagasinHelper {
return resultat;
}
+
+ public List getClients(){
+ List resultat=null;
+ Transaction tx=null;
+ try{
+ if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession();
+ session.flush();
+
+ tx=session.beginTransaction();
+ Query q=session.createQuery("from Customer c");
+ resultat=q.list();
+
+
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ finally{
+ if (session.isOpen())session.close();
+ }
+
+ return resultat;
+}
+
public List getClients(String name){
List resultat=null;
Transaction tx=null;
@@ -113,6 +158,48 @@ public class MagasinHelper {
return resultat;
}
+
+ public List getManufacturers(){
+ List resultat=null;
+ Transaction tx=null;
+ try{
+ if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession();
+ session.flush();
+
+ tx=session.beginTransaction();
+ Query q=session.createQuery("from Manufacturer m");
+ resultat=q.list();
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally{
+ if (session.isOpen())session.close();
+ }
+
+ return resultat;
+ }
+
+ public List getProductCodes(){
+ List resultat=null;
+ Transaction tx=null;
+ try{
+ if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession();
+ session.flush();
+
+ tx=session.beginTransaction();
+ Query q=session.createQuery("from ProductCode p");
+ resultat=q.list();
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally{
+ if (session.isOpen())session.close();
+ }
+
+ return resultat;
+ }
public List getDiscountCode(){
List resultat=null;
@@ -274,7 +361,7 @@ public void deleteCustomer (int _id) {
}
- public List getPurchase(){
+ public List getPurchaseColums(){
List resultat=null;
Transaction tx=null;
try{
@@ -282,7 +369,7 @@ public void deleteCustomer (int _id) {
session.flush();
tx=session.beginTransaction();
- Query q=session.createQuery("select po.customerId, po.productId, po.quantity, po.shippingCost, po.salesDate, po.shippingDate, po.freightCompany from PurchaseOrder po");
+ Query q=session.createQuery("select po.orderNum, po.customerId, po.productId, po.quantity, po.shippingCost, po.salesDate, po.shippingDate, po.freightCompany from PurchaseOrder po");
resultat=(List)q.list();
}
catch (Exception e) {
@@ -295,17 +382,17 @@ public void deleteCustomer (int _id) {
return resultat;
}
- public List getPurchase(int id){
- List resultat=null;
+ public PurchaseOrder getPurchase(int id){
+ PurchaseOrder resultat=null;
Transaction tx=null;
try{
if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession();
session.flush();
tx=session.beginTransaction();
- Query q=session.createQuery(" from PurchaseOrder a where a.customerId=:_id");
+ Query q=session.createQuery(" from PurchaseOrder p where p.orderNum = :_id");
q.setInteger("_id", id);
- resultat=(List)q.list();
+ resultat=(PurchaseOrder)q.list().iterator().next();
}
catch (Exception e) {
e.printStackTrace();
diff --git a/src/java/controller/BddController.java b/src/java/controller/BddController.java
index 1ead67a..56fc3fe 100644
--- a/src/java/controller/BddController.java
+++ b/src/java/controller/BddController.java
@@ -69,16 +69,16 @@ public class BddController extends MultiActionController {
switch (type) {
case "customer":
- mv.addObject("results", new MagasinHelper().getClients());
+ mv.addObject("results", new MagasinHelper().getClientsColums());
mv.addObject("colonnes", Arrays.asList("customerId", "name", "addressline1", "addressline2", "zip", "rate"));
break;
case "product":
- mv.addObject("results", new MagasinHelper().getProducts());
+ mv.addObject("results", new MagasinHelper().getProductsColums());
mv.addObject("colonnes", Arrays.asList("productId", "manufacturerId", "productCode", "purchaseCost", "quantityOnHand", "markup", "available", "description"));
break;
case "purchase":
- mv.addObject("results", new MagasinHelper().getPurchase());
- mv.addObject("colonnes", Arrays.asList("customerId", "productId", "quantity", "shippingCost", "salesDate", "shippingDate", "freightCompany"));
+ mv.addObject("results", new MagasinHelper().getPurchaseColums());
+ mv.addObject("colonnes", Arrays.asList("orderNum", "customerId", "productId", "quantity", "shippingCost", "salesDate", "shippingDate", "freightCompany"));
mv.addObject("relation", new HashMap() {{
put("customerId", "customer");
put("productId", "product");
@@ -112,17 +112,18 @@ public class BddController extends MultiActionController {
switch (type) {
case "customer":
mv.addObject("result", new MagasinHelper().getClient(Integer.parseInt(request.getParameter("num"))));
- mv.addObject("colonnes", Arrays.asList("customerId", "name", "addressline1", "addressline2", "zip", "rate"));
mv.addObject("code",new MagasinHelper().getDiscountCode());
mv.addObject("cpostaux",new MagasinHelper().getZipCode());
break;
case "product":
mv.addObject("result", new MagasinHelper().getProduct(Integer.parseInt(request.getParameter("num"))));
- mv.addObject("colonnes", Arrays.asList("productId", "manufacturerId", "productCode", "purchaseCost", "quantityOnHand", "markup", "available", "description"));
+ mv.addObject("manufacturers", new MagasinHelper().getManufacturers());
+ mv.addObject("productCodes", new MagasinHelper().getProductCodes());
break;
case "purchase":
mv.addObject("result", new MagasinHelper().getPurchase(Integer.parseInt(request.getParameter("num"))));
- mv.addObject("colonnes", Arrays.asList("customerId", "productId", "quantity", "shippingCost", "salesDate", "shippingDate", "freightCompany"));
+ mv.addObject("customers", new MagasinHelper().getClients());
+ mv.addObject("products", new MagasinHelper().getProducts());
break;
default:
mv.addObject("error", "Type not found");
diff --git a/web/WEB-INF/jsp/detail.jsp b/web/WEB-INF/jsp/detail.jsp
index 398d510..17956f9 100644
--- a/web/WEB-INF/jsp/detail.jsp
+++ b/web/WEB-INF/jsp/detail.jsp
@@ -56,11 +56,19 @@
-
+
-
+
@@ -76,13 +84,55 @@
-
+ checked id="available" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+