コード例 #1
0
        public object execute(DbConnection connection)
        {
            IntegranteDAO    integranteDAO    = new IntegranteDAO();
            JugadorDAO       jugadorDAO       = new JugadorDAO();
            EntrenadorDAO    entrenadorDAO    = new EntrenadorDAO();
            DirectivoDAO     directivoDAO     = new DirectivoDAO();
            HcoIntegranteDAO hcoIntegranteDAO = new HcoIntegranteDAO();
            JugadorVO        jugadorVO;
            EntrenadorVO     entrenadorVO;
            DirectivoVO      directivoVO;

            IntegranteVO integranteVO = integranteDAO.verIntegrante(connection, null, cod_Integrante);

            var listaHcoIntegrante = hcoIntegranteDAO.obtenerListaHcoIntegranteVO(connection, null, cod_Integrante);

            HcoIntegranteVO hcoIntegranteVO = (HcoIntegranteVO)listaHcoIntegrante[listaHcoIntegrante.Count - 1];

            jugadorVO = jugadorDAO.obtenerJugadorVO(connection, null, hcoIntegranteVO.Cod_Integrante,
                                                    hcoIntegranteVO.Cod_Equipo, hcoIntegranteVO.Version_Integrante);

            if (jugadorVO != null)
            {
                return(new JugadorCO(jugadorVO, listaHcoIntegrante, integranteVO));
            }


            entrenadorVO = entrenadorDAO.obtenerEntrenadorVO(connection, null, cod_Integrante,
                                                             hcoIntegranteVO.Cod_Equipo, hcoIntegranteVO.Version_Integrante);
            if (entrenadorVO != null)
            {
                return(new EntrenadorCO(entrenadorVO, listaHcoIntegrante, integranteVO));
            }

            directivoVO = directivoDAO.obtenerDirectivoVO(connection, null, cod_Integrante,
                                                          hcoIntegranteVO.Cod_Equipo, hcoIntegranteVO.Version_Integrante);
            if (directivoVO != null)
            {
                return(new DirectivoCO(directivoVO, listaHcoIntegrante, integranteVO));
            }

            return(null);
        }