Package interfaces.commandes

Examples of interfaces.commandes.IMetierCommandes


  private class PublierCommandes extends Thread{
    public void run(){
      try{
//            registration du metier Commandes.
            String name = "MetierCommandes";
            IMetierCommandes metierCommandes = new MetierCommandes();           
            IMetierCommandes stubCde =
                (IMetierCommandes) UnicastRemoteObject.exportObject(metierCommandes, port);
            System.out.println("Registration de "+name);
           
           
            String urlMetier = URL_RMI+name;
View Full Code Here


      String urlClients = URL_RMI+"MetierClients";
     
      System.out.println("Lookup Catalogue");
      IMetierCatalogue imCat = (IMetierCatalogue) Naming.lookup(urlCatalogue);
      System.out.println("Lookup Commandes");
      IMetierCommandes imCom = (IMetierCommandes) Naming.lookup(urlCommandes);
      System.out.println("Lookup Produits");
      IMetierProduits imPdts = (IMetierProduits) Naming.lookup(urlProduits);
      System.out.println("Lookup Clients");
      IMetierClients imCl = (IMetierClients) Naming.lookup(urlClients);
     
View Full Code Here

            panier.retirerProduit(idProduit);
          }
       
      }else if(actionValidation != null){ // Validation du panier
       
        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();
            //Produit p = (Produit)panier.getProduit(idP);
            int qte = panier.getQuantite(idP);
            c.ajouterProduit(idP, qte);
           
          }
                   
          // On fixe le montant du panier
          c.setPrixTotal(panier.getMontant());
          session.setAttribute("commande", c);
         
          try{
            req.setAttribute(Message.ACTION_VALIDATION, Message.AFF_VALIDATION);
            int delaiPrevu = mcom.getDelai(c);
            session.setAttribute("delai", new Integer(delaiPrevu));
          }catch(MetierException me){
            req.setAttribute(Message.MESSAGE_ERREUR, Message.ERREUR_VALIDATION);
            System.out.println("Delai Inconnu");
          }
         
        }else if(actionValidation.equals(Message.CONFIRMATION)){
          try{
            // Confirmation de la commande
            req.setAttribute(Message.ACTION_VALIDATION, Message.AFF_CONFIRMATION);
            Commande c = (Commande)session.getAttribute("commande");
            if(c== null){
              throw new MetierException(Message.ERREUR_CONFIRMATION);
            }
            mcom.ajouterCommande(c);
           
            req.setAttribute(Message.TITRE_MESSAGE,Message.TITRE_CMD);
            req.setAttribute(Message.MESSAGE, Message.CMD);
            // On retire les infos de la session
            session.removeAttribute("panier");
View Full Code Here

  public String execute(HttpServletRequest req) throws Exception {
    String idProduit = req.getParameter("idCommande");
   
    //MetierCommandes mc = new MetierCommandes();
    IMetierCommandes mc = (IMetierCommandes)req.getSession().getServletContext().getAttribute("metierCommandes");
   
    /*if (idProduit != null) {*/

     
      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 interfaces.commandes.IMetierCommandes

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.