/*
 * 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 pe.siso.academia.Services;

import java.util.ArrayList;
import pe.siso.academia.Beans.Ubigeo;
import pe.siso.academia.DAO.DAOFactory;
import pe.siso.academia.DAO.UbigeoDAO;

/**
 *
 * @author sistem08user
 */
public class UbigeoService {
    DAOFactory fabrica = DAOFactory.getDAOFactory(DAOFactory.MYSQL);
    UbigeoDAO objUbigeoDAO= fabrica.getUbigeoDAO();
    
    public ArrayList<Ubigeo> listarDepartamentos(){
        ArrayList<Ubigeo> lista= new ArrayList<>();
        try {
            lista = objUbigeoDAO.listarDepartamentos();
                    
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
	return lista;
    }
    
    public ArrayList<Ubigeo> listarProvincias(int codDep){
        ArrayList<Ubigeo> lista= new ArrayList<>();
        try {
            lista = objUbigeoDAO.listarProvincias(codDep);
                    
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
	return lista;
    }
    
    public ArrayList<Ubigeo> listarDistritos(int codPro, int codDep){
        ArrayList<Ubigeo> lista= new ArrayList<>();
        try {
            lista = objUbigeoDAO.listarDistritos(codPro,codDep);
                    
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
	return lista;
    }
}