/*
 * 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.horario.Services;

import java.util.ArrayList;
import pe.siso.horario.Beans.Area;
import pe.siso.horario.DAO.AreaDAO;
import pe.siso.horario.DAO.DAOFactory;

/**
 *
 * @author sistem16user
 */
public class AreaServices {

    DAOFactory fabrica = DAOFactory.getDAOFactory(DAOFactory.MYSQL);
    AreaDAO objAreaDAO = fabrica.getAreaDAO();

    public ArrayList<Area> listarAreas() {
        ArrayList<Area> lista = null;
        try {
            lista = objAreaDAO.listarAreas();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return lista;
    }
    public ArrayList<Area> listarAreasDocente(String codDocente) {
        ArrayList<Area> lista = null;
        try {
            lista = objAreaDAO.listarAreasDocente(codDocente);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return lista;
    }

    public int registrarAreas(String nombreArea) {
        int dato = 0;
        try {
            dato = objAreaDAO.registrarAreas(nombreArea);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return dato;
    }

    public void cambiarEstado(String dato, String codigoArea) {

        try {
            objAreaDAO.cambiarEstado(dato, codigoArea);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    public ArrayList<Area> cargarArea(int cod) {
        ArrayList<Area> lista = null;
        try {
            lista = objAreaDAO.cargarArea(cod);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return lista;
    }

    public Area NombreAreas(String cod) {

        Area area = new Area();
        try {
            area = objAreaDAO.NombreAreas(cod);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return area;
    }

    public void Actualizar(String codigoArea, String nombreArea) {

        try {
            objAreaDAO.Actualizar(codigoArea, nombreArea);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    public int cantidadAreaUso(String codigoArea) {
        int dato = 0;
        try {
            dato = objAreaDAO.cantidadAreaUso(codigoArea);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return dato;
    }

    public Area datosArea(String codDocente) {
        Area area = new Area();
        try {
            area = objAreaDAO.datosArea(codDocente);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return area;
    }

    public int registrarAreaDocente(String codigoArea, String codigoDocente) {
        int dato = 0;
        try {
            dato = objAreaDAO.registrarAreaDocente(codigoArea, codigoDocente);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return dato;
    }

}
