Search in sources :

Example 16 with Person

use of sqlite.feature.contentprovider.kripton35.entities.Person in project ConsoElectric by anakkarsara.

the class DeletePerson method doGet.

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<h2><a href=\"index.html\">Retour page d'acueil</a></h2>");
    out.println("<FORM Method=\"POST\" Action=\"/DeletePerson\">\r\n" + "		<table border = 1 cellpadding = \"10\" align = \"center\">\r\n");
    out.println("<td>Proprietaire</td><td><SELECT name=\"personToDelete\" size=\"5\">");
    for (Person p : pd.allPersons()) {
        out.println("<option value = \"" + p.getId() + "\">" + p.getFirstName() + " " + p.getFamilyName() + "</option>");
    }
    out.println("				</td></tr><tr ><td colspan = \"2\" align = \"right\"><INPUT type=submit value=Send></td>\r\n");
    out.println("		</table>\r\n" + "		</FORM>");
}
Also used : Person(entities.Person) PrintWriter(java.io.PrintWriter)

Example 17 with Person

use of sqlite.feature.contentprovider.kripton35.entities.Person in project ConsoElectric by anakkarsara.

the class DeletePerson method doPost.

public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    EntityManagerFactory factory = Persistence.createEntityManagerFactory("dev");
    EntityManager manager = factory.createEntityManager();
    EntityTransaction tx = manager.getTransaction();
    tx.begin();
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    PersonDao pd = new PersonDao();
    pd.deleteById(Long.parseLong(request.getParameter("personToDelete")));
    tx.commit();
    out.println("<h2><a href=\"index.html\">Retour page d'acueil</a></h2>");
    out.println("<table border = 2 cellpadding = \"10\" cellspacing = \"10\" align= \"center\">  <tr>  <th>Prenom</th> <th>Nom</th>  <th>Email</th> ");
    DAO test = new DAO(manager);
    for (Person next : test.listPersons()) {
        out.println(" <tr>    <td>" + next.getFirstName() + "</td>   <td>" + next.getFamilyName() + "</td>   <td>" + next.getMail() + "</td> </tr>  ");
    }
    out.println("</table> ");
    manager.close();
}
Also used : EntityTransaction(javax.persistence.EntityTransaction) PersonDao(dao.PersonDao) EntityManager(javax.persistence.EntityManager) DAO(jpa.DAO) EntityManagerFactory(javax.persistence.EntityManagerFactory) Person(entities.Person) PrintWriter(java.io.PrintWriter)

Aggregations

Cursor (android.database.Cursor)10 KriptonContentValues (com.abubusoft.kripton.android.sqlite.KriptonContentValues)10 ArrayList (java.util.ArrayList)8 Person (sqlite.feature.contentprovider.kripton35.entities.Person)8 Person (entities.Person)7 PrintWriter (java.io.PrintWriter)6 EntityTransaction (javax.persistence.EntityTransaction)6 EntityManager (javax.persistence.EntityManager)5 EntityManagerFactory (javax.persistence.EntityManagerFactory)5 DAO (jpa.DAO)5 City (sqlite.feature.contentprovider.kripton35.entities.City)2 PersonDao (dao.PersonDao)1 DELETE (javax.ws.rs.DELETE)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1