コード例 #1
0
        public object execute(DbConnection connection)
        {
            var jugadorDAO       = new JugadorDAO();
            var datosTotales     = jugadorDAO.verJugador(connection, null, cod_Jugador);
            var hcoIntegranteDAO = new HcoIntegranteDAO();
            var historial        = hcoIntegranteDAO.verHistorialEquipos(connection, null, cod_Jugador);
            var partidoJugadoDAO = new PartidoJugadoDAO();
            var temporadas       = partidoJugadoDAO.temporadasConPartidosJugados(connection, null, cod_Jugador);

            return(new PerfilCompletoJugador(datosTotales, historial, temporadas));
        }
コード例 #2
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);
        }
コード例 #3
0
        public object execute(DbConnection connection, DbTransaction transaction)
        {
            IntegranteDAO    integranteDAO    = new IntegranteDAO();
            HcoIntegranteDAO hcoIntegranteDAO = new HcoIntegranteDAO();
            JugadorDAO       jugadorDAO       = new JugadorDAO();
            EntrenadorDAO    entrenadorDAO    = new EntrenadorDAO();
            DirectivoDAO     directivoDAO     = new DirectivoDAO();

            if (info.Integrante != null)
            {
                integranteDAO.updateIntegrante(connection, transaction, info.Integrante);
            }
            var hcoIntegranteActual = info.ListaHcoIntegrantes[info.ListaHcoIntegrantes.Count - 1];

            hcoIntegranteDAO.updateHcoIntegrante(connection, transaction, hcoIntegranteActual);

            if (info.GetType().Name.Equals("JugadorCO"))
            {
                if ((info as JugadorCO).Jugador != null)
                {
                    jugadorDAO.updateJugador(connection, transaction, (info as JugadorCO).Jugador);
                }
            }
            else
            if (info.GetType().Name.Equals("EntrenadorCO"))
            {
                if ((info as EntrenadorCO).Entrenador != null)
                {
                    entrenadorDAO.updateEntrenador(connection, transaction, (info as EntrenadorCO).Entrenador);
                }
            }
            else
            {
                if ((info as DirectivoCO).Directivo != null)
                {
                    directivoDAO.updateDirectivo(connection, transaction, (info as DirectivoCO).Directivo);
                }
            }

            return(info);
        }
コード例 #4
0
        public object execute(DbConnection connection, DbTransaction transaction)
        {
            IntegranteDAO    integranteDAO    = new IntegranteDAO();
            JugadorDAO       jugadorDAO       = new JugadorDAO();
            HcoIntegranteDAO hcoIntegranteDAO = new HcoIntegranteDAO();
            IntegranteVO     integranteVO     = jugadorCO.Integrante;
            int cod_Integrante = jugadorCO.Jugador.Cod_Integrante;

            if (integranteDAO.Exists(connection, transaction, cod_Integrante))
            {
            }
            else
            {
                integranteVO   = integranteDAO.create(connection, transaction, jugadorCO.Integrante);
                cod_Integrante = integranteVO.Cod_Integrante;
            }


            HcoIntegranteVO hcoIntegranteCreado = null;

            foreach (HcoIntegranteVO hcoIntegrante in jugadorCO.ListaHcoIntegrantes)
            {
                hcoIntegrante.Cod_Integrante = cod_Integrante;
                hcoIntegranteCreado          = hcoIntegranteDAO.create(connection, transaction,
                                                                       hcoIntegrante);
            }
            jugadorCO.Jugador.Cod_Integrante     = cod_Integrante;
            jugadorCO.Jugador.Cod_Equipo         = hcoIntegranteCreado.Cod_Equipo;
            jugadorCO.Jugador.Version_Integrante = hcoIntegranteCreado.Version_Integrante;



            JugadorVO jugadorVO = jugadorDAO.create(connection, transaction,
                                                    jugadorCO.Jugador);

            return(new JugadorCO(jugadorVO, jugadorCO.ListaHcoIntegrantes, integranteVO));
        }
