Fix client purchases page
This commit is contained in:
parent
6d27564706
commit
c5fcc072cc
7 changed files with 29 additions and 16 deletions
Binary file not shown.
Binary file not shown.
|
@ -5,7 +5,7 @@
|
|||
--%>
|
||||
|
||||
<header>
|
||||
<nav style="display: flex; flex-direction: row; justify-content: space-between; align-content: center">
|
||||
<nav style="display: flex; flex-direction: row; justify-content: space-between">
|
||||
<div style="display: flex; flex-direction: row">
|
||||
<p>Welcome ${user.login}</p>
|
||||
<form name="form" method="POST">
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<%@include file="header.jsp" %>
|
||||
|
||||
|
||||
<H1>Achats du client n°<%=request.getParameter("numero")%></H1>
|
||||
<H1>Achats du client n°<%=request.getParameter("customerId")%></H1>
|
||||
<table border="1" cellpadding="10">
|
||||
|
||||
|
||||
|
|
|
@ -620,6 +620,28 @@ public void deleteProductCode(String _id) {
|
|||
|
||||
return resultat;
|
||||
}
|
||||
|
||||
public List<PurchaseOrder> getPurchases(int id){
|
||||
List<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 po where po.customerId = :_id");
|
||||
q.setInteger("_id", id);
|
||||
resultat=q.list();
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally{
|
||||
if (session.isOpen())session.close();
|
||||
}
|
||||
|
||||
return resultat;
|
||||
}
|
||||
|
||||
public int getMaxId(){
|
||||
Transaction tx=null;
|
||||
|
|
|
@ -182,22 +182,13 @@ public class BddController extends MultiActionController {
|
|||
MagasinHelper helper = new MagasinHelper();
|
||||
return mv;
|
||||
}
|
||||
public ModelAndView formfind(HttpServletRequest request,
|
||||
HttpServletResponse response) throws Exception {
|
||||
sessionInit(request);
|
||||
return new ModelAndView("recherche");
|
||||
}
|
||||
|
||||
public ModelAndView achats(HttpServletRequest request,
|
||||
HttpServletResponse response) throws Exception {
|
||||
sessionInit(request);
|
||||
|
||||
|
||||
ModelAndView mv = new ModelAndView("achats");
|
||||
|
||||
mv.addObject("user",session.getAttribute("user"));
|
||||
System.out.println("num "+Integer.parseInt(request.getParameter("numero")));
|
||||
|
||||
mv.addObject("achats",new MagasinHelper().getPurchase(Integer.parseInt(request.getParameter("numero"))));
|
||||
ModelAndView mv = new ModelAndView("achats");
|
||||
mv.addObject("user",session.getAttribute("user"));
|
||||
mv.addObject("achats",new MagasinHelper().getPurchases(Integer.parseInt(request.getParameter("customerId"))));
|
||||
return mv;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<%@include file="header.jsp" %>
|
||||
|
||||
|
||||
<H1>Achats du client n°<%=request.getParameter("numero")%></H1>
|
||||
<H1>Achats du client n°<%=request.getParameter("customerId")%></H1>
|
||||
<table border="1" cellpadding="10">
|
||||
|
||||
|
||||
|
|
Reference in a new issue