Package de.dis2011.menu

Examples of de.dis2011.menu.PersonSelectionMenu


    int id = personSelectionMenu.show();
   
    //Person barbeiten?
    if(id != PersonSelectionMenu.BACK) {
      //Person laden
      Person p = service.getPersonById(id);
      System.out.println("Person "+p.getVorname()+" "+p.getNachname()+" wird bearbeitet. Leere Felder bleiben unverändert.");
     
      //Neue Daten einlesen
      String newVorname = FormUtil.readString("Vorname ("+p.getVorname()+")");
      String newNachname = FormUtil.readString("Nachname ("+p.getNachname()+")");
      String newAddress = FormUtil.readString("Adresse ("+p.getAdresse()+")");
     
      //Neue Daten setzen
      if(!newVorname.equals(""))
        p.setVorname(newVorname);
      if(!newNachname.equals(""))
        p.setNachname(newNachname);
      if(!newAddress.equals(""))
        p.setAdresse(newAddress);
     
      service.editPerson(p);
    }
  }
View Full Code Here


    Menu personSelectionMenu = new PersonSelectionMenu("Person bearbeiten", service.getAllPersons());
    int id = personSelectionMenu.show();
   
    //Löschen, falls nicht "zurück" gewählt wurde
    if(id != PersonSelectionMenu.BACK) {
      Person p = service.getPersonById(id);
      service.deletePerson(p);
    }
  }
View Full Code Here

  public PersonSelectionMenu(String title, Set<Person> personen) {
    super(title);
   
    Iterator<Person> it = personen.iterator();
    while(it.hasNext()) {
      Person p = it.next();
      addEntry(p.getVorname()+" "+p.getNachname(), p.getId());
    }
    addEntry("Zur√ºck", BACK);
  }
View Full Code Here

   
    return null;*/
   
    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();
    Person person = (Person) session.get(Person.class, id);
    session.getTransaction().commit();
   
    if (person == null) {
      return null;
    }
View Full Code Here

   */
  public void addPerson(Person p) {
    /*person.add(p);*/
    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();
    Person person = new Person();
    person = p;
    session.save(person);
    session.getTransaction().commit();
  }
View Full Code Here

   */
  public void deletePerson(Person p) {
    //personen.remove(p);
    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();
    Person person = new Person();
    person = p;
    session.delete(person);
    session.getTransaction().commit();
  }
View Full Code Here

    session.save(m);
    session.getTransaction().commit();

    session.beginTransaction();
   
    Person p1 = new Person();
    p1.setAdresse("Informatikum");
    p1.setNachname("Mustermann");
    p1.setVorname("Erika");
   
   
    Person p2 = new Person();
    p2.setAdresse("Reeperbahn 9");
    p2.setNachname("Albers");
    p2.setVorname("Hans");
   
    session.save(p1);
    session.save(p2);
   
    //TODO: Diese Personen werden im Speicher und der DB gehalten
View Full Code Here

  public Set<Wohnung> getAllWohnungenForMakler(Makler m) {
    Set<Wohnung> ret = new HashSet<Wohnung>();
    Iterator<Wohnung> it = wohnungen.iterator();
   
    while(it.hasNext()) {
      Wohnung w = it.next();
     
      if(w.getVerwalter().equals(m))
        ret.add(w);
    }
   
    return ret;
  }
View Full Code Here

   */
  public Wohnung getWohnungById(int id) {
    Iterator<Wohnung> it = wohnungen.iterator();
   
    while(it.hasNext()) {
      Wohnung w = it.next();
     
      if(w.getId() == id)
        return w;
    }
   
    return null;
  }
View Full Code Here

    h.setGarten(true);
    h.setVerwalter(m);
   
    this.addHaus(h);
   
    Wohnung w1 = new Wohnung();
    w1.setOrt("Hamburg");
    w1.setPlz(22527);
    w1.setStrasse("Vogt-Kölln-Straße");
    w1.setHausnummer("3");
    w1.setFlaeche(120);
    w1.setStockwerk(4);
    w1.setMietpreis(790);
    w1.setEbk(true);
    w1.setBalkon(false);
    w1.setVerwalter(m);
   
    Wohnung w2 = new Wohnung();
    w2.setOrt("Berlin");
    w2.setPlz(22527);
    w2.setStrasse("Vogt-Kölln-Straße");
    w2.setHausnummer("3");
    w2.setFlaeche(120);
    w2.setStockwerk(4);
    w2.setMietpreis(790);
    w2.setEbk(true);
    w2.setBalkon(false);
    w2.setVerwalter(m);

    this.addWohnung(w1);
    this.addWohnung(w2);

    Kaufvertrag kv = new Kaufvertrag();
View Full Code Here

TOP

Related Classes of de.dis2011.menu.PersonSelectionMenu

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.