Update
This commit is contained in:
parent
78fc588327
commit
d4c8826056
55 changed files with 913 additions and 813 deletions
10
.idea/.gitignore
vendored
Normal file
10
.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Zeppelin ignored files
|
||||||
|
/ZeppelinRemoteNotebooks/
|
6
.idea/jpa-buddy.xml
Normal file
6
.idea/jpa-buddy.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JpaBuddyIdeaProjectConfig">
|
||||||
|
<option name="defaultUnitInitialized" value="true" />
|
||||||
|
</component>
|
||||||
|
</project>
|
15
.idea/libraries/Java_EE_6_Java_EE_6.xml
Normal file
15
.idea/libraries/Java_EE_6_Java_EE_6.xml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Java EE 6-Java EE 6">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$PROJECT_DIR$/lib/javax.annotation.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/lib/javax.jms.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/lib/javax.resource.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/lib/javax.ejb.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/lib/javax.servlet.jsp.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/lib/javax.servlet.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/lib/javax.persistence.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</component>
|
51
.idea/libraries/lib.xml
Normal file
51
.idea/libraries/lib.xml
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<component name="libraryTable">
|
||||||
|
<library name="lib">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-context-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/jboss-logging-3.1.3.GA.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-struts-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-jms-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-webmvc-portlet-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/javassist-3.18.1-GA.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-core-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-webmvc-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/jboss-transaction-api_1.2_spec-1.0.0.Final.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/jstl-api.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/hibernate-ehcache-4.3.1.Final.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-jdbc-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/hibernate-entitymanager-4.3.1.Final.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-instrument-tomcat-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/hibernate-c3p0-4.3.1.Final.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-context-support-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/ehcache-core-2.4.3.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/mchange-commons-java-0.2.3.4.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/slf4j-api-1.6.1.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-web-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/slf4j-simple-1.6.1.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-framework-bom-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/hibernate-core-4.3.1.Final.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/c3p0-0.9.2.1.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-aspects-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-expression-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/dom4j-1.6.1.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-build-src-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/hibernate-commons-annotations-4.0.4.Final.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-tx-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/org-apache-commons-logging.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-beans-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-test-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/antlr-2.7.7.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-aop-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/cglib-2.2.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-orm-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-instrument-3.2.7.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-web-3.2.18.RELEASE.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/jstl-impl.jar!/" />
|
||||||
|
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-oxm-3.2.7.RELEASE.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$USER_HOME$/.ideaLibSources/hibernate-core-4.3.1.Final-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
12
.idea/misc.xml
Normal file
12
.idea/misc.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MarkdownSettingsMigration">
|
||||||
|
<option name="stateVersion" value="1" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectType">
|
||||||
|
<option name="id" value="jpab" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/jee-project.iml" filepath="$PROJECT_DIR$/jee-project.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
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.
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
|
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
|
||||||
|
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
|
||||||
<hibernate-configuration>
|
<hibernate-configuration>
|
||||||
<session-factory>
|
<session-factory>
|
||||||
<property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>
|
<property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">
|
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN"
|
||||||
|
"http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">
|
||||||
<hibernate-reverse-engineering>
|
<hibernate-reverse-engineering>
|
||||||
<schema-selection match-schema="APP"/>
|
<schema-selection match-schema="APP"/>
|
||||||
<table-filter match-name="MANUFACTURER"/>
|
<table-filter match-name="MANUFACTURER"/>
|
||||||
|
|
Binary file not shown.
13
jee-project.iml
Normal file
13
jee-project.iml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="lib" level="project" />
|
||||||
|
<orderEntry type="library" name="Java EE 6-Java EE 6" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
BIN
lib/javax.annotation.jar
Normal file
BIN
lib/javax.annotation.jar
Normal file
Binary file not shown.
BIN
lib/javax.ejb.jar
Normal file
BIN
lib/javax.ejb.jar
Normal file
Binary file not shown.
BIN
lib/javax.jms.jar
Normal file
BIN
lib/javax.jms.jar
Normal file
Binary file not shown.
BIN
lib/javax.persistence.jar
Normal file
BIN
lib/javax.persistence.jar
Normal file
Binary file not shown.
BIN
lib/javax.resource.jar
Normal file
BIN
lib/javax.resource.jar
Normal file
Binary file not shown.
BIN
lib/javax.servlet.jar
Normal file
BIN
lib/javax.servlet.jar
Normal file
Binary file not shown.
BIN
lib/javax.servlet.jsp.jar
Normal file
BIN
lib/javax.servlet.jsp.jar
Normal file
Binary file not shown.
|
@ -2,7 +2,6 @@ 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
|
||||||
*/
|
*/
|
||||||
|
@ -31,6 +30,7 @@ public class Customer implements java.io.Serializable {
|
||||||
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;
|
||||||
|
@ -63,6 +63,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 +71,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 +79,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 +87,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 +95,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 +103,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 +111,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 +119,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 +127,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 +135,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 +143,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;
|
||||||
}
|
}
|
||||||
|
@ -142,8 +153,6 @@ public class Customer implements java.io.Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ public class DiscountCode implements java.io.Serializable {
|
||||||
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 +33,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;
|
||||||
}
|
}
|
||||||
|
@ -41,8 +43,6 @@ public class DiscountCode implements java.io.Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
*/
|
*/
|
||||||
package DAO;
|
package DAO;
|
||||||
|
|
||||||
import org.hibernate.cfg.AnnotationConfiguration;
|
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.cfg.AnnotationConfiguration;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,39 +4,39 @@
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
package DAO;
|
package DAO;
|
||||||
import org.hibernate.*;
|
|
||||||
import org.hibernate.cfg.Configuration;
|
import org.hibernate.Query;
|
||||||
import java.util.*;
|
import org.hibernate.Session;
|
||||||
import java.sql.*;
|
import org.hibernate.Transaction;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author faycal
|
* @author faycal
|
||||||
*/
|
*/
|
||||||
public class MagasinHelper {
|
public class MagasinHelper {
|
||||||
Session session = null;
|
Session session;
|
||||||
|
List<String> colonnes = new ArrayList<String>();
|
||||||
public List<String> getColonnes() {
|
|
||||||
return colonnes;
|
|
||||||
}
|
|
||||||
ArrayList <String> colonnes=new ArrayList();
|
|
||||||
|
|
||||||
public MagasinHelper() {
|
public MagasinHelper() {
|
||||||
this.session = HibernateUtil.getSessionFactory().openSession();
|
this.session = HibernateUtil.getSessionFactory().openSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getProducts(){
|
public List<String> getColonnes() {
|
||||||
|
return colonnes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Product> getProducts() {
|
||||||
List<Product> resultat = null;
|
List<Product> resultat = null;
|
||||||
Transaction tx=null;
|
|
||||||
try {
|
try {
|
||||||
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
||||||
tx=session.beginTransaction();
|
session.beginTransaction();
|
||||||
Query q = session.createQuery("select p.productId, p.manufacturerId, p.productCode, p.purchaseCost, p.quantityOnHand, p.markup, p.available, p.description from Product p");
|
Query q = session.createQuery("select p.productId, p.manufacturerId, p.productCode, p.purchaseCost, p.quantityOnHand, p.markup, p.available, p.description from Product p");
|
||||||
resultat = q.list();
|
resultat = q.list();
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -48,17 +48,15 @@ public class MagasinHelper {
|
||||||
|
|
||||||
public Product getProduct(int id) {
|
public Product getProduct(int id) {
|
||||||
Product resultat = null;
|
Product resultat = null;
|
||||||
Transaction tx=null;
|
|
||||||
try {
|
try {
|
||||||
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
||||||
tx=session.beginTransaction();
|
session.beginTransaction();
|
||||||
Query q = session.createQuery("from Product p where p.productId = :_id");
|
Query q = session.createQuery("from Product p where p.productId = :_id");
|
||||||
q.setInteger("_id", id);
|
q.setInteger("_id", id);
|
||||||
resultat = (Product) q.list().iterator().next();
|
resultat = (Product) q.list().iterator().next();
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -68,121 +66,108 @@ public class MagasinHelper {
|
||||||
return resultat;
|
return resultat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getClients(){
|
public List<Customer> getClients() {
|
||||||
List<Customer> resultat = null;
|
List<Customer> resultat = null;
|
||||||
Transaction tx=null;
|
|
||||||
try {
|
try {
|
||||||
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
||||||
tx=session.beginTransaction();
|
session.beginTransaction();
|
||||||
Query q = session.createQuery("select a.customerId, a.name, a.addressline1,a.addressline2,a.zip,b.rate from Customer a, DiscountCode b where a.discountCode=b.discountCode");
|
Query q = session.createQuery("select a.customerId, a.name, a.addressline1,a.addressline2,a.zip,b.rate from Customer a, DiscountCode b where a.discountCode=b.discountCode");
|
||||||
//Query q=session.createQuery("from Customer");
|
|
||||||
resultat = q.list();
|
resultat = q.list();
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
} finally {
|
||||||
finally{
|
|
||||||
if (session.isOpen()) session.close();
|
if (session.isOpen()) session.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultat;
|
return resultat;
|
||||||
}
|
}
|
||||||
public List getClients(String name){
|
|
||||||
List resultat=null;
|
public List<Customer> getClients(String name) {
|
||||||
Transaction tx=null;
|
List<Customer> resultat = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
||||||
tx=session.beginTransaction();
|
session.beginTransaction();
|
||||||
Query q = session.createQuery("select a.customerId, a.name, a.addressline1,a.addressline2,a.zip,b.rate from Customer a, DiscountCode b where a.discountCode=b.discountCode and a.name like :_name");
|
Query q = session.createQuery("select a.customerId, a.name, a.addressline1,a.addressline2,a.zip,b.rate from Customer a, DiscountCode b where a.discountCode=b.discountCode and a.name like :_name");
|
||||||
//Query q=session.createQuery("from Customer");
|
|
||||||
q.setString("_name", name);
|
q.setString("_name", name);
|
||||||
resultat = q.list();
|
resultat = q.list();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
} finally {
|
||||||
finally{
|
|
||||||
if (session.isOpen()) session.close();
|
if (session.isOpen()) session.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultat;
|
return resultat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getDiscountCode(){
|
public List<DiscountCode> getDiscountCode() {
|
||||||
List resultat=null;
|
List<DiscountCode> resultat = null;
|
||||||
Transaction tx=null;
|
|
||||||
try {
|
try {
|
||||||
if (!session.isOpen())
|
if (!session.isOpen())
|
||||||
session = HibernateUtil.getSessionFactory().openSession();
|
session = HibernateUtil.getSessionFactory().openSession();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
||||||
tx=session.beginTransaction();
|
session.beginTransaction();
|
||||||
Query q = session.createQuery("select a.discountCode from DiscountCode a");
|
Query q = session.createQuery("select a.discountCode from DiscountCode a");
|
||||||
resultat = q.list();
|
resultat = q.list();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
} finally {
|
||||||
finally{
|
|
||||||
if (session.isOpen()) session.close();
|
if (session.isOpen()) session.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultat;
|
return resultat;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public List getMicroMarket(){
|
|
||||||
|
public List<MicroMarket> getMicroMarket() {
|
||||||
List<MicroMarket> resultat = null;
|
List<MicroMarket> resultat = null;
|
||||||
Transaction tx=null;
|
|
||||||
try {
|
try {
|
||||||
//if(!session.isOpen())
|
|
||||||
session = HibernateUtil.getSessionFactory().openSession();
|
session = HibernateUtil.getSessionFactory().openSession();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
||||||
tx=session.beginTransaction();
|
session.beginTransaction();
|
||||||
Query q = session.createQuery("from MicroMarket");
|
Query q = session.createQuery("from MicroMarket");
|
||||||
resultat = q.list();
|
resultat = q.list();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
} finally {
|
||||||
finally{
|
|
||||||
if (session.isOpen()) session.close();
|
if (session.isOpen()) session.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultat;
|
return resultat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getZipCode() {
|
public List getZipCode() {
|
||||||
List resultat = null;
|
List resultat = null;
|
||||||
Transaction tx=null;
|
|
||||||
try {
|
try {
|
||||||
//if(!session.isOpen())
|
|
||||||
session = HibernateUtil.getSessionFactory().openSession();
|
session = HibernateUtil.getSessionFactory().openSession();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
||||||
tx=session.beginTransaction();
|
session.beginTransaction();
|
||||||
Query q = session.createQuery("select a.zipCode from MicroMarket a");
|
Query q = session.createQuery("select a.zipCode from MicroMarket a");
|
||||||
resultat = q.list();
|
resultat = q.list();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
} finally {
|
||||||
finally{
|
|
||||||
if (session.isOpen()) session.close();
|
if (session.isOpen()) session.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultat;
|
return resultat;
|
||||||
}
|
}
|
||||||
public void insertCustomer (int _customerId, char _discountCode, String _zip) {
|
|
||||||
|
|
||||||
|
public void insertCustomer(int _customerId, char _discountCode, String _zip) {
|
||||||
Transaction tx = null;
|
Transaction tx = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
@ -191,59 +176,50 @@ public void insertCustomer (int _customerId, char _discountCode, String _zip) {
|
||||||
Customer a = new Customer(_customerId, _discountCode, _zip);
|
Customer a = new Customer(_customerId, _discountCode, _zip);
|
||||||
session.save(a);
|
session.save(a);
|
||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
assert tx != null;
|
||||||
tx.rollback();
|
tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
} finally {
|
||||||
finally{
|
|
||||||
if (session.isOpen()) session.close();
|
if (session.isOpen()) session.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateCustomer(int _customerId, char _discountCode, String _name, String _adress, String _phone, String _email, String _zip) {
|
public void updateCustomer(int _customerId, char _discountCode, String _name, String _adress, String _phone, String _email, String _zip) {
|
||||||
|
|
||||||
Transaction tx = null;
|
Transaction tx = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
||||||
tx = session.beginTransaction();
|
tx = session.beginTransaction();
|
||||||
|
|
||||||
Customer a = new Customer(_customerId, _discountCode, _name, _adress, _phone, _email, _zip);
|
Customer a = new Customer(_customerId, _discountCode, _name, _adress, _phone, _email, _zip);
|
||||||
|
|
||||||
session.update(a);
|
session.update(a);
|
||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
assert tx != null;
|
||||||
tx.rollback();
|
tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
} finally {
|
||||||
finally{
|
|
||||||
if (session.isOpen()) session.close();
|
if (session.isOpen()) session.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Customer getClient(int id) {
|
public Customer getClient(int id) {
|
||||||
|
|
||||||
|
|
||||||
Customer client = null;
|
Customer client = null;
|
||||||
Transaction tx=null;
|
|
||||||
try {
|
try {
|
||||||
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
||||||
session.flush();
|
session.flush();
|
||||||
tx=session.beginTransaction();
|
session.beginTransaction();
|
||||||
Query q = session.createQuery(" from Customer a where a.customerId =:_id");
|
Query q = session.createQuery(" from Customer a where a.customerId =:_id");
|
||||||
q.setInteger("_id", id);
|
q.setInteger("_id", id);
|
||||||
client = (Customer) q.list().iterator().next();
|
client = (Customer) q.list().iterator().next();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
} finally {
|
||||||
finally{
|
|
||||||
if (session.isOpen()) session.close();
|
if (session.isOpen()) session.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,8 +227,8 @@ public Customer getClient(int id){
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteCustomer(int _id) {
|
public void deleteCustomer(int _id) {
|
||||||
|
|
||||||
Transaction tx = null;
|
Transaction tx = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
@ -260,35 +236,31 @@ public void deleteCustomer (int _id) {
|
||||||
tx = session.beginTransaction();
|
tx = session.beginTransaction();
|
||||||
Query q = session.createQuery(" from Customer a where a.customerId =:_id");
|
Query q = session.createQuery(" from Customer a where a.customerId =:_id");
|
||||||
q.setInteger("_id", _id);
|
q.setInteger("_id", _id);
|
||||||
session.delete((Customer)q.list().iterator().next());
|
session.delete(q.list().iterator().next());
|
||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
assert tx != null;
|
||||||
tx.rollback();
|
tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
} finally {
|
||||||
finally{
|
|
||||||
if (session.isOpen()) session.close();
|
if (session.isOpen()) session.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PurchaseOrder> getPurchase() {
|
public List<PurchaseOrder> getPurchase() {
|
||||||
List resultat=null;
|
List<PurchaseOrder> resultat = null;
|
||||||
Transaction tx=null;
|
|
||||||
try {
|
try {
|
||||||
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
||||||
tx=session.beginTransaction();
|
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.customerId, po.productId, po.quantity, po.shippingCost, po.salesDate, po.shippingDate, po.freightCompany from PurchaseOrder po");
|
||||||
resultat=(List<PurchaseOrder>)q.list();
|
resultat = q.list();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
} finally {
|
||||||
finally{
|
|
||||||
if (session.isOpen()) session.close();
|
if (session.isOpen()) session.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,21 +268,19 @@ public void deleteCustomer (int _id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PurchaseOrder> getPurchase(int id) {
|
public List<PurchaseOrder> getPurchase(int id) {
|
||||||
List resultat=null;
|
List<PurchaseOrder> resultat = null;
|
||||||
Transaction tx=null;
|
|
||||||
try {
|
try {
|
||||||
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
||||||
tx=session.beginTransaction();
|
session.beginTransaction();
|
||||||
Query q = session.createQuery(" from PurchaseOrder a where a.customerId=:_id");
|
Query q = session.createQuery(" from PurchaseOrder a where a.customerId=:_id");
|
||||||
q.setInteger("_id", id);
|
q.setInteger("_id", id);
|
||||||
resultat=(List<PurchaseOrder>)q.list();
|
resultat = q.list();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
} finally {
|
||||||
finally{
|
|
||||||
if (session.isOpen()) session.close();
|
if (session.isOpen()) session.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,21 +288,18 @@ public void deleteCustomer (int _id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxId() {
|
public int getMaxId() {
|
||||||
Transaction tx=null;
|
|
||||||
int resultat = -1;
|
int resultat = -1;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
||||||
tx=session.beginTransaction();
|
session.beginTransaction();
|
||||||
Query q = session.createQuery("select MAX(a.customerId) from Customer a");
|
Query q = session.createQuery("select MAX(a.customerId) from Customer a");
|
||||||
|
|
||||||
resultat = (int) q.list().iterator().next();
|
resultat = (int) q.list().iterator().next();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
} finally {
|
||||||
finally{
|
|
||||||
if (session.isOpen()) session.close();
|
if (session.isOpen()) session.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ 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
|
||||||
*/
|
*/
|
||||||
|
@ -28,6 +27,7 @@ public class Manufacturer implements java.io.Serializable {
|
||||||
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 +49,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 +57,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 +65,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 +73,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 +81,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 +89,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 +97,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 +105,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 +113,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 +121,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;
|
||||||
}
|
}
|
||||||
|
@ -121,8 +131,6 @@ public class Manufacturer implements java.io.Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ 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
|
||||||
*/
|
*/
|
||||||
|
@ -21,6 +20,7 @@ public class MicroMarket implements java.io.Serializable {
|
||||||
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 +35,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 +43,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 +51,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;
|
||||||
}
|
}
|
||||||
|
@ -58,8 +61,6 @@ public class MicroMarket implements java.io.Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ public class Product implements java.io.Serializable {
|
||||||
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 +47,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 +55,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 +63,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 +71,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 +79,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 +87,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 +95,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;
|
||||||
}
|
}
|
||||||
|
@ -97,8 +105,6 @@ public class Product implements java.io.Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ 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
|
||||||
*/
|
*/
|
||||||
|
@ -21,6 +20,7 @@ public class ProductCode implements java.io.Serializable {
|
||||||
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 +34,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 +42,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;
|
||||||
}
|
}
|
||||||
|
@ -50,8 +52,6 @@ public class ProductCode implements java.io.Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class PurchaseOrder implements java.io.Serializable {
|
||||||
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 +48,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 +56,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 +64,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 +72,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 +80,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 +88,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 +96,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;
|
||||||
}
|
}
|
||||||
|
@ -98,8 +106,6 @@ public class PurchaseOrder implements java.io.Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,31 +4,26 @@
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
package controller;
|
package controller;
|
||||||
import DAO.*;
|
|
||||||
|
import DAO.MagasinHelper;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
|
||||||
import service.User;
|
import service.User;
|
||||||
import java.util.*;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import javax.servlet.http.HttpSession;
|
||||||
import org.springframework.context.ApplicationContext;
|
import java.util.Arrays;
|
||||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
import java.util.HashMap;
|
||||||
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
|
|
||||||
import javax.servlet.http.*;
|
|
||||||
import javax.servlet.*;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author faycal
|
* @author faycal
|
||||||
*/
|
*/
|
||||||
public class BddController extends MultiActionController {
|
public class BddController extends MultiActionController {
|
||||||
private String login;
|
private String login;
|
||||||
private String pwd;
|
|
||||||
private User utilisateur;
|
private User utilisateur;
|
||||||
private HttpSession session;
|
private HttpSession session;
|
||||||
public BddController() {}
|
|
||||||
|
|
||||||
private void sessionInit(HttpServletRequest request) {
|
private void sessionInit(HttpServletRequest request) {
|
||||||
if (login == null)
|
if (login == null)
|
||||||
|
@ -42,25 +37,21 @@ public class BddController extends MultiActionController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
|
||||||
HttpServletResponse response){
|
public ModelAndView logout(HttpServletRequest request, HttpServletResponse response) {
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
request.getSession().invalidate();
|
request.getSession().invalidate();
|
||||||
|
|
||||||
|
|
||||||
return new ModelAndView("deconnexion");
|
return new ModelAndView("deconnexion");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelAndView list(HttpServletRequest request,
|
public ModelAndView list(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
HttpServletResponse response) throws Exception {
|
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
String type = request.getAttribute("type").toString();
|
String type = request.getAttribute("type").toString();
|
||||||
ModelAndView mv = new ModelAndView("resultat");
|
ModelAndView mv = new ModelAndView("resultat");
|
||||||
|
@ -106,19 +97,16 @@ public class BddController extends MultiActionController {
|
||||||
return list(request, response);
|
return list(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelAndView add(HttpServletRequest request,
|
public ModelAndView add(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
HttpServletResponse response) throws Exception {
|
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
|
|
||||||
ModelAndView mv = new ModelAndView("form_inscription");
|
ModelAndView mv = new ModelAndView("form_inscription");
|
||||||
|
|
||||||
mv.addObject("user", session.getAttribute("user"));
|
mv.addObject("user", session.getAttribute("user"));
|
||||||
mv.addObject("discount", new MagasinHelper().getDiscountCode());
|
mv.addObject("discount", new MagasinHelper().getDiscountCode());
|
||||||
mv.addObject("code", new MagasinHelper().getZipCode());
|
mv.addObject("code", new MagasinHelper().getZipCode());
|
||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
public ModelAndView detail(HttpServletRequest request,
|
|
||||||
HttpServletResponse response) throws Exception {
|
public ModelAndView detail(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
String type = request.getParameter("type");
|
String type = request.getParameter("type");
|
||||||
ModelAndView mv = new ModelAndView("detail");
|
ModelAndView mv = new ModelAndView("detail");
|
||||||
|
@ -146,47 +134,40 @@ public class BddController extends MultiActionController {
|
||||||
|
|
||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
public ModelAndView find(HttpServletRequest request,
|
|
||||||
HttpServletResponse response) throws Exception {
|
public ModelAndView find(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
|
|
||||||
ModelAndView mv;
|
ModelAndView mv;
|
||||||
MagasinHelper requeteur = new MagasinHelper();
|
MagasinHelper requeteur = new MagasinHelper();
|
||||||
|
|
||||||
if (requeteur.getClients(request.getParameter("nom")).isEmpty() || request.getParameter("nom").equals("%")) {
|
if (requeteur.getClients(request.getParameter("nom")).isEmpty() || request.getParameter("nom").equals("%")) {
|
||||||
mv = new ModelAndView("error");
|
mv = new ModelAndView("error");
|
||||||
mv.addObject("erreur", "0 enregistrement");
|
mv.addObject("erreur", "0 enregistrement");
|
||||||
|
} else {
|
||||||
}
|
|
||||||
else{
|
|
||||||
mv = new ModelAndView("resultat");
|
mv = new ModelAndView("resultat");
|
||||||
mv.addObject("liste", requeteur.getClients(request.getParameter("nom")));
|
mv.addObject("liste", requeteur.getClients(request.getParameter("nom")));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mv.addObject("user", session.getAttribute("user"));
|
mv.addObject("user", session.getAttribute("user"));
|
||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
public ModelAndView formfind(HttpServletRequest request,
|
|
||||||
HttpServletResponse response) throws Exception {
|
public ModelAndView formfind(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
return new ModelAndView("recherche");
|
return new ModelAndView("recherche");
|
||||||
}
|
}
|
||||||
public ModelAndView achats(HttpServletRequest request,
|
|
||||||
HttpServletResponse response) throws Exception {
|
public ModelAndView achats(HttpServletRequest request, 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"));
|
||||||
System.out.println("num " + Integer.parseInt(request.getParameter("numero")));
|
System.out.println("num " + Integer.parseInt(request.getParameter("numero")));
|
||||||
|
|
||||||
mv.addObject("achats", new MagasinHelper().getPurchase(Integer.parseInt(request.getParameter("numero"))));
|
mv.addObject("achats", new MagasinHelper().getPurchase(Integer.parseInt(request.getParameter("numero"))));
|
||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelAndView save(HttpServletRequest request,
|
public ModelAndView save(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
HttpServletResponse response) throws Exception {
|
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
String param1 = request.getParameter("nom");
|
String param1 = request.getParameter("nom");
|
||||||
String param2 = request.getParameter("adresse");
|
String param2 = request.getParameter("adresse");
|
||||||
|
@ -196,18 +177,15 @@ public class BddController extends MultiActionController {
|
||||||
String param6 = request.getParameter("CP");
|
String param6 = request.getParameter("CP");
|
||||||
new MagasinHelper().insertCustomer(new MagasinHelper().getMaxId() + 1, param5.charAt(0), param6);
|
new MagasinHelper().insertCustomer(new MagasinHelper().getMaxId() + 1, param5.charAt(0), param6);
|
||||||
return new ModelAndView("confirm").addObject("confirm", "enregistrement effectué");
|
return new ModelAndView("confirm").addObject("confirm", "enregistrement effectué");
|
||||||
|
|
||||||
}
|
}
|
||||||
public ModelAndView delete(HttpServletRequest request,
|
|
||||||
HttpServletResponse response) throws Exception {
|
|
||||||
sessionInit(request);
|
|
||||||
|
|
||||||
|
public ModelAndView delete(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
|
sessionInit(request);
|
||||||
new MagasinHelper().deleteCustomer(Integer.parseInt(request.getParameter("numero")));
|
new MagasinHelper().deleteCustomer(Integer.parseInt(request.getParameter("numero")));
|
||||||
return new ModelAndView("confirm").addObject("confirm", "suppression effectuée");
|
return new ModelAndView("confirm").addObject("confirm", "suppression effectuée");
|
||||||
|
|
||||||
}
|
}
|
||||||
public ModelAndView update(HttpServletRequest request,
|
|
||||||
HttpServletResponse response) throws Exception {
|
public ModelAndView update(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
sessionInit(request);
|
sessionInit(request);
|
||||||
String param1 = request.getParameter("numero");
|
String param1 = request.getParameter("numero");
|
||||||
String param2 = request.getParameter("code_remise");
|
String param2 = request.getParameter("code_remise");
|
||||||
|
@ -217,10 +195,8 @@ public class BddController extends MultiActionController {
|
||||||
String param6 = request.getParameter("email");
|
String param6 = request.getParameter("email");
|
||||||
String param7 = request.getParameter("CP");
|
String param7 = request.getParameter("CP");
|
||||||
System.out.println(request.getParameter("CP"));
|
System.out.println(request.getParameter("CP"));
|
||||||
|
new MagasinHelper().updateCustomer(Integer.parseInt(param1), param2.charAt(0), param3, param4, param5, param6, param7);
|
||||||
new MagasinHelper().updateCustomer(Integer.valueOf(param1),param2.charAt(0),param3,param4,param5,param6,param7);
|
|
||||||
return new ModelAndView("confirm").addObject("confirm", "mise à jour effectuée");
|
return new ModelAndView("confirm").addObject("confirm", "mise à jour effectuée");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
|
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
|
||||||
|
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
|
||||||
<hibernate-configuration>
|
<hibernate-configuration>
|
||||||
<session-factory>
|
<session-factory>
|
||||||
<property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>
|
<property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">
|
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN"
|
||||||
|
"http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">
|
||||||
<hibernate-reverse-engineering>
|
<hibernate-reverse-engineering>
|
||||||
<schema-selection match-schema="APP"/>
|
<schema-selection match-schema="APP"/>
|
||||||
<table-filter match-name="MANUFACTURER"/>
|
<table-filter match-name="MANUFACTURER"/>
|
||||||
|
|
|
@ -4,29 +4,23 @@
|
||||||
* 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 {
|
||||||
|
static private int compteur = 0;
|
||||||
|
private final int userId;
|
||||||
private String login;
|
private String login;
|
||||||
private String pwd;
|
private String pwd;
|
||||||
private int userId;
|
|
||||||
static private int compteur=0;
|
|
||||||
|
|
||||||
public static int getCompteur() {
|
|
||||||
return compteur;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User() {
|
public User() {
|
||||||
super();
|
super();
|
||||||
userId = compteur++;
|
userId = compteur++;
|
||||||
}
|
}
|
||||||
public void finalize(){
|
|
||||||
|
|
||||||
compteur--;
|
|
||||||
}
|
|
||||||
public User(String login) {
|
public User(String login) {
|
||||||
this.login = login;
|
this.login = login;
|
||||||
userId = compteur++;
|
userId = compteur++;
|
||||||
|
@ -39,6 +33,15 @@ public class User implements Serializable {
|
||||||
userId = compteur++;
|
userId = compteur++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getCompteur() {
|
||||||
|
return compteur;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void finalize() {
|
||||||
|
|
||||||
|
compteur--;
|
||||||
|
}
|
||||||
|
|
||||||
public String getLogin() {
|
public String getLogin() {
|
||||||
return login;
|
return login;
|
||||||
}
|
}
|
||||||
|
@ -54,5 +57,4 @@ public class User implements Serializable {
|
||||||
public void setPwd(String pwd) {
|
public void setPwd(String pwd) {
|
||||||
this.pwd = pwd;
|
this.pwd = pwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue