1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
| package com.iris;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import java.sql.*;
/*import java.lang.*;
/**
*
* @author hedi
*/
@WebService()
public class NewWebService {
private String etatfact;
static int distcode ;
int tournee ;
int ordre ;
int categcode ;
int rolecode ;
int reference ;
int montant ;
/**
* Web service operation
*/
public void setetatfact(String v) {
this.etatfact = v;
}
public String getetatfact() {
return this.etatfact;
}
/* @WebMethod(operationName = "cosult_imp")
public String cosult_imp(integer distcode, integer tournee, integer ordre, integer categcode, integer rolecode, integer reference, numeric montant)
{
ResultSet res=null;
try {
String sql = "select etat from facture where idfac=" + idfacture + " and reference=" + reference;
if(SQLManager.ConnectBase()==true) {
Statement statement = SQLManager.connection.createStatement();
res=statement.executeQuery(sql);
if (res.next()){
Boolean bb = res.getBoolean("etat");
System.out.println(bb.toString());
setetatfact(bb.toString());
}
}else{
System.out.println("ERREUR CONNEXTION");
}
}catch(Exception e){
System.out.println(e.toString());
}
/* {
try
{
Class.forName("org.postgresql.Driver");
Connection connexion = DriverManager.getConnection("jdbc:postgresql://<127.0.0.1>:<5432>/<bddemosonede2>", "postgres", "admin");
java.sql.Statement instruction=connexion.createStatement() ;
ResultSet retour= instruction.executeQuery("select etat from facture where idfac="+idfacture+" and reference="+reference );
System.out.println("select etat from facture where idfac="+idfacture+" and reference="+reference );
if (retour.next()){
//Envoyer une requete Deux Methode
//Requete sans retour de donnée (INSERT, CREATE....)
//boolean retour= instruction.execute("requete sql");
//Requete avec retour de donnée (SELECT)
boolean bb = retour.getBoolean("etat");
System.out.println(bb);
setetatfact("tttt");
}
connexion.close();
}
catch
(Exception sql_erreur) {
//Gestion de l'exception d'erreur de connection à la base ou erreur de requete sql
System.err.print("Erreur SQL ") ;
}*/
//TODO write your implementation code here:
/* return getetatfact();
}
/**
* Web service operation
*/
@WebMethod(operationName = "consulter_imp")
public String consulter_imp(@WebParam(name = "distcode")
int distcode, @WebParam(name = "tournee")
int tournee, @WebParam(name = "ordre")
int ordre, @WebParam(name = "categcode")
int categcode, @WebParam(name = "rolecode")
int rolecode, @WebParam(name = "reference")
int reference, @WebParam(name = "montant")
int montant) {
ResultSet res=null;
try {
String sql = "select etat from facture where distcode=" + distcode + " and tournee=" + tournee + "and ordre="+ordre+"and categcode="+categcode+"and rolecode="+rolecode+"and reference="+reference+"and montant="+montant;
if(SQLManager.ConnectBase()==true)
{
Statement statement = SQLManager.connection.createStatement();
res=statement.executeQuery(sql);
if (res.next())
{
distcode=res.getInt("distcode");
tournee=res.getInt("tournee");
ordre=res.getInt("ordre");
categcode=res.getInt("categcode");
rolecode=res.getInt("rolecode");
reference=res.getInt("reference");
montant=res.getInt("montant");
Boolean bb = res.getBoolean("etat");
System.out.println(bb.toString());
setetatfact(bb.toString());
}
else
{
setetatfact("Pas de facture; parametres : faux ou inexistants");
}
}
}
catch(Exception e)
{
System.out.println(e.toString());
}
//TODO write your implementation code here:
return getetatfact();
}
} |
Partager