Package com.ledruide.druidecave.dao

Examples of com.ledruide.druidecave.dao.Vigneron


        columnNames = LES_TITRES;
        dataVector = new Vector();
    }

    public Object getValueAt(int row, int col) {
        Vigneron objet = (Vigneron)dataVector.get(row);
        if (objet != null) {
            try {
                switch (col) {
                    case INDEX_NOM:
                        return objet.getFirstname() + " " + objet.getLastname();
                    case INDEX_PAYS:
                        String countryKey = objet.getCountry_id();
                        if (countryKey != null) {
                            return CountryProxy.get(countryKey);
                        }
                        return "";
                    case INDEX_NOTE:
                        return objet.getNote();
                }
            }
            catch (Exception e) {
                System.out.println("Une erreur est survenue durant l'affichage : " + e.getMessage());
            }
View Full Code Here


     *
     * @throws Exception si une erreur survient
     */
    private void lesRecoltants() throws Exception {
        for (int i = 0; i < recoltants.size(); i++) {
            Vigneron orig = (Vigneron) recoltants.get(i);
            // Trouvons les caract�ristiques suivantes :

            // Pays
//            String pays_id = Finder.pays(orig.getCountry_id(), pays);
//            if (pays_id != null) orig.setCountry_id(pays_id);
            //else /* Demander � l'utilisateur */ continue;

            orig.save();
        }
    }
View Full Code Here

    public void initEach() throws Exception {

        comboCountry.removeAllItems();
        CombosProxy.add(comboCountry, CountryProxy.getKeyValueList(), true);

        Vigneron recoltant = VigneronProxy.getSessionRecoltantFromID();
        fieldLastName.setText(recoltant.getLastname());
        fieldFirstname.setText(recoltant.getFirstname());
        fieldAddress.setText(recoltant.getAddress());
        fieldCP.setText(recoltant.getCp());
        fieldTown.setText(recoltant.getTown());
        ComponentTools.positionnerCombo(comboCountry, recoltant.getCountry_id());
        fieldWeb.setText(recoltant.getWeb());
        fieldNote.setText(recoltant.getNote());
        fieldTel.setText(recoltant.getTel());
        fieldFax.setText(recoltant.getFax());
        fieldEmail.setText(recoltant.getEmail());
    }
View Full Code Here

            enregistrer(VigneronDetailRegions.class);
        }
        else if (e.getSource().equals(buttonDelete)) {
            try {
                if (showQuestion("Etes-vous certain de vouloir supprimer ce r�coltant ?")) {
                    Vigneron recoltant = VigneronProxy.getSessionRecoltantFromID();
                    VigneronPeer.delete(recoltant);
                    SwapFrame.getInstance().init(VigneronSearch.class);
                }
                else {
                    SwapFrame.getInstance().init(VigneronDetail.class);
View Full Code Here

    }

    private void enregistrer(Class partirVers) {
        // ici on va enregistrer le recoltant existant
        try {
            Vigneron recoltant = VigneronProxy.getSessionRecoltantFromID();
            recoltant.setLastname(fieldLastName.getText());
            recoltant.setFirstname(fieldFirstname.getText());
            recoltant.setAddress(fieldAddress.getText());
            recoltant.setCp(fieldCP.getText());
            recoltant.setTown(fieldTown.getText());
            recoltant.setCountry_id(ComponentTools.getClefFromCombo(comboCountry));
            recoltant.setWeb(fieldWeb.getText());
            recoltant.setNote(fieldNote.getText());
            recoltant.setTel(fieldTel.getText());
            recoltant.setFax(fieldFax.getText());
            recoltant.setEmail(fieldEmail.getText());
            recoltant.save();
            SwapFrame.getInstance().init(partirVers);
        }
        catch (Exception ex) {
            System.out.println("Impossible d'enregistrer ce r�coltant : ");
            // ERREUR
View Full Code Here

    /**
     * Permet d'ajouter les plats
     */
    public static void start() {
        try {
            Vigneron vigneron = new Vigneron();
            vigneron.setFirstname("Chapoutier");
            vigneron.setLastname("M.");
            vigneron.setAddress("18, avenue Paul Durand");
            vigneron.setCp("26601");
            vigneron.setTown("Tain");
            vigneron.setCountry_id("fr");
            vigneron.setWeb("http://www.chapoutier.com");
            vigneron.setEmail("chapoutier@chapoutier.com");
            vigneron.setTel("+ 33 (0) 475 089 261");
            vigneron.setFax("+ 33 (0) 475 089 636");
            vigneron.setNote("9");
            vigneron.save();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

        else if (e.getSource().equals(buttonAdd)) {
            SwapFrame.getInstance().init(VigneronAdd.class);
        }
        else if (e.getSource().equals(buttonDetail)) {
            // ici on part sur le d�tail d'une bouteille
            Vigneron recoltant = (Vigneron) tableModel.getSelection(tableResultats.getSelectedRow());
            if (recoltant != null) {
                Session.getInstance().setAttribute("RECOLTANT_ID", recoltant.getId());
                SwapFrame.getInstance().init(VigneronDetail.class);
            }
        }
        else if (e.getSource().equals(comboRegion)){
            recherche();
View Full Code Here

        CombosProxy.add(comboCountry, CountryProxy.getKeyValueList(), true);
        modelExiste.removeAllElements();

        String recoltant_id = (String) Session.getInstance().getAttribute("AJOUT_RECOLTANT_ID");

        Vigneron recoltant = VigneronPeer.findByPK(recoltant_id);
        fieldName.setText(recoltant.getFirstname() + " " + recoltant.getLastname());
        // On se place par d�faut sur le pays du r�coltant
        ComponentTools.positionnerCombo(comboCountry, recoltant.getCountry_id());

    }
View Full Code Here

            // On r�cup�re les recoltants
            List results = VigneronPeer.findAll();
            if (results != null) {
                // Pour chaque r�coltant
                for (int i = 0; i < results.size(); i++) {
                    Vigneron recoltant1 = (Vigneron) results.get(i);
                    // On r�cup�re leur ID
                    String recoltant_id = recoltant1.getId();
                    // On v�rifie que leurs vignes sont dans le bon pays region.
                    if (!TextTools.isNullOrEmpty(pays_id)) {
                        // On r�cupere les r�gion de vigne qu'ils travaillent
                        Vigne vigne = new Vigne();
                        vigne.setVigneron_id(recoltant_id);
                        vigne.setCountry_id(pays_id);
                        if (!TextTools.isNullOrEmpty(region_id)) vigne.setRegion_id(region_id);
                        List vignes = VignePeer.find(vigne);
                        if (vignes != null && vignes.size() > 0) {
                            resultats.add(recoltant1);
                        }
                        else {
                            // si la r�gion n'est pas renseign�e on ne regarde que le pays
                            if (TextTools.isNullOrEmpty(region_id)) {
                                if (pays_id.equals(recoltant1.getCountry_id())) {
                                    resultats.add(recoltant1);
                                }
                            }
                        }
                    }
                    else {
                        resultats.add(recoltant1);
                    }
                }
                // Si le nom pass� en argument n'est pas nul ou vide
                if (!TextTools.isNullOrEmpty(nom)) {
                    // Nous faisons une recherche sur chaque �l�ment qui peut contenir
                    // une partie du nom pass� en argument
                    Iterator<Vigneron> liste = resultats.iterator();
                    while (liste.hasNext()) {
                        Vigneron bout = liste.next();
                        if (bout != null && bout.getLastname() != null) {
                            if (bout.getLastname().indexOf(nom) == -1) {
                                liste.remove();
                            }
                        }
                    }
                }
View Full Code Here

                return recoltants;
            }

            if (recoltants != null) {
                for (int i = 0 ; i < recoltants.size() ; i++) {
                    Vigneron recoltant = (Vigneron) recoltants.get(i);
                    if (recoltant != null) {
                        String note = recoltant.getNote();
                        if (!TextTools.isNullOrEmpty(note)) {
                            int noteI = 0;
                            try {
                                noteI = Integer.parseInt(note);
                            } catch (NumberFormatException e) {
View Full Code Here

TOP

Related Classes of com.ledruide.druidecave.dao.Vigneron

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.