コード例 #5
0
        public object execute(DbConnection connection, DbTransaction transaction)
        {
            IntegranteDAO    integranteDAO    = new IntegranteDAO();
            DirectivoDAO     directivoDAO     = new DirectivoDAO();
            HcoIntegranteDAO hcoIntegranteDAO = new HcoIntegranteDAO();
            IntegranteVO     integranteVO     = directivoCO.Integrante;
            int cod_Integrante = directivoCO.Directivo.Cod_Integrante;

            if (integranteDAO.Exists(connection, transaction, cod_Integrante))
            {
            }
            else
            {
                integranteVO   = integranteDAO.create(connection, transaction, directivoCO.Integrante);
                cod_Integrante = integranteVO.Cod_Integrante;
            }

            HcoIntegranteVO hcoIntegranteCreado = null;

            foreach (HcoIntegranteVO hcoIntegrante in directivoCO.ListaHcoIntegrantes)
            {
                hcoIntegrante.Cod_Integrante = cod_Integrante;
                hcoIntegranteCreado          = hcoIntegranteDAO.create(connection, transaction,
                                                                       hcoIntegrante);
            }

            directivoCO.Directivo.Cod_Integrante     = cod_Integrante;
            directivoCO.Directivo.Cod_Equipo         = hcoIntegranteCreado.Cod_Equipo;
            directivoCO.Directivo.Version_Integrante = hcoIntegranteCreado.Version_Integrante;


            DirectivoVO directivoVO = directivoDAO.create(connection, transaction,
                                                          directivoCO.Directivo);

            return(new DirectivoCO(directivoVO, directivoCO.ListaHcoIntegrantes, integranteVO));
        }
コード例 #6
0
        public object execute(DbConnection connection, DbTransaction transaction)
        {
            IntegranteDAO    integranteDAO    = new IntegranteDAO();
            EntrenadorDAO    entrenadorDAO    = new EntrenadorDAO();
            HcoIntegranteDAO hcoIntegranteDAO = new HcoIntegranteDAO();
            IntegranteVO     integranteVO     = entrenadorCO.Integrante;
            int cod_Integrante = entrenadorCO.Entrenador.Cod_Integrante;

            if (integranteDAO.Exists(connection, transaction, cod_Integrante))
            {
            }
            else
            {
                integranteVO   = integranteDAO.create(connection, transaction, entrenadorCO.Integrante);
                cod_Integrante = integranteVO.Cod_Integrante;
            }

            HcoIntegranteVO hcoIntegranteCreado = null;

            foreach (HcoIntegranteVO hcoIntegrante in entrenadorCO.ListaHcoIntegrantes)
            {
                hcoIntegrante.Cod_Integrante = cod_Integrante;
                hcoIntegranteCreado          = hcoIntegranteDAO.create(connection, transaction,
                                                                       hcoIntegrante);
            }

            entrenadorCO.Entrenador.Cod_Integrante = cod_Integrante;
            entrenadorCO.Entrenador.Cod_Equipo     = hcoIntegranteCreado.Cod_Equipo;

            //linea anadida
            entrenadorCO.Entrenador.Version_Integrante = hcoIntegranteCreado.Version_Integrante;
            EntrenadorVO entrenadorVO = entrenadorDAO.create(connection, transaction,
                                                             entrenadorCO.Entrenador);

            return(new EntrenadorCO(entrenadorVO, entrenadorCO.ListaHcoIntegrantes, integranteVO));
        }
