/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rickenbazolo.carnet.bean;

import com.rickenbazolo.carnet.model.Contact;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;

/**
 *
 * @author Ricken BAZOLO
 */
@Named
@RequestScoped
public class AjouterBean extends Contact {

    /*private String nom;
    private String prenom;
    private String datenaiss;
    private String genre;
    private String telephone;
    private String skype;
    private String email;
    private String adresse;*/
    @Inject
    private ContactBean bean;

    public AjouterBean() {
        initFields();
    }

    public String ajouter() {
        /*System.out.println("Nom: " + this.nom);
        System.out.println("Prenom: " + this.prenom);
        System.out.println("Date de Naissance: " + this.datenaiss);
        System.out.println("Genre: " + this.genre);
        System.out.println("Téléphone: " + this.telephone);
        System.out.println("Skype: " + this.skype);
        System.out.println("Email: " + this.email);
        System.out.println("Adresse: " + this.adresse);*/
        Contact contact = new Contact();
        contact.setAdresse(adresse);
        contact.setDatenaiss(datenaiss);
        contact.setEmail(email);
        contact.setGenre(genre);
        contact.setNom(nom);
        contact.setPrenom(prenom);
        contact.setSkype(skype);
        contact.setTelephone(telephone);

        bean.addContact(contact);

        initFields();

        return (null);
    }

    private void initFields() {
        this.nom = "";
        this.prenom = "";
        this.datenaiss = "";
        this.genre = "Masculin";
        this.telephone = "";
        this.skype = "";
        this.email = "ricken.bazolo@gmail.com";
        this.adresse = "";
    }

    /*public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getPrenom() {
        return prenom;
    }

    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }

    public String getDatenaiss() {
        return datenaiss;
    }

    public void setDatenaiss(String datenaiss) {
        this.datenaiss = datenaiss;
    }

    public String getGenre() {
        return genre;
    }

    public void setGenre(String genre) {
        this.genre = genre;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getSkype() {
        return skype;
    }

    public void setSkype(String skype) {
        this.skype = skype;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getAdresse() {
        return adresse;
    }

    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }*/


}

@@ -476,799 +476,132 @@
     
-/*private String nom;%0A    private String prenom;%0A    private String datenaiss;%0A    private String genre;%0A    private String telephone;%0A    private String skype;%0A    private String email;%0A    private String adresse;*/%0A    @Inject%0A    private ContactBean bean;%0A%0A    public AjouterBean() %7B%0A        initFields();%0A    %7D%0A%0A    public String ajouter() %7B%0A        /*System.out.println(%22Nom: %22 + this.nom);%0A        System.out.println(%22Prenom: %22 + this.prenom);%0A        System.out.println(%22Date de Naissance: %22 + this.datenaiss);%0A        System.out.println(%22Genre: %22 + this.genre);%0A        System.out.println(%22T%C3%A9l%C3%A9phone: %22 + this.telephone);%0A        System.out.println(%22Skype: %22 + this.skype);%0A        System.out.println(%22Email: %22 + this.email);%0A        System.out.println(%22Adresse: %22 + this.adresse);*/
+@Inject%0A    private ContactBean bean;%0A%0A    public AjouterBean() %7B%0A        initFields();%0A    %7D%0A%0A    public String ajouter() %7B
 %0A   
@@ -1232,31 +1232,8 @@
  = %22
-ricken.bazolo@gmail.com
 %22;%0A 
@@ -1267,1155 +1267,7 @@
    %7D
-%0A%0A    /*public String getNom() %7B%0A        return nom;%0A    %7D%0A%0A    public void setNom(String nom) %7B%0A        this.nom = nom;%0A    %7D%0A%0A    public String getPrenom() %7B%0A        return prenom;%0A    %7D%0A%0A    public void setPrenom(String prenom) %7B%0A        this.prenom = prenom;%0A    %7D%0A%0A    public String getDatenaiss() %7B%0A        return datenaiss;%0A    %7D%0A%0A    public void setDatenaiss(String datenaiss) %7B%0A        this.datenaiss = datenaiss;%0A    %7D%0A%0A    public String getGenre() %7B%0A        return genre;%0A    %7D%0A%0A    public void setGenre(String genre) %7B%0A        this.genre = genre;%0A    %7D%0A%0A    public String getTelephone() %7B%0A        return telephone;%0A    %7D%0A%0A    public void setTelephone(String telephone) %7B%0A        this.telephone = telephone;%0A    %7D%0A%0A    public String getSkype() %7B%0A        return skype;%0A    %7D%0A%0A    public void setSkype(String skype) %7B%0A        this.skype = skype;%0A    %7D%0A%0A    public String getEmail() %7B%0A        return email;%0A    %7D%0A%0A    public void setEmail(String email) %7B%0A        this.email = email;%0A    %7D%0A%0A    public String getAdresse() %7B%0A        return adresse;%0A    %7D%0A%0A    public void setAdresse(String adresse) %7B%0A        this.adresse = adresse;%0A    %7D*/%0A%0A
 %0A%7D%0A

clean file