Formatting and logout fix
This commit is contained in:
parent
cfeb8d56ab
commit
9f582d6e80
58 changed files with 1479 additions and 1469 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<% response.sendRedirect("menu.htm"); %>
|
<% response.sendRedirect("menu.htm");%>
|
||||||
|
|
||||||
|
|
|
@ -13,20 +13,20 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form method="POST" action="j_security_check">
|
<form method="POST" action="j_security_check">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Utilisateur :</td>
|
<td>Utilisateur :</td>
|
||||||
<td><input type="text" name="j_username"></td>
|
<td><input type="text" name="j_username"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Mot de passe :</td>
|
<td>Mot de passe :</td>
|
||||||
<td><input type="password" name="j_password" ></td>
|
<td><input type="password" name="j_password" ></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><input type="submit" value="Entrer" ></td>
|
<td><input type="submit" value="Entrer" ></td>
|
||||||
<td><input type="reset" value="Annuler"></td>
|
<td><input type="reset" value="Annuler"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Binary file not shown.
|
@ -1,18 +0,0 @@
|
||||||
<%--
|
|
||||||
Document : error
|
|
||||||
Created on : 4 mars 2018, 20:54:56
|
|
||||||
Author : faycal
|
|
||||||
--%>
|
|
||||||
|
|
||||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
||||||
<title>Erreur</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<%@include file="header.jsp" %>
|
|
||||||
<h1>${erreur} </h1>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<% response.sendRedirect("menu.htm"); %>
|
<% response.sendRedirect("menu.htm");%>
|
||||||
|
|
||||||
|
|
|
@ -13,20 +13,20 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form method="POST" action="j_security_check">
|
<form method="POST" action="j_security_check">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Utilisateur :</td>
|
<td>Utilisateur :</td>
|
||||||
<td><input type="text" name="j_username"></td>
|
<td><input type="text" name="j_username"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Mot de passe :</td>
|
<td>Mot de passe :</td>
|
||||||
<td><input type="password" name="j_password" ></td>
|
<td><input type="password" name="j_password" ></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><input type="submit" value="Entrer" ></td>
|
<td><input type="submit" value="Entrer" ></td>
|
||||||
<td><input type="reset" value="Annuler"></td>
|
<td><input type="reset" value="Annuler"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
package DAO;
|
package DAO;
|
||||||
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
|
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customer generated by hbm2java
|
* Customer generated by hbm2java
|
||||||
*/
|
*/
|
||||||
public class Customer implements java.io.Serializable {
|
public class Customer implements java.io.Serializable {
|
||||||
|
|
||||||
|
|
||||||
private int customerId;
|
private int customerId;
|
||||||
private char discountCode;
|
private char discountCode;
|
||||||
private String zip;
|
private String zip;
|
||||||
|
@ -25,19 +22,19 @@ public class Customer implements java.io.Serializable {
|
||||||
public Customer() {
|
public Customer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Customer(int customerId, char discountCode, String zip) {
|
public Customer(int customerId, char discountCode, String zip) {
|
||||||
this.customerId = customerId;
|
this.customerId = customerId;
|
||||||
this.discountCode = discountCode;
|
this.discountCode = discountCode;
|
||||||
this.zip = zip;
|
this.zip = zip;
|
||||||
}
|
}
|
||||||
public Customer(int customerId, char discountCode,String _name, String _adress, String _phone,String _email, String _zip) {
|
|
||||||
|
public Customer(int customerId, char discountCode, String _name, String _adress, String _phone, String _email, String _zip) {
|
||||||
this.customerId = customerId;
|
this.customerId = customerId;
|
||||||
this.discountCode = discountCode;
|
this.discountCode = discountCode;
|
||||||
this.name=_name;
|
this.name = _name;
|
||||||
this.addressline1=_adress;
|
this.addressline1 = _adress;
|
||||||
this.phone=_phone;
|
this.phone = _phone;
|
||||||
this.email=_email;
|
this.email = _email;
|
||||||
this.zip = _zip;
|
this.zip = _zip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +60,7 @@ public class Customer implements java.io.Serializable {
|
||||||
public void setCustomerId(int customerId) {
|
public void setCustomerId(int customerId) {
|
||||||
this.customerId = customerId;
|
this.customerId = customerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public char getDiscountCode() {
|
public char getDiscountCode() {
|
||||||
return this.discountCode;
|
return this.discountCode;
|
||||||
}
|
}
|
||||||
|
@ -70,6 +68,7 @@ public class Customer implements java.io.Serializable {
|
||||||
public void setDiscountCode(char discountCode) {
|
public void setDiscountCode(char discountCode) {
|
||||||
this.discountCode = discountCode;
|
this.discountCode = discountCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getZip() {
|
public String getZip() {
|
||||||
return this.zip;
|
return this.zip;
|
||||||
}
|
}
|
||||||
|
@ -77,6 +76,7 @@ public class Customer implements java.io.Serializable {
|
||||||
public void setZip(String zip) {
|
public void setZip(String zip) {
|
||||||
this.zip = zip;
|
this.zip = zip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@ public class Customer implements java.io.Serializable {
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAddressline1() {
|
public String getAddressline1() {
|
||||||
return this.addressline1;
|
return this.addressline1;
|
||||||
}
|
}
|
||||||
|
@ -91,6 +92,7 @@ public class Customer implements java.io.Serializable {
|
||||||
public void setAddressline1(String addressline1) {
|
public void setAddressline1(String addressline1) {
|
||||||
this.addressline1 = addressline1;
|
this.addressline1 = addressline1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAddressline2() {
|
public String getAddressline2() {
|
||||||
return this.addressline2;
|
return this.addressline2;
|
||||||
}
|
}
|
||||||
|
@ -98,6 +100,7 @@ public class Customer implements java.io.Serializable {
|
||||||
public void setAddressline2(String addressline2) {
|
public void setAddressline2(String addressline2) {
|
||||||
this.addressline2 = addressline2;
|
this.addressline2 = addressline2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCity() {
|
public String getCity() {
|
||||||
return this.city;
|
return this.city;
|
||||||
}
|
}
|
||||||
|
@ -105,6 +108,7 @@ public class Customer implements java.io.Serializable {
|
||||||
public void setCity(String city) {
|
public void setCity(String city) {
|
||||||
this.city = city;
|
this.city = city;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getState() {
|
public String getState() {
|
||||||
return this.state;
|
return this.state;
|
||||||
}
|
}
|
||||||
|
@ -112,6 +116,7 @@ public class Customer implements java.io.Serializable {
|
||||||
public void setState(String state) {
|
public void setState(String state) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPhone() {
|
public String getPhone() {
|
||||||
return this.phone;
|
return this.phone;
|
||||||
}
|
}
|
||||||
|
@ -119,6 +124,7 @@ public class Customer implements java.io.Serializable {
|
||||||
public void setPhone(String phone) {
|
public void setPhone(String phone) {
|
||||||
this.phone = phone;
|
this.phone = phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFax() {
|
public String getFax() {
|
||||||
return this.fax;
|
return this.fax;
|
||||||
}
|
}
|
||||||
|
@ -126,6 +132,7 @@ public class Customer implements java.io.Serializable {
|
||||||
public void setFax(String fax) {
|
public void setFax(String fax) {
|
||||||
this.fax = fax;
|
this.fax = fax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
return this.email;
|
return this.email;
|
||||||
}
|
}
|
||||||
|
@ -133,6 +140,7 @@ public class Customer implements java.io.Serializable {
|
||||||
public void setEmail(String email) {
|
public void setEmail(String email) {
|
||||||
this.email = email;
|
this.email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getCreditLimit() {
|
public Integer getCreditLimit() {
|
||||||
return this.creditLimit;
|
return this.creditLimit;
|
||||||
}
|
}
|
||||||
|
@ -141,9 +149,4 @@ public class Customer implements java.io.Serializable {
|
||||||
this.creditLimit = creditLimit;
|
this.creditLimit = creditLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package DAO;
|
package DAO;
|
||||||
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
|
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
|
||||||
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,17 +8,16 @@ import java.math.BigDecimal;
|
||||||
*/
|
*/
|
||||||
public class DiscountCode implements java.io.Serializable {
|
public class DiscountCode implements java.io.Serializable {
|
||||||
|
|
||||||
|
|
||||||
private char discountCode;
|
private char discountCode;
|
||||||
private BigDecimal rate;
|
private BigDecimal rate;
|
||||||
|
|
||||||
public DiscountCode() {
|
public DiscountCode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public DiscountCode(char discountCode) {
|
public DiscountCode(char discountCode) {
|
||||||
this.discountCode = discountCode;
|
this.discountCode = discountCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiscountCode(char discountCode, BigDecimal rate) {
|
public DiscountCode(char discountCode, BigDecimal rate) {
|
||||||
this.discountCode = discountCode;
|
this.discountCode = discountCode;
|
||||||
this.rate = rate;
|
this.rate = rate;
|
||||||
|
@ -32,6 +30,7 @@ public class DiscountCode implements java.io.Serializable {
|
||||||
public void setDiscountCode(char discountCode) {
|
public void setDiscountCode(char discountCode) {
|
||||||
this.discountCode = discountCode;
|
this.discountCode = discountCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getRate() {
|
public BigDecimal getRate() {
|
||||||
return this.rate;
|
return this.rate;
|
||||||
}
|
}
|
||||||
|
@ -40,9 +39,4 @@ public class DiscountCode implements java.io.Serializable {
|
||||||
this.rate = rate;
|
this.rate = rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ package DAO;
|
||||||
import org.hibernate.cfg.AnnotationConfiguration;
|
import org.hibernate.cfg.AnnotationConfiguration;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hibernate Utility class with a convenient method to get Session Factory
|
* Hibernate Utility class with a convenient method to get Session Factory
|
||||||
* object.
|
* object.
|
||||||
|
@ -25,7 +24,6 @@ public class HibernateUtil {
|
||||||
// config file.
|
// config file.
|
||||||
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
|
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
|
||||||
|
|
||||||
|
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
// Log the exception.
|
// Log the exception.
|
||||||
System.err.println("Initial SessionFactory creation failed." + ex);
|
System.err.println("Initial SessionFactory creation failed." + ex);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,14 +1,11 @@
|
||||||
package DAO;
|
package DAO;
|
||||||
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
|
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manufacturer generated by hbm2java
|
* Manufacturer generated by hbm2java
|
||||||
*/
|
*/
|
||||||
public class Manufacturer implements java.io.Serializable {
|
public class Manufacturer implements java.io.Serializable {
|
||||||
|
|
||||||
|
|
||||||
private int manufacturerId;
|
private int manufacturerId;
|
||||||
private String name;
|
private String name;
|
||||||
private String addressline1;
|
private String addressline1;
|
||||||
|
@ -24,10 +21,10 @@ public class Manufacturer implements java.io.Serializable {
|
||||||
public Manufacturer() {
|
public Manufacturer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Manufacturer(int manufacturerId) {
|
public Manufacturer(int manufacturerId) {
|
||||||
this.manufacturerId = manufacturerId;
|
this.manufacturerId = manufacturerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Manufacturer(int manufacturerId, String name, String addressline1, String addressline2, String city, String state, String zip, String phone, String fax, String email, String rep) {
|
public Manufacturer(int manufacturerId, String name, String addressline1, String addressline2, String city, String state, String zip, String phone, String fax, String email, String rep) {
|
||||||
this.manufacturerId = manufacturerId;
|
this.manufacturerId = manufacturerId;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -49,6 +46,7 @@ public class Manufacturer implements java.io.Serializable {
|
||||||
public void setManufacturerId(int manufacturerId) {
|
public void setManufacturerId(int manufacturerId) {
|
||||||
this.manufacturerId = manufacturerId;
|
this.manufacturerId = manufacturerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
@ -56,6 +54,7 @@ public class Manufacturer implements java.io.Serializable {
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAddressline1() {
|
public String getAddressline1() {
|
||||||
return this.addressline1;
|
return this.addressline1;
|
||||||
}
|
}
|
||||||
|
@ -63,6 +62,7 @@ public class Manufacturer implements java.io.Serializable {
|
||||||
public void setAddressline1(String addressline1) {
|
public void setAddressline1(String addressline1) {
|
||||||
this.addressline1 = addressline1;
|
this.addressline1 = addressline1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAddressline2() {
|
public String getAddressline2() {
|
||||||
return this.addressline2;
|
return this.addressline2;
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,7 @@ public class Manufacturer implements java.io.Serializable {
|
||||||
public void setAddressline2(String addressline2) {
|
public void setAddressline2(String addressline2) {
|
||||||
this.addressline2 = addressline2;
|
this.addressline2 = addressline2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCity() {
|
public String getCity() {
|
||||||
return this.city;
|
return this.city;
|
||||||
}
|
}
|
||||||
|
@ -77,6 +78,7 @@ public class Manufacturer implements java.io.Serializable {
|
||||||
public void setCity(String city) {
|
public void setCity(String city) {
|
||||||
this.city = city;
|
this.city = city;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getState() {
|
public String getState() {
|
||||||
return this.state;
|
return this.state;
|
||||||
}
|
}
|
||||||
|
@ -84,6 +86,7 @@ public class Manufacturer implements java.io.Serializable {
|
||||||
public void setState(String state) {
|
public void setState(String state) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getZip() {
|
public String getZip() {
|
||||||
return this.zip;
|
return this.zip;
|
||||||
}
|
}
|
||||||
|
@ -91,6 +94,7 @@ public class Manufacturer implements java.io.Serializable {
|
||||||
public void setZip(String zip) {
|
public void setZip(String zip) {
|
||||||
this.zip = zip;
|
this.zip = zip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPhone() {
|
public String getPhone() {
|
||||||
return this.phone;
|
return this.phone;
|
||||||
}
|
}
|
||||||
|
@ -98,6 +102,7 @@ public class Manufacturer implements java.io.Serializable {
|
||||||
public void setPhone(String phone) {
|
public void setPhone(String phone) {
|
||||||
this.phone = phone;
|
this.phone = phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFax() {
|
public String getFax() {
|
||||||
return this.fax;
|
return this.fax;
|
||||||
}
|
}
|
||||||
|
@ -105,6 +110,7 @@ public class Manufacturer implements java.io.Serializable {
|
||||||
public void setFax(String fax) {
|
public void setFax(String fax) {
|
||||||
this.fax = fax;
|
this.fax = fax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
return this.email;
|
return this.email;
|
||||||
}
|
}
|
||||||
|
@ -112,6 +118,7 @@ public class Manufacturer implements java.io.Serializable {
|
||||||
public void setEmail(String email) {
|
public void setEmail(String email) {
|
||||||
this.email = email;
|
this.email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRep() {
|
public String getRep() {
|
||||||
return this.rep;
|
return this.rep;
|
||||||
}
|
}
|
||||||
|
@ -120,9 +127,4 @@ public class Manufacturer implements java.io.Serializable {
|
||||||
this.rep = rep;
|
this.rep = rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
package DAO;
|
package DAO;
|
||||||
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
|
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MicroMarket generated by hbm2java
|
* MicroMarket generated by hbm2java
|
||||||
*/
|
*/
|
||||||
public class MicroMarket implements java.io.Serializable {
|
public class MicroMarket implements java.io.Serializable {
|
||||||
|
|
||||||
|
|
||||||
private String zipCode;
|
private String zipCode;
|
||||||
private Double radius;
|
private Double radius;
|
||||||
private Double areaLength;
|
private Double areaLength;
|
||||||
|
@ -17,10 +14,10 @@ public class MicroMarket implements java.io.Serializable {
|
||||||
public MicroMarket() {
|
public MicroMarket() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public MicroMarket(String zipCode) {
|
public MicroMarket(String zipCode) {
|
||||||
this.zipCode = zipCode;
|
this.zipCode = zipCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MicroMarket(String zipCode, Double radius, Double areaLength, Double areaWidth) {
|
public MicroMarket(String zipCode, Double radius, Double areaLength, Double areaWidth) {
|
||||||
this.zipCode = zipCode;
|
this.zipCode = zipCode;
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
|
@ -35,6 +32,7 @@ public class MicroMarket implements java.io.Serializable {
|
||||||
public void setZipCode(String zipCode) {
|
public void setZipCode(String zipCode) {
|
||||||
this.zipCode = zipCode;
|
this.zipCode = zipCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getRadius() {
|
public Double getRadius() {
|
||||||
return this.radius;
|
return this.radius;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +40,7 @@ public class MicroMarket implements java.io.Serializable {
|
||||||
public void setRadius(Double radius) {
|
public void setRadius(Double radius) {
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getAreaLength() {
|
public Double getAreaLength() {
|
||||||
return this.areaLength;
|
return this.areaLength;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +48,7 @@ public class MicroMarket implements java.io.Serializable {
|
||||||
public void setAreaLength(Double areaLength) {
|
public void setAreaLength(Double areaLength) {
|
||||||
this.areaLength = areaLength;
|
this.areaLength = areaLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getAreaWidth() {
|
public Double getAreaWidth() {
|
||||||
return this.areaWidth;
|
return this.areaWidth;
|
||||||
}
|
}
|
||||||
|
@ -57,9 +57,4 @@ public class MicroMarket implements java.io.Serializable {
|
||||||
this.areaWidth = areaWidth;
|
this.areaWidth = areaWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package DAO;
|
package DAO;
|
||||||
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
|
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
|
||||||
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,7 +8,6 @@ import java.math.BigDecimal;
|
||||||
*/
|
*/
|
||||||
public class Product implements java.io.Serializable {
|
public class Product implements java.io.Serializable {
|
||||||
|
|
||||||
|
|
||||||
private int productId;
|
private int productId;
|
||||||
private int manufacturerId;
|
private int manufacturerId;
|
||||||
private String productCode;
|
private String productCode;
|
||||||
|
@ -22,12 +20,12 @@ public class Product implements java.io.Serializable {
|
||||||
public Product() {
|
public Product() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Product(int productId, int manufacturerId, String productCode) {
|
public Product(int productId, int manufacturerId, String productCode) {
|
||||||
this.productId = productId;
|
this.productId = productId;
|
||||||
this.manufacturerId = manufacturerId;
|
this.manufacturerId = manufacturerId;
|
||||||
this.productCode = productCode;
|
this.productCode = productCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Product(int productId, int manufacturerId, String productCode, BigDecimal purchaseCost, Integer quantityOnHand, BigDecimal markup, String available, String description) {
|
public Product(int productId, int manufacturerId, String productCode, BigDecimal purchaseCost, Integer quantityOnHand, BigDecimal markup, String available, String description) {
|
||||||
this.productId = productId;
|
this.productId = productId;
|
||||||
this.manufacturerId = manufacturerId;
|
this.manufacturerId = manufacturerId;
|
||||||
|
@ -46,6 +44,7 @@ public class Product implements java.io.Serializable {
|
||||||
public void setProductId(int productId) {
|
public void setProductId(int productId) {
|
||||||
this.productId = productId;
|
this.productId = productId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getManufacturerId() {
|
public int getManufacturerId() {
|
||||||
return this.manufacturerId;
|
return this.manufacturerId;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +52,7 @@ public class Product implements java.io.Serializable {
|
||||||
public void setManufacturerId(int manufacturerId) {
|
public void setManufacturerId(int manufacturerId) {
|
||||||
this.manufacturerId = manufacturerId;
|
this.manufacturerId = manufacturerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProductCode() {
|
public String getProductCode() {
|
||||||
return this.productCode;
|
return this.productCode;
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,7 @@ public class Product implements java.io.Serializable {
|
||||||
public void setProductCode(String productCode) {
|
public void setProductCode(String productCode) {
|
||||||
this.productCode = productCode;
|
this.productCode = productCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getPurchaseCost() {
|
public BigDecimal getPurchaseCost() {
|
||||||
return this.purchaseCost;
|
return this.purchaseCost;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +68,7 @@ public class Product implements java.io.Serializable {
|
||||||
public void setPurchaseCost(BigDecimal purchaseCost) {
|
public void setPurchaseCost(BigDecimal purchaseCost) {
|
||||||
this.purchaseCost = purchaseCost;
|
this.purchaseCost = purchaseCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getQuantityOnHand() {
|
public Integer getQuantityOnHand() {
|
||||||
return this.quantityOnHand;
|
return this.quantityOnHand;
|
||||||
}
|
}
|
||||||
|
@ -74,6 +76,7 @@ public class Product implements java.io.Serializable {
|
||||||
public void setQuantityOnHand(Integer quantityOnHand) {
|
public void setQuantityOnHand(Integer quantityOnHand) {
|
||||||
this.quantityOnHand = quantityOnHand;
|
this.quantityOnHand = quantityOnHand;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getMarkup() {
|
public BigDecimal getMarkup() {
|
||||||
return this.markup;
|
return this.markup;
|
||||||
}
|
}
|
||||||
|
@ -81,6 +84,7 @@ public class Product implements java.io.Serializable {
|
||||||
public void setMarkup(BigDecimal markup) {
|
public void setMarkup(BigDecimal markup) {
|
||||||
this.markup = markup;
|
this.markup = markup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAvailable() {
|
public String getAvailable() {
|
||||||
return this.available;
|
return this.available;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +92,7 @@ public class Product implements java.io.Serializable {
|
||||||
public void setAvailable(String available) {
|
public void setAvailable(String available) {
|
||||||
this.available = available;
|
this.available = available;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return this.description;
|
return this.description;
|
||||||
}
|
}
|
||||||
|
@ -96,9 +101,4 @@ public class Product implements java.io.Serializable {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
package DAO;
|
package DAO;
|
||||||
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
|
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ProductCode generated by hbm2java
|
* ProductCode generated by hbm2java
|
||||||
*/
|
*/
|
||||||
public class ProductCode implements java.io.Serializable {
|
public class ProductCode implements java.io.Serializable {
|
||||||
|
|
||||||
|
|
||||||
private String prodCode;
|
private String prodCode;
|
||||||
private char discountCode;
|
private char discountCode;
|
||||||
private String description;
|
private String description;
|
||||||
|
@ -16,11 +13,11 @@ public class ProductCode implements java.io.Serializable {
|
||||||
public ProductCode() {
|
public ProductCode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ProductCode(String prodCode, char discountCode) {
|
public ProductCode(String prodCode, char discountCode) {
|
||||||
this.prodCode = prodCode;
|
this.prodCode = prodCode;
|
||||||
this.discountCode = discountCode;
|
this.discountCode = discountCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProductCode(String prodCode, char discountCode, String description) {
|
public ProductCode(String prodCode, char discountCode, String description) {
|
||||||
this.prodCode = prodCode;
|
this.prodCode = prodCode;
|
||||||
this.discountCode = discountCode;
|
this.discountCode = discountCode;
|
||||||
|
@ -34,6 +31,7 @@ public class ProductCode implements java.io.Serializable {
|
||||||
public void setProdCode(String prodCode) {
|
public void setProdCode(String prodCode) {
|
||||||
this.prodCode = prodCode;
|
this.prodCode = prodCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public char getDiscountCode() {
|
public char getDiscountCode() {
|
||||||
return this.discountCode;
|
return this.discountCode;
|
||||||
}
|
}
|
||||||
|
@ -41,6 +39,7 @@ public class ProductCode implements java.io.Serializable {
|
||||||
public void setDiscountCode(char discountCode) {
|
public void setDiscountCode(char discountCode) {
|
||||||
this.discountCode = discountCode;
|
this.discountCode = discountCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return this.description;
|
return this.description;
|
||||||
}
|
}
|
||||||
|
@ -49,9 +48,4 @@ public class ProductCode implements java.io.Serializable {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package DAO;
|
package DAO;
|
||||||
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
|
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
|
||||||
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ -10,7 +9,6 @@ import java.util.Date;
|
||||||
*/
|
*/
|
||||||
public class PurchaseOrder implements java.io.Serializable {
|
public class PurchaseOrder implements java.io.Serializable {
|
||||||
|
|
||||||
|
|
||||||
private int orderNum;
|
private int orderNum;
|
||||||
private int customerId;
|
private int customerId;
|
||||||
private int productId;
|
private int productId;
|
||||||
|
@ -23,12 +21,12 @@ public class PurchaseOrder implements java.io.Serializable {
|
||||||
public PurchaseOrder() {
|
public PurchaseOrder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public PurchaseOrder(int orderNum, int customerId, int productId) {
|
public PurchaseOrder(int orderNum, int customerId, int productId) {
|
||||||
this.orderNum = orderNum;
|
this.orderNum = orderNum;
|
||||||
this.customerId = customerId;
|
this.customerId = customerId;
|
||||||
this.productId = productId;
|
this.productId = productId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PurchaseOrder(int orderNum, int customerId, int productId, Short quantity, BigDecimal shippingCost, Date salesDate, Date shippingDate, String freightCompany) {
|
public PurchaseOrder(int orderNum, int customerId, int productId, Short quantity, BigDecimal shippingCost, Date salesDate, Date shippingDate, String freightCompany) {
|
||||||
this.orderNum = orderNum;
|
this.orderNum = orderNum;
|
||||||
this.customerId = customerId;
|
this.customerId = customerId;
|
||||||
|
@ -47,6 +45,7 @@ public class PurchaseOrder implements java.io.Serializable {
|
||||||
public void setOrderNum(int orderNum) {
|
public void setOrderNum(int orderNum) {
|
||||||
this.orderNum = orderNum;
|
this.orderNum = orderNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCustomerId() {
|
public int getCustomerId() {
|
||||||
return this.customerId;
|
return this.customerId;
|
||||||
}
|
}
|
||||||
|
@ -54,6 +53,7 @@ public class PurchaseOrder implements java.io.Serializable {
|
||||||
public void setCustomerId(int customerId) {
|
public void setCustomerId(int customerId) {
|
||||||
this.customerId = customerId;
|
this.customerId = customerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getProductId() {
|
public int getProductId() {
|
||||||
return this.productId;
|
return this.productId;
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,7 @@ public class PurchaseOrder implements java.io.Serializable {
|
||||||
public void setProductId(int productId) {
|
public void setProductId(int productId) {
|
||||||
this.productId = productId;
|
this.productId = productId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Short getQuantity() {
|
public Short getQuantity() {
|
||||||
return this.quantity;
|
return this.quantity;
|
||||||
}
|
}
|
||||||
|
@ -68,6 +69,7 @@ public class PurchaseOrder implements java.io.Serializable {
|
||||||
public void setQuantity(Short quantity) {
|
public void setQuantity(Short quantity) {
|
||||||
this.quantity = quantity;
|
this.quantity = quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getShippingCost() {
|
public BigDecimal getShippingCost() {
|
||||||
return this.shippingCost;
|
return this.shippingCost;
|
||||||
}
|
}
|
||||||
|
@ -75,6 +77,7 @@ public class PurchaseOrder implements java.io.Serializable {
|
||||||
public void setShippingCost(BigDecimal shippingCost) {
|
public void setShippingCost(BigDecimal shippingCost) {
|
||||||
this.shippingCost = shippingCost;
|
this.shippingCost = shippingCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getSalesDate() {
|
public Date getSalesDate() {
|
||||||
return this.salesDate;
|
return this.salesDate;
|
||||||
}
|
}
|
||||||
|
@ -82,6 +85,7 @@ public class PurchaseOrder implements java.io.Serializable {
|
||||||
public void setSalesDate(Date salesDate) {
|
public void setSalesDate(Date salesDate) {
|
||||||
this.salesDate = salesDate;
|
this.salesDate = salesDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getShippingDate() {
|
public Date getShippingDate() {
|
||||||
return this.shippingDate;
|
return this.shippingDate;
|
||||||
}
|
}
|
||||||
|
@ -89,6 +93,7 @@ public class PurchaseOrder implements java.io.Serializable {
|
||||||
public void setShippingDate(Date shippingDate) {
|
public void setShippingDate(Date shippingDate) {
|
||||||
this.shippingDate = shippingDate;
|
this.shippingDate = shippingDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFreightCompany() {
|
public String getFreightCompany() {
|
||||||
return this.freightCompany;
|
return this.freightCompany;
|
||||||
}
|
}
|
||||||
|
@ -97,9 +102,4 @@ public class PurchaseOrder implements java.io.Serializable {
|
||||||
this.freightCompany = freightCompany;
|
this.freightCompany = freightCompany;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ package Exceptions;
|
||||||
* @author flifloo
|
* @author flifloo
|
||||||
*/
|
*/
|
||||||
public class InvalidParameter extends Exception {
|
public class InvalidParameter extends Exception {
|
||||||
|
|
||||||
public InvalidParameter(String message) {
|
public InvalidParameter(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
package controller;
|
package controller;
|
||||||
|
|
||||||
import DAO.*;
|
import DAO.*;
|
||||||
import Exceptions.InvalidParameter;
|
import Exceptions.InvalidParameter;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
@ -20,46 +21,47 @@ import javax.servlet.http.*;
|
||||||
import javax.servlet.*;
|
import javax.servlet.*;
|
||||||
import org.hibernate.exception.ConstraintViolationException;
|
import org.hibernate.exception.ConstraintViolationException;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author faycal
|
* @author faycal
|
||||||
*/
|
*/
|
||||||
public class BddController extends MultiActionController {
|
public class BddController extends MultiActionController {
|
||||||
|
|
||||||
private String login;
|
private String login;
|
||||||
private String pwd;
|
private String pwd;
|
||||||
private User utilisateur;
|
private User utilisateur;
|
||||||
private HttpSession session;
|
private HttpSession session;
|
||||||
public BddController() {}
|
|
||||||
|
public BddController() {
|
||||||
|
}
|
||||||
|
|
||||||
private void sessionInit(HttpServletRequest request) {
|
private void sessionInit(HttpServletRequest request) {
|
||||||
if (login == null)
|
if (login == null) {
|
||||||
login=request.getUserPrincipal().getName();
|
login = request.getUserPrincipal().getName();
|
||||||
if (utilisateur == null)
|
}
|
||||||
utilisateur =new User(login);
|
if (utilisateur == null) {
|
||||||
|
utilisateur = new User(login);
|
||||||
|
}
|
||||||
|
|
||||||
if (session == null) {
|
if (session == null) {
|
||||||
session=request.getSession();
|
session = request.getSession();
|
||||||
session.setAttribute("user", utilisateur);
|
session.setAttribute("user", utilisateur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelAndView menu(HttpServletRequest request,
|
public ModelAndView menu(HttpServletRequest request,
|
||||||
HttpServletResponse response){
|
HttpServletResponse response) {
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
System.out.println ("nbuser="+User.getCompteur());
|
System.out.println("nbuser=" + User.getCompteur());
|
||||||
return new ModelAndView("menu").addObject("user",utilisateur);
|
return new ModelAndView("menu").addObject("user", utilisateur);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelAndView logout(HttpServletRequest request,
|
public ModelAndView logout(HttpServletRequest request,
|
||||||
HttpServletResponse response){
|
HttpServletResponse response) {
|
||||||
sessionInit(request);
|
|
||||||
request.getSession().invalidate();
|
request.getSession().invalidate();
|
||||||
|
|
||||||
|
return new ModelAndView("logout");
|
||||||
return new ModelAndView("deconnexion");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +70,7 @@ public class BddController extends MultiActionController {
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
String type = request.getParameter("type");
|
String type = request.getParameter("type");
|
||||||
ModelAndView mv = new ModelAndView("resultat");
|
ModelAndView mv = new ModelAndView("resultat");
|
||||||
mv.addObject("user",session.getAttribute("user"));
|
mv.addObject("user", session.getAttribute("user"));
|
||||||
mv.addObject("type", type);
|
mv.addObject("type", type);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -79,17 +81,21 @@ public class BddController extends MultiActionController {
|
||||||
case "product":
|
case "product":
|
||||||
mv.addObject("results", new MagasinHelper().getProductsColums());
|
mv.addObject("results", new MagasinHelper().getProductsColums());
|
||||||
mv.addObject("colonnes", Arrays.asList("productId", "manufacturerId", "productCode", "purchaseCost", "quantityOnHand", "markup", "available", "description"));
|
mv.addObject("colonnes", Arrays.asList("productId", "manufacturerId", "productCode", "purchaseCost", "quantityOnHand", "markup", "available", "description"));
|
||||||
mv.addObject("relation", new HashMap<String, String>() {{
|
mv.addObject("relation", new HashMap<String, String>() {
|
||||||
|
{
|
||||||
put("productCode", "prodCode");
|
put("productCode", "prodCode");
|
||||||
}});
|
}
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case "purchase":
|
case "purchase":
|
||||||
mv.addObject("results", new MagasinHelper().getPurchaseColums());
|
mv.addObject("results", new MagasinHelper().getPurchaseColums());
|
||||||
mv.addObject("colonnes", Arrays.asList("orderNum", "customerId", "productId", "quantity", "shippingCost", "salesDate", "shippingDate", "freightCompany"));
|
mv.addObject("colonnes", Arrays.asList("orderNum", "customerId", "productId", "quantity", "shippingCost", "salesDate", "shippingDate", "freightCompany"));
|
||||||
mv.addObject("relation", new HashMap<String, String>() {{
|
mv.addObject("relation", new HashMap<String, String>() {
|
||||||
|
{
|
||||||
put("customerId", "customer");
|
put("customerId", "customer");
|
||||||
put("productId", "product");
|
put("productId", "product");
|
||||||
}});
|
}
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case "discount":
|
case "discount":
|
||||||
mv.addObject("results", new MagasinHelper().getDiscountCodesColums());
|
mv.addObject("results", new MagasinHelper().getDiscountCodesColums());
|
||||||
|
@ -98,9 +104,11 @@ public class BddController extends MultiActionController {
|
||||||
case "prodCode":
|
case "prodCode":
|
||||||
mv.addObject("results", new MagasinHelper().getProductCodesColums());
|
mv.addObject("results", new MagasinHelper().getProductCodesColums());
|
||||||
mv.addObject("colonnes", Arrays.asList("prodCode", "discountCode", "description"));
|
mv.addObject("colonnes", Arrays.asList("prodCode", "discountCode", "description"));
|
||||||
mv.addObject("relation", new HashMap<String, String>() {{
|
mv.addObject("relation", new HashMap<String, String>() {
|
||||||
|
{
|
||||||
put("discountCode", "discount");
|
put("discountCode", "discount");
|
||||||
}});
|
}
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mv.addObject("error", "Type not found");
|
mv.addObject("error", "Type not found");
|
||||||
|
@ -114,14 +122,14 @@ public class BddController extends MultiActionController {
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
String type = request.getParameter("type");
|
String type = request.getParameter("type");
|
||||||
ModelAndView mv = new ModelAndView("detail");
|
ModelAndView mv = new ModelAndView("detail");
|
||||||
mv.addObject("user",session.getAttribute("user"));
|
mv.addObject("user", session.getAttribute("user"));
|
||||||
mv.addObject("type", type);
|
mv.addObject("type", type);
|
||||||
mv.addObject("save", true);
|
mv.addObject("save", true);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "customer":
|
case "customer":
|
||||||
mv.addObject("code",new MagasinHelper().getDiscountCodes());
|
mv.addObject("code", new MagasinHelper().getDiscountCodes());
|
||||||
mv.addObject("cpostaux",new MagasinHelper().getZipCode());
|
mv.addObject("cpostaux", new MagasinHelper().getZipCode());
|
||||||
break;
|
break;
|
||||||
case "product":
|
case "product":
|
||||||
mv.addObject("manufacturers", new MagasinHelper().getManufacturers());
|
mv.addObject("manufacturers", new MagasinHelper().getManufacturers());
|
||||||
|
@ -134,7 +142,7 @@ public class BddController extends MultiActionController {
|
||||||
case "discount":
|
case "discount":
|
||||||
break;
|
break;
|
||||||
case "prodCode":
|
case "prodCode":
|
||||||
mv.addObject("code",new MagasinHelper().getDiscountCodes());
|
mv.addObject("code", new MagasinHelper().getDiscountCodes());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mv.addObject("error", "Type not found");
|
mv.addObject("error", "Type not found");
|
||||||
|
@ -148,14 +156,14 @@ public class BddController extends MultiActionController {
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
String type = request.getParameter("type");
|
String type = request.getParameter("type");
|
||||||
ModelAndView mv = new ModelAndView("detail");
|
ModelAndView mv = new ModelAndView("detail");
|
||||||
mv.addObject("user",session.getAttribute("user"));
|
mv.addObject("user", session.getAttribute("user"));
|
||||||
mv.addObject("type", type);
|
mv.addObject("type", type);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "customer":
|
case "customer":
|
||||||
mv.addObject("result", new MagasinHelper().getClient(Integer.parseInt(request.getParameter("num"))));
|
mv.addObject("result", new MagasinHelper().getClient(Integer.parseInt(request.getParameter("num"))));
|
||||||
mv.addObject("code",new MagasinHelper().getDiscountCodes());
|
mv.addObject("code", new MagasinHelper().getDiscountCodes());
|
||||||
mv.addObject("cpostaux",new MagasinHelper().getZipCode());
|
mv.addObject("cpostaux", new MagasinHelper().getZipCode());
|
||||||
break;
|
break;
|
||||||
case "product":
|
case "product":
|
||||||
mv.addObject("result", new MagasinHelper().getProduct(Integer.parseInt(request.getParameter("num"))));
|
mv.addObject("result", new MagasinHelper().getProduct(Integer.parseInt(request.getParameter("num"))));
|
||||||
|
@ -172,7 +180,7 @@ public class BddController extends MultiActionController {
|
||||||
break;
|
break;
|
||||||
case "prodCode":
|
case "prodCode":
|
||||||
mv.addObject("result", new MagasinHelper().getProductCode(request.getParameter("num")));
|
mv.addObject("result", new MagasinHelper().getProductCode(request.getParameter("num")));
|
||||||
mv.addObject("code",new MagasinHelper().getDiscountCodes());
|
mv.addObject("code", new MagasinHelper().getDiscountCodes());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mv.addObject("error", "Type not found");
|
mv.addObject("error", "Type not found");
|
||||||
|
@ -180,18 +188,19 @@ public class BddController extends MultiActionController {
|
||||||
|
|
||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelAndView find(HttpServletRequest request,
|
public ModelAndView find(HttpServletRequest request,
|
||||||
HttpServletResponse response) throws Exception {
|
HttpServletResponse response) throws Exception {
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
String type = request.getParameter("type");
|
String type = request.getParameter("type");
|
||||||
ModelAndView mv = new ModelAndView("resultat");
|
ModelAndView mv = new ModelAndView("resultat");
|
||||||
mv.addObject("user",session.getAttribute("user"));
|
mv.addObject("user", session.getAttribute("user"));
|
||||||
mv.addObject("type", type);
|
mv.addObject("type", type);
|
||||||
|
|
||||||
String query = request.getParameter("query");
|
String query = request.getParameter("query");
|
||||||
if (query == null || query.isEmpty())
|
if (query == null || query.isEmpty()) {
|
||||||
mv.addObject("error", "No query");
|
mv.addObject("error", "No query");
|
||||||
else {
|
} else {
|
||||||
List<Customer> customers = new ArrayList<Customer>();
|
List<Customer> customers = new ArrayList<Customer>();
|
||||||
try {
|
try {
|
||||||
customers.addAll(new MagasinHelper().getClientsColums(Integer.parseInt(query)));
|
customers.addAll(new MagasinHelper().getClientsColums(Integer.parseInt(query)));
|
||||||
|
@ -202,11 +211,12 @@ public class BddController extends MultiActionController {
|
||||||
query = "%".concat(query.concat("%"));
|
query = "%".concat(query.concat("%"));
|
||||||
customers.addAll(new MagasinHelper().getClientsColums(query));
|
customers.addAll(new MagasinHelper().getClientsColums(query));
|
||||||
|
|
||||||
if (customers.size() == 0)
|
if (customers.size() == 0) {
|
||||||
mv.addObject("error", "No user found :/");
|
mv.addObject("error", "No user found :/");
|
||||||
else
|
} else {
|
||||||
mv.addObject("results", customers);
|
mv.addObject("results", customers);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
MagasinHelper helper = new MagasinHelper();
|
MagasinHelper helper = new MagasinHelper();
|
||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
|
@ -215,8 +225,8 @@ public class BddController extends MultiActionController {
|
||||||
HttpServletResponse response) throws Exception {
|
HttpServletResponse response) throws Exception {
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
ModelAndView mv = new ModelAndView("achats");
|
ModelAndView mv = new ModelAndView("achats");
|
||||||
mv.addObject("user",session.getAttribute("user"));
|
mv.addObject("user", session.getAttribute("user"));
|
||||||
mv.addObject("achats",new MagasinHelper().getPurchases(Integer.parseInt(request.getParameter("customerId"))));
|
mv.addObject("achats", new MagasinHelper().getPurchases(Integer.parseInt(request.getParameter("customerId"))));
|
||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +235,7 @@ public class BddController extends MultiActionController {
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
String type = request.getParameter("type");
|
String type = request.getParameter("type");
|
||||||
ModelAndView mv = new ModelAndView("confirm");
|
ModelAndView mv = new ModelAndView("confirm");
|
||||||
mv.addObject("user",session.getAttribute("user"));
|
mv.addObject("user", session.getAttribute("user"));
|
||||||
mv.addObject("type", type);
|
mv.addObject("type", type);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -249,15 +259,16 @@ public class BddController extends MultiActionController {
|
||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
|
|
||||||
mv.addObject("confirm","suppression effectuée");
|
mv.addObject("confirm", "suppression effectuée");
|
||||||
return mv;
|
return mv;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private char paramChar(HttpServletRequest request, String name) throws InvalidParameter {
|
private char paramChar(HttpServletRequest request, String name) throws InvalidParameter {
|
||||||
String param = paramNotNull(request, name);
|
String param = paramNotNull(request, name);
|
||||||
if (param.length() > 1)
|
if (param.length() > 1) {
|
||||||
throw new InvalidParameter("Invalid ".concat(name));
|
throw new InvalidParameter("Invalid ".concat(name));
|
||||||
|
}
|
||||||
return param.charAt(0);
|
return param.charAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,8 +296,9 @@ public class BddController extends MultiActionController {
|
||||||
throw new InvalidParameter("Invalid big int for ".concat(name));
|
throw new InvalidParameter("Invalid big int for ".concat(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bc.precision() > precision)
|
if (bc.precision() > precision) {
|
||||||
throw new InvalidParameter("Precision for ".concat(name).concat(" shounld be over ".concat(String.valueOf(precision))));
|
throw new InvalidParameter("Precision for ".concat(name).concat(" shounld be over ".concat(String.valueOf(precision))));
|
||||||
|
}
|
||||||
return bc;
|
return bc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,28 +312,32 @@ public class BddController extends MultiActionController {
|
||||||
|
|
||||||
private String paramNotNull(HttpServletRequest request, String name) throws InvalidParameter {
|
private String paramNotNull(HttpServletRequest request, String name) throws InvalidParameter {
|
||||||
String param = request.getParameter(name);
|
String param = request.getParameter(name);
|
||||||
if (param == null || param.isEmpty())
|
if (param == null || param.isEmpty()) {
|
||||||
throw new InvalidParameter(name.concat(" should not be empty"));
|
throw new InvalidParameter(name.concat(" should not be empty"));
|
||||||
|
}
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String paramLength(HttpServletRequest request, String name, int length) throws InvalidParameter {
|
private String paramLength(HttpServletRequest request, String name, int length) throws InvalidParameter {
|
||||||
String param = request.getParameter(name);
|
String param = request.getParameter(name);
|
||||||
if (param.length() > length)
|
if (param.length() > length) {
|
||||||
throw new InvalidParameter(name.concat(" should not be more than ".concat(String.valueOf(length)).concat(" characters")));
|
throw new InvalidParameter(name.concat(" should not be more than ".concat(String.valueOf(length)).concat(" characters")));
|
||||||
|
}
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String paramLength(String param, String name, int length) throws InvalidParameter {
|
private String paramLength(String param, String name, int length) throws InvalidParameter {
|
||||||
if (param.length() > length)
|
if (param.length() > length) {
|
||||||
throw new InvalidParameter(name.concat(" should not be more than ".concat(String.valueOf(length)).concat(" characters")));
|
throw new InvalidParameter(name.concat(" should not be more than ".concat(String.valueOf(length)).concat(" characters")));
|
||||||
|
}
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String paramAvailable(HttpServletRequest request, String name) throws InvalidParameter {
|
private String paramAvailable(HttpServletRequest request, String name) throws InvalidParameter {
|
||||||
String param = request.getParameter(name).toUpperCase();
|
String param = request.getParameter(name).toUpperCase();
|
||||||
if (!param.equals("TRUE") && !param.equals("FALSE"))
|
if (!param.equals("TRUE") && !param.equals("FALSE")) {
|
||||||
throw new InvalidParameter("It's true or false for ".concat(name));
|
throw new InvalidParameter("It's true or false for ".concat(name));
|
||||||
|
}
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +345,7 @@ public class BddController extends MultiActionController {
|
||||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
try {
|
try {
|
||||||
return format.parse(request.getParameter(name));
|
return format.parse(request.getParameter(name));
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
throw new InvalidParameter("Invalid date for ".concat(name));
|
throw new InvalidParameter("Invalid date for ".concat(name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -404,14 +420,14 @@ public class BddController extends MultiActionController {
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
String type = request.getParameter("type");
|
String type = request.getParameter("type");
|
||||||
ModelAndView mv = new ModelAndView("confirm");
|
ModelAndView mv = new ModelAndView("confirm");
|
||||||
mv.addObject("user",session.getAttribute("user"));
|
mv.addObject("user", session.getAttribute("user"));
|
||||||
mv.addObject("type", type);
|
mv.addObject("type", type);
|
||||||
Object data = fetchDetailsData(request, mv);
|
Object data = fetchDetailsData(request, mv);
|
||||||
|
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
try {
|
try {
|
||||||
new MagasinHelper().add(data);
|
new MagasinHelper().add(data);
|
||||||
mv.addObject("confirm","Save completed");
|
mv.addObject("confirm", "Save completed");
|
||||||
} catch (ConstraintViolationException e) {
|
} catch (ConstraintViolationException e) {
|
||||||
mv.addObject("error", e.getSQLException().getMessage());
|
mv.addObject("error", e.getSQLException().getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -426,14 +442,14 @@ public class BddController extends MultiActionController {
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
String type = request.getParameter("type");
|
String type = request.getParameter("type");
|
||||||
ModelAndView mv = new ModelAndView("confirm");
|
ModelAndView mv = new ModelAndView("confirm");
|
||||||
mv.addObject("user",session.getAttribute("user"));
|
mv.addObject("user", session.getAttribute("user"));
|
||||||
mv.addObject("type", type);
|
mv.addObject("type", type);
|
||||||
Object data = fetchDetailsData(request, mv);
|
Object data = fetchDetailsData(request, mv);
|
||||||
|
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
try {
|
try {
|
||||||
new MagasinHelper().update(data);
|
new MagasinHelper().update(data);
|
||||||
mv.addObject("confirm","Update completed");
|
mv.addObject("confirm", "Update completed");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mv.addObject("error", e.getMessage());
|
mv.addObject("error", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,16 +4,19 @@
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
package service;
|
package service;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author faycal
|
* @author faycal
|
||||||
*/
|
*/
|
||||||
public class User implements Serializable {
|
public class User implements Serializable {
|
||||||
|
|
||||||
private String login;
|
private String login;
|
||||||
private String pwd;
|
private String pwd;
|
||||||
private int userId;
|
private int userId;
|
||||||
static private int compteur=0;
|
static private int compteur = 0;
|
||||||
|
|
||||||
public static int getCompteur() {
|
public static int getCompteur() {
|
||||||
return compteur;
|
return compteur;
|
||||||
|
@ -21,22 +24,24 @@ public class User implements Serializable {
|
||||||
|
|
||||||
public User() {
|
public User() {
|
||||||
super();
|
super();
|
||||||
userId=compteur++;
|
userId = compteur++;
|
||||||
}
|
}
|
||||||
public void finalize(){
|
|
||||||
|
public void finalize() {
|
||||||
|
|
||||||
compteur--;
|
compteur--;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User(String login) {
|
public User(String login) {
|
||||||
this.login = login;
|
this.login = login;
|
||||||
userId=compteur++;
|
userId = compteur++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public User(String login, String pwd) {
|
public User(String login, String pwd) {
|
||||||
this.login = login;
|
this.login = login;
|
||||||
this.pwd = pwd;
|
this.pwd = pwd;
|
||||||
userId=compteur++;
|
userId = compteur++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLogin() {
|
public String getLogin() {
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
<%--
|
|
||||||
Document : deconnexion
|
|
||||||
Created on : 1 juin 2020, 17:09:38
|
|
||||||
Author : faycal
|
|
||||||
--%>
|
|
||||||
|
|
||||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
||||||
<title>Deconnexion</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Vous etes deconnecte</h1>
|
|
||||||
<%response.sendRedirect("/Bdd_Spring_HI/");%>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,18 +0,0 @@
|
||||||
<%--
|
|
||||||
Document : error
|
|
||||||
Created on : 4 mars 2018, 20:54:56
|
|
||||||
Author : faycal
|
|
||||||
--%>
|
|
||||||
|
|
||||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
||||||
<title>Erreur</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<%@include file="header.jsp" %>
|
|
||||||
<h1>${erreur} </h1>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<% response.sendRedirect("menu.htm"); %>
|
<% response.sendRedirect("menu.htm");%>
|
||||||
|
|
||||||
|
|
|
@ -13,20 +13,20 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form method="POST" action="j_security_check">
|
<form method="POST" action="j_security_check">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Utilisateur :</td>
|
<td>Utilisateur :</td>
|
||||||
<td><input type="text" name="j_username"></td>
|
<td><input type="text" name="j_username"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Mot de passe :</td>
|
<td>Mot de passe :</td>
|
||||||
<td><input type="password" name="j_password" ></td>
|
<td><input type="password" name="j_password" ></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><input type="submit" value="Entrer" ></td>
|
<td><input type="submit" value="Entrer" ></td>
|
||||||
<td><input type="reset" value="Annuler"></td>
|
<td><input type="reset" value="Annuler"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<title>Deconnexion</title>
|
<title>Deconnexion</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Vous etes deconnecte</h1>
|
<h1>You are logout</h1>
|
||||||
<%response.sendRedirect("/Bdd_Spring_HI/");%>
|
<%response.sendRedirect("");%>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Reference in a new issue