コード例 #7
0
        public object execute(DbConnection connection, DbTransaction transaction)
        {
            var equipoVO          = equipoTotal.Equipo;
            var estadioVO         = equipoTotal.Estadio;
            var listaJugadores    = equipoTotal.ListaJugadores;
            var listaEntrenadores = equipoTotal.ListaEntrenadoresCreate;
            var listaDirectivos   = equipoTotal.ListaDirectivosCreate;



            //Creamos el EquipoVO
            if (equipoVO != null)
            {
                EquipoDAO equipoDAO = new EquipoDAO();
                equipoVO = equipoDAO.create(connection, transaction, equipoVO);
            }


            //Creamos el EstadioVO
            if (estadioVO != null)
            {
                EstadioDAO estadioDAO = new EstadioDAO();
                estadioVO = estadioDAO.create(connection, transaction, estadioVO);
            }


            //Creamos todos los jugadoresCOs
            if (listaJugadores != null)
            {
                HcoIntegranteDAO hcoIntegranteDAO = new HcoIntegranteDAO();
                IntegranteDAO    integranteDAO    = new IntegranteDAO();
                JugadorDAO       jugadorDAO       = new JugadorDAO();

                foreach (JugadorCO jugadorCO in listaJugadores)
                {
                    IntegranteVO integranteVO   = jugadorCO.Integrante;
                    int          cod_Integrante = jugadorCO.cod_Integrante();


                    if (integranteDAO.Exists(connection, transaction, cod_Integrante))
                    {
                    }
                    else
                    {
                        integranteVO   = integranteDAO.create(connection, transaction, jugadorCO.Integrante);
                        cod_Integrante = integranteVO.Cod_Integrante;
                    }

                    HcoIntegranteVO hcoIntegranteCreado = null;
                    foreach (HcoIntegranteVO hcoIntegrante in jugadorCO.ListaHcoIntegrantes)
                    {
                        hcoIntegrante.Cod_Integrante = cod_Integrante;
                        hcoIntegranteCreado          = hcoIntegranteDAO.create(connection, transaction,
                                                                               hcoIntegrante);
                    }



                    //linea anadida
                    if (jugadorCO.GetType().Name.Equals("JugadorCO"))
                    {
                        (jugadorCO as JugadorCO).Jugador.Cod_Integrante     = cod_Integrante;
                        (jugadorCO as JugadorCO).Jugador.Version_Integrante = hcoIntegranteCreado.Version_Integrante;
                        JugadorVO jugadorVO = jugadorDAO.create(connection, transaction,
                                                                (jugadorCO as JugadorCO).Jugador);
                    }
                }
            }


            //creamos todos los EntrenadorCOs
            if (listaEntrenadores != null)
            {
                foreach (EntrenadorCO entrenadorCO in listaEntrenadores)
                {
                    IntegranteDAO    integranteDAO    = new IntegranteDAO();
                    EntrenadorDAO    entrenadorDAO    = new EntrenadorDAO();
                    HcoIntegranteDAO hcoIntegranteDAO = new HcoIntegranteDAO();
                    IntegranteVO     integranteVO     = entrenadorCO.Integrante;
                    int cod_Integrante = entrenadorCO.Entrenador.Cod_Integrante;

                    if (integranteDAO.Exists(connection, transaction, cod_Integrante))
                    {
                    }
                    else
                    {
                        integranteVO   = integranteDAO.create(connection, transaction, entrenadorCO.Integrante);
                        cod_Integrante = integranteVO.Cod_Integrante;
                    }

                    HcoIntegranteVO hcoIntegranteCreado = null;
                    foreach (HcoIntegranteVO hcoIntegrante in entrenadorCO.ListaHcoIntegrantes)
                    {
                        hcoIntegrante.Cod_Integrante = cod_Integrante;
                        hcoIntegranteCreado          = hcoIntegranteDAO.create(connection, transaction,
                                                                               hcoIntegrante);
                    }

                    entrenadorCO.Entrenador.Cod_Integrante = cod_Integrante;

                    //linea anadida
                    if (entrenadorCO.GetType().Name.Equals("EntrenadorCO"))
                    {
                        (entrenadorCO as EntrenadorCO).Entrenador.Cod_Integrante     = cod_Integrante;
                        (entrenadorCO as EntrenadorCO).Entrenador.Version_Integrante = hcoIntegranteCreado.Version_Integrante;
                        EntrenadorVO entrenadorVO = entrenadorDAO.create(connection, transaction,
                                                                         (entrenadorCO as EntrenadorCO).Entrenador);
                    }
                }
            }


            //Creamos todos los DirectivoCOs
            if (listaDirectivos != null)
            {
                foreach (DirectivoCO directivoCO in listaDirectivos)
                {
                    IntegranteDAO    integranteDAO    = new IntegranteDAO();
                    DirectivoDAO     directivoDAO     = new DirectivoDAO();
                    HcoIntegranteDAO hcoIntegranteDAO = new HcoIntegranteDAO();
                    IntegranteVO     integranteVO     = directivoCO.Integrante;
                    int cod_Integrante = directivoCO.Directivo.Cod_Integrante;

                    if (integranteDAO.Exists(connection, transaction, cod_Integrante))
                    {
                    }
                    else
                    {
                        integranteVO   = integranteDAO.create(connection, transaction, directivoCO.Integrante);
                        cod_Integrante = integranteVO.Cod_Integrante;
                    }

                    HcoIntegranteVO hcoIntegranteCreado = null;
                    foreach (HcoIntegranteVO hcoIntegrante in directivoCO.ListaHcoIntegrantes)
                    {
                        hcoIntegrante.Cod_Integrante = cod_Integrante;
                        hcoIntegranteCreado          = hcoIntegranteDAO.create(connection, transaction,
                                                                               hcoIntegrante);
                    }

                    directivoCO.Directivo.Cod_Integrante = cod_Integrante;

                    //linea anadida
                    if (directivoCO.GetType().Name.Equals("DirectivoCO"))
                    {
                        (directivoCO as DirectivoCO).Directivo.Cod_Integrante     = cod_Integrante;
                        (directivoCO as DirectivoCO).Directivo.Version_Integrante = hcoIntegranteCreado.Version_Integrante;
                        DirectivoVO directivoVO = directivoDAO.create(connection, transaction,
                                                                      (directivoCO as DirectivoCO).Directivo);
                    }
                }
            }
            return(new EquipoTotalCO <JugadorCO>(equipoVO, listaJugadores, listaEntrenadores, null, listaDirectivos, null,
                                                 estadioVO));
        }