Package com.netflox.model

Examples of com.netflox.model.Vente


    try {
      PreparedStatement preStat = (PreparedStatement) connex.prepareStatement(select);   
      preStat.setInt(1, c.getId());       
      ResultSet rs = preStat.executeQuery();
      while(rs.next()){
        Vente v = new Vente();
        v.setId(rs.getInt(1));
        v.setIdFilm(rs.getString(2));
        v.setDate(rs.getLong(3));
        v.setPrix(rs.getInt(4));
        v.setIdClient(rs.getInt(5));
        v.setType(rs.getString(6));
        l.add(v);
      }
     
    } catch (SQLException ignore) {     
      System.out.println("erreur venteUtilisateur : " + ignore);
View Full Code Here


    MysqlGestionVente venteBD = new MysqlGestionVente();
    //si bon valide
    if(b.getId() != 0){
      if((solde + b.getMontant()) >= PrixFilm){
        //gestion BD vente
        Vente v = new Vente();
        v.setIdFilm(idFilm);
        v.setIdClient(user.getId());
        v.setPrix(PrixFilm);
        v.setType("a");
        date = System.currentTimeMillis();
        v.setDate(date);
        int id = venteBD.ajouterVente(v);
        if(id != -1){
          db.updateSolde(user, (b.getMontant()-PrixFilm));
          v.setId(id);
          //Mise a jour Bon
          b.setDateU(date);
          b.setIdClientU(user.getId());
          b.setUtilise(1);
          b.setIdFilm(idFilm);
          b.setType("a");
          venteBD.updateBon(b);
          return true;
        }
      }
    }else{
      if(solde >= PrixFilm){
        //gestion BD vente
        Vente v = new Vente();
        v.setIdFilm(idFilm);
        v.setIdClient(user.getId());
        v.setPrix(PrixFilm);
        v.setType("a");
        date = System.currentTimeMillis();
        v.setDate(date);
        int id = venteBD.ajouterVente(v);
        if(id != -1){
          db.updateSolde(user, -PrixFilm);
          v.setId(id);
          return true;
        }
      }
    }
    return false;
View Full Code Here

    MysqlGestionVente venteBD = new MysqlGestionVente();
    //si bon valide
    if(b.getId() != 0){
      if((solde + b.getMontant()) >= PrixLoc){   
        //gestion BD vente
        Vente v = new Vente();
        v.setIdFilm(idFilm);
        v.setIdClient(user.getId());
        v.setPrix(PrixLoc);
        v.setType("l");
        date = System.currentTimeMillis();
        v.setDate(date);
        int id = venteBD.ajouterVente(v);
        if(id != -1){
          db.updateSolde(user, (b.getMontant()-PrixLoc));
          v.setId(id);
          //Mise a jour Bon
          b.setDateU(date);
          b.setIdClientU(user.getId());
          b.setUtilise(1);
          b.setIdFilm(idFilm);
          b.setType("l");
          venteBD.updateBon(b);
          return true;
        }
      }
    }else{
      if(solde >= PrixLoc){   
        //gestion BD vente
        Vente v = new Vente();
        v.setIdFilm(idFilm);
        v.setIdClient(user.getId());
        v.setPrix(PrixLoc);
        v.setType("l");
        date = System.currentTimeMillis();
        v.setDate(date);
        int id = venteBD.ajouterVente(v);
        if(id != -1){
          db.updateSolde(user, -PrixLoc);
          v.setId(id);
          return true;
        }
      }
    }
    return false;
View Full Code Here

    int solde = getSolde();
    MysqlGestionUtilisateur db = new MysqlGestionUtilisateur();
    MysqlGestionVente venteBD = new MysqlGestionVente();
    if(solde >= valeur){
      //gestion BD bon et vente
      Vente v = new Vente();
      v.setIdClient(user.getId());
      v.setPrix(valeur);
      v.setType("b");
      v.setDate(date); //TODO
      int id = venteBD.ajouterVente(v);
      if(id != -1){
        db.updateSolde(user, -valeur);
        v.setId(id);
        Bon b = new Bon();
        b.setId(id);
        b.setMontant(valeur);
        b.genererCode();
        venteBD.ajouterBon(b);
View Full Code Here

TOP

Related Classes of com.netflox.model.Vente

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.