/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.HotelServices.model.dto.impl;

import com.HotelServices.model.dao.TakaritoDAO;
import com.HotelServices.model.dto.TakaritasDTO;
import com.HotelServices.model.dto.TakaritoDTO;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.util.LinkedList;

/**
 *
 * @author Sensei
 */
public class TakaritoDAOImpl extends AbstractGenericDAOImpl<TakaritoDTO, Long>
	implements TakaritoDAO{

    public boolean insert(TakaritoDTO entity) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public boolean deleteById(Long entityId) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public LinkedList<TakaritasDTO> takaritas_lista() {
        LinkedList<TakaritasDTO> ll = new LinkedList<TakaritasDTO>();
        Connection con = null;
        try {
            Class.forName("com.mysql.jdbc.Driver");
            con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/hotelservices", "root", "admin");
            
            PreparedStatement stmt = (PreparedStatement) con.prepareStatement("SELECT * FROM takaritas");
            ResultSet rs = stmt.executeQuery();
            while (rs.next()) {
                TakaritasDTO takaritas = new TakaritasDTO();
                takaritas.setId(rs.getInt(1));
                takaritas.setLeiras(rs.getString(2));
                takaritas.setSzobaszam(rs.getInt(3));
                takaritas.setVendegId(rs.getInt(4));
//                System.out.println(szoba.getAr());
                ll.addLast(takaritas);
                
            }
            con.close();
            stmt.close();

        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
        }
    return ll; 
    }

}
