Package base

Examples of base.Client


    pSelectClient.clearParameters();
    pSelectClient.setString(1,idClient);
   
    ResultSet rsClient = pSelectClient.executeQuery();
   
    Client c = null;
   
    if(rsClient.next()){
     
      String nom = rsClient.getString(2);
      String prenom = rsClient.getString(3);
      String adresse = rsClient.getString(4);
      String mdp = rsClient.getString(5);
      c = new Client(idClient,nom,prenom,adresse,mdp);   
     
      pSelectCommandesClient.clearParameters();
      pSelectCommandesClient.setString(1,c.getId());
      ResultSet rsCommandesClient = pSelectCommandesClient.executeQuery();
      while(rsCommandesClient.next()){
        String idCommande = rsCommandesClient.getString(1);       
        c.ajouterCommande(idCommande);       
      }
     
     
    }else{
      // on ne retourne pas null
View Full Code Here


   * @see interfaces.commandes.IMetierCommandes#rechercherCommandesClient(java.lang.String)
   */
  public ArrayList<Commande> rechercherCommandesClient(String idClient)
      throws RemoteException, MetierException {
    /* d'abord recherche du client */
    Client cli;
    try {
      cli = fcli.rechercherClient(idClient);
    } catch (SQLException e) {
      throw new MetierException(MetierException.CONNEXION_IMPOSSIBLE);
    } catch (FactoriesException e) {
      // le client n'existe pas
      throw new MetierException(e.getMessage());
    }
   
    // liste des commandes
    ArrayList<Commande> sesCommandes = new ArrayList<Commande>();
   
    for(Iterator<String> it = cli.getLesCommandes().iterator(); it.hasNext(); ){
      String refCde = it.next();
      try {
        Commande cde = fc.rechercherCommande(refCde, idClient);
        // ajout de la commande trouvee dans la liste
        sesCommandes.add(cde);
View Full Code Here

   * @see interfaces.commandes.IMetierCommandes#rechercherCommandesClient(java.lang.String)
   */
  public ArrayList<Commande> rechercherCommandesClient(String idClient)
      throws RemoteException, MetierException {
    /* d'abord recherche du client */
    Client cli;
    try {
      cli = fcli.rechercherClient(idClient);
    } catch (SQLException e) {
      throw new MetierException(MetierException.CONNEXION_IMPOSSIBLE);
    } catch (FactoriesException e) {
      // le client n'existe pas
      throw new MetierException(e.getMessage());
    }
   
    // liste des commandes
    ArrayList<Commande> sesCommandes = new ArrayList<Commande>();
   
    for(Iterator<String> it = cli.getLesCommandes().iterator(); it.hasNext(); ){
      String refCde = it.next();
      try {
        Commande cde = fc.rechercherCommande(refCde, idClient);
        // ajout de la commande trouvee dans la liste
        sesCommandes.add(cde);
View Full Code Here

      /* On invalide la session */
      HttpSession session = req.getSession();
      req.setAttribute(Message.TITRE_MESSAGE,Message.TITRE_DECO);
      req.setAttribute(Message.MESSAGE, Message.DECO);
      if(session != null){   
        Client client = (Client)session.getAttribute("client");
        if(client != null){
          session.invalidate();
        }else{
          return erreur;
        }
View Full Code Here

                             
         
          try{         
            HttpSession session = req.getSession(false);
            if(session != null){
              Client client = (Client)session.getAttribute("client");
              if(client == null){
                throw new MetierException();
              }
              System.out.println("Adresse : "+adresse);
              // On modifie l'adresse du client
              client.setAdresse(adresse);
              mc.modifierAdresse(client);
             
              // On remet l'adresse dans la session
              session.setAttribute("client", client);
             
View Full Code Here

      try {
       
        System.out.println("ID = "+id);
        System.out.println("MDP = "+mdp);
       
        Client client = mc.rechercherClient(id);
        System.out.println("Client = "+client);
        if(!client.getMdp().equals(mdp)){
          req.setAttribute(Message.MESSAGE_ERREUR, Message.MDP_INCORRECTE);
          return erreur;
        }     
        HttpSession session = req.getSession(true);
        session.setAttribute("client", client);   
View Full Code Here

       
        IMetierCommandes mcom = (IMetierCommandes)req.getSession().getServletContext().getAttribute("metierCommandes");
        //MetierCommandes mcom = new MetierCommandes();
       
       
        Client client = (Client)session.getAttribute("client");
        if(client == null){
          // Le client n'est pas identifié, aller à la page de login
          req.setAttribute(Message.ACTION_VALIDATION, Message.VALIDATION);         
          return suiteSiNonLogue;
        }
       
       
        if(actionValidation.equals(Message.VALIDATION)){
          // Récapitulatif de la réservation => Calcul du délai de livraison
          //Commande c = new Commande();
          int numCmd = client.getLesCommandes().size()+1;
          String idCommande = client.getId()+numCmd;
          java.util.Date today = new java.util.Date();
          Commande c = new Commande(idCommande,client.getId(),new Date(today.getTime()));
          
          Iterator itProduits = panier.getProduits().keySet().iterator();
         
          while(itProduits.hasNext()){           
            String idP = (String)itProduits.next();
View Full Code Here

    pSelectClient.clearParameters();
    pSelectClient.setString(1,idClient);
   
    ResultSet rsClient = pSelectClient.executeQuery();
   
    Client c = null;
   
    if(rsClient.next()){
     
      String nom = rsClient.getString(2);
      String prenom = rsClient.getString(3);
      String adresse = rsClient.getString(4);
      String mdp = rsClient.getString(5);
      c = new Client(idClient,nom,prenom,adresse,mdp);   
     
      pSelectCommandesClient.clearParameters();
      pSelectCommandesClient.setString(1,c.getId());
      ResultSet rsCommandesClient = pSelectCommandesClient.executeQuery();
      while(rsCommandesClient.next()){
        String idCommande = rsCommandesClient.getString(1);       
        c.ajouterCommande(idCommande);       
      }
     
     
    }else{
      // on ne retourne pas null
View Full Code Here

            return erreur;
          }
                   
         
          try{           
            Client client = new Client();
            client.setId(id);
            client.setNom(nom);
            client.setPrenom(prenom);
            client.setAdresse(adresse);
            client.setMdp(mdp);
            mc.creerClient(client);
            HttpSession session = req.getSession(true);
            session.setAttribute("client", client);
           
            // Tout est Ok
View Full Code Here

     
      try{     
        HttpSession session = req.getSession(false);
        if (session != null) {
          Client client = (Client) session.getAttribute("client");
          if (client == null) {
            throw new MetierException();
          }
         
          // On modifie l'adresse du client       
          ArrayList<Commande> lesCommandes = mc.rechercherCommandesClient(client.getId());
          HashMap<String,Commande> mapCmds = new HashMap<String,Commande>();
          Iterator it = lesCommandes.iterator();
          while(it.hasNext()){
            Commande c = (Commande)it.next();
            mapCmds.put(c.getIdCommande(), c);
View Full Code Here

TOP

Related Classes of base.Client

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.