Exemplo n.º 1
0
 public InfoJugadorEditar(IntegranteVO integranteVO, HcoIntegranteVO hcoIntegranteVO,
                          JugadorVO jugadorVO)
 {
     this.integranteVO    = integranteVO;
     this.hcoIntegranteVO = hcoIntegranteVO;
     this.jugadorVO       = jugadorVO;
 }
Exemplo n.º 2
0
        public ArrayList generaDirectiva(int cod_Equipo)
        {
            //sustituir el 4 q multiplica al 22 de abajo por el numero de equipos
            //de la BD
            contador = 22 * 20 + 20 * 4 + (cod_Equipo - 1) * 4;
            ArrayList listaDirectivos = new ArrayList();
            String    cargo;

            for (int i = 1; i < 5; i++)
            {
                switch (i)
                {
                case 1:
                    cargo = "Presidente";
                    break;

                case 2:
                    cargo = "Vicepresidente";
                    break;

                case 3:
                    cargo = "Director deportivo";
                    break;

                case 4:
                    cargo = "Secretario general";
                    break;

                default:
                    cargo = "Consejero";
                    break;
                }



                IntegranteVO integranteVO = new IntegranteVO(contador + i, generador.generarNombreAleatorio(), generador.generarApellidoAleatorio(),
                                                             generador.generarFechaAleatoriaNacimiento(), null);

                HcoIntegranteVO hcoIntegranteVO = new HcoIntegranteVO(contador + i, cod_Equipo,
                                                                      generador.generarFechaAleatoriaPartido(), DateTime.MinValue, generador.generarFechaAleatoriaPartido(),
                                                                      20000, i);

                var listaHcoIntegrantes = new List <HcoIntegranteVO>();
                listaHcoIntegrantes.Add(hcoIntegranteVO);

                DirectivoVO directivoVO = new DirectivoVO(contador + i, cod_Equipo, cargo, "abogao");

                DirectivoCO directivoInsertar = new DirectivoCO(directivoVO, listaHcoIntegrantes, integranteVO);

                listaDirectivos.Add(directivoInsertar);
            }
            return(listaDirectivos);
        }
Exemplo n.º 3
0
        public ArrayList generaCuerpoTecnico(int cod_Equipo)
        {
            //sustituir el 4 q multiplica al 22 de abajo por el numero de equipos
            //de la BD
            contador = 22 * 20 + (cod_Equipo - 1) * 4;
            ArrayList listaEntrenadores = new ArrayList();
            String    cargo;

            for (int i = 1; i < 5; i++)
            {
                switch (i)
                {
                case 1:
                    cargo = "Primer entrenador";
                    break;

                case 2:
                    cargo = "Segundo entrenador";
                    break;

                case 3:
                    cargo = "Entrenador de porteros";
                    break;

                case 4:
                    cargo = "Ayudante";
                    break;

                default:
                    cargo = "Utillero";
                    break;
                }



                IntegranteVO integranteVO = new IntegranteVO(contador + i, generador.generarNombreAleatorio(), generador.generarApellidoAleatorio(),
                                                             generador.generarFechaAleatoriaNacimiento(), null);

                HcoIntegranteVO hcoIntegranteVO = new HcoIntegranteVO(contador + i, cod_Equipo,
                                                                      generador.generarFechaAleatoriaPartido(), DateTime.MinValue, generador.generarFechaAleatoriaPartido(),
                                                                      20000, i);

                var listaHcoIntegrantes = new List <HcoIntegranteVO>();
                listaHcoIntegrantes.Add(hcoIntegranteVO);

                EntrenadorVO entrenadorVO = new EntrenadorVO(contador + i, cod_Equipo, cargo, generador.generarFechaAleatoriaPartido());

                EntrenadorCO entrenadorInsertar = new EntrenadorCO(entrenadorVO, listaHcoIntegrantes, integranteVO);

                listaEntrenadores.Add(entrenadorInsertar);
            }
            return(listaEntrenadores);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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));
        }
Exemplo n.º 6
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));
        }
Exemplo n.º 7
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));
        }
Exemplo n.º 8
0
        public ArrayList generaPlantilla(int cod_Equipo)
        {
            contador = (cod_Equipo - 1) * 22;
            String    posicion;
            ArrayList listaJugadores = new ArrayList();

            for (int i = 1; i < 23; i++)
            {
                switch (i)
                {
                case 1:
                    posicion = "Portero";
                    break;

                case 2:
                    posicion = "Lateral derecho";
                    break;

                case 3:
                    posicion = "Lateral izquierdo";
                    break;

                case 4:
                    posicion = "Defensa central";
                    break;

                case 5:
                    posicion = "Defensa central";
                    break;

                case 6:
                    posicion = "Mediocentro defensivo";
                    break;

                case 7:
                    posicion = "Interior derecho";
                    break;

                case 8:
                    posicion = "Mediocentro ofensivo";
                    break;

                case 9:
                    posicion = "Delantero centro";
                    break;

                case 10:
                    posicion = "Mediapunta";
                    break;

                case 11:
                    posicion = "Extremo izquierdo";
                    break;

                case 12:
                    posicion = "Lateral derecho";
                    break;

                case 13:
                    posicion = "Portero";
                    break;

                case 14:
                    posicion = "Lateral izquierdo";
                    break;

                case 15:
                    posicion = "Defensa central";
                    break;

                case 16:
                    posicion = "Defensa central";
                    break;

                case 17:
                    posicion = "Delantero centro";
                    break;

                case 18:
                    posicion = "Extremo derecho";
                    break;

                case 19:
                    posicion = "Delantero";
                    break;

                case 20:
                    posicion = "Mediocentro defensivo";
                    break;

                case 21:
                    posicion = "Mediocentro ofensivo";
                    break;

                case 22:
                    posicion = "Mediapunta";
                    break;

                default:
                    posicion = "Polivalente";
                    break;
                }



                IntegranteVO integranteVO = new IntegranteVO(contador + i, generador.generarNombreAleatorio(), generador.generarApellidoAleatorio(),
                                                             generador.generarFechaAleatoriaNacimiento(), null);

                HcoIntegranteVO hcoIntegranteVO = new HcoIntegranteVO(contador + i, cod_Equipo,
                                                                      generador.generarFechaAleatoriaPartido(), DateTime.MinValue, generador.generarFechaAleatoriaPartido(),
                                                                      20000, i);

                var listaHcoIntegrantes = new List <HcoIntegranteVO>();
                listaHcoIntegrantes.Add(hcoIntegranteVO);

                JugadorVO jugadorVO = new JugadorVO(contador + i, cod_Equipo, generador.generarAltura(), posicion, generador.generarZurdoDiestro());

                JugadorCO jugadorInsertar = new JugadorCO(jugadorVO, listaHcoIntegrantes, integranteVO);

                listaJugadores.Add(jugadorInsertar);
            }
            return(listaJugadores);
        }
Exemplo n.º 9
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));
        }
Exemplo n.º 10
0
        public HcoIntegranteVO updateHcoIntegrante(DbConnection connection,
                                                   DbTransaction transaction, HcoIntegranteVO hcoIntegranteVO)
        {
            try
            {
                DbCommand command = connection.CreateCommand();

                if (transaction != null)
                {
                    command.Transaction = transaction;
                }


                command.CommandText = "UPDATE Hco_Integrante SET " +
                                      "fecha_Inicio=@fecha_Inicio," +
                                      "fecha_Fin=@fecha_Fin,fecha_Fin_Contrato=@fecha_Fin_Contrato," +
                                      "sueldo=@sueldo,dorsal=@dorsal WHERE " +
                                      "cod_Integrante=@cod_Int AND cod_Equipo=@cod_Equipo " +
                                      "AND version_integrante=@version_integrante";


                DbParameter cod_IntParam = command.CreateParameter();
                cod_IntParam.ParameterName = "@cod_Int";
                cod_IntParam.DbType        = DbType.Int32;
                cod_IntParam.Value         = hcoIntegranteVO.Cod_Integrante;
                cod_IntParam.Size          = 20;
                command.Parameters.Add(cod_IntParam);


                DbParameter cod_EquipoParam = command.CreateParameter();
                cod_EquipoParam.ParameterName = "@cod_Equipo";
                cod_EquipoParam.DbType        = DbType.Int32;
                cod_EquipoParam.Value         = hcoIntegranteVO.Cod_Equipo;
                cod_EquipoParam.Size          = 20;
                command.Parameters.Add(cod_EquipoParam);



                DbParameter version_integranteParam = command.CreateParameter();
                version_integranteParam.ParameterName = "@version_integrante";
                version_integranteParam.DbType        = DbType.Int32;
                version_integranteParam.Value         = hcoIntegranteVO.Version_Integrante;
                version_integranteParam.Size          = 20;
                command.Parameters.Add(version_integranteParam);


                DbParameter fecha_InicioParam = command.CreateParameter();
                fecha_InicioParam.ParameterName = "@fecha_Inicio";
                fecha_InicioParam.DbType        = DbType.DateTime;
                fecha_InicioParam.Value         = hcoIntegranteVO.Fecha_Inicio;
                fecha_InicioParam.Size          = 100;
                command.Parameters.Add(fecha_InicioParam);


                DbParameter fecha_FinParam = command.CreateParameter();
                fecha_FinParam.ParameterName = "@fecha_Fin";
                fecha_FinParam.DbType        = DbType.DateTime;
                if (hcoIntegranteVO.Fecha_Fin == DateTime.MinValue)
                {
                    fecha_FinParam.Value = DBNull.Value;
                }
                else
                {
                    fecha_FinParam.Value = hcoIntegranteVO.Fecha_Fin;
                }
                fecha_FinParam.Size = 100;
                command.Parameters.Add(fecha_FinParam);


                DbParameter fecha_Fin_ContratoParam = command.CreateParameter();
                fecha_Fin_ContratoParam.ParameterName = "@fecha_Fin_Contrato";
                fecha_Fin_ContratoParam.DbType        = DbType.DateTime;
                fecha_Fin_ContratoParam.Value         = hcoIntegranteVO.Fecha_Fin_Contrato;
                fecha_Fin_ContratoParam.Size          = 100;
                command.Parameters.Add(fecha_Fin_ContratoParam);


                DbParameter sueldoParam = command.CreateParameter();
                sueldoParam.ParameterName = "@sueldo";
                sueldoParam.DbType        = DbType.Int32;
                sueldoParam.Value         = hcoIntegranteVO.Sueldo;
                sueldoParam.Size          = 20;
                command.Parameters.Add(sueldoParam);


                DbParameter dorsalParam = command.CreateParameter();
                dorsalParam.ParameterName = "@dorsal";
                dorsalParam.DbType        = DbType.Int32;
                dorsalParam.Value         = hcoIntegranteVO.Dorsal;
                dorsalParam.Size          = 20;
                command.Parameters.Add(dorsalParam);



                command.Prepare();

                int insertedRows = command.ExecuteNonQuery();



                if (insertedRows == 0)
                {
                    throw new SQLException("errorrrrrrr");
                }

                return(hcoIntegranteVO);
            }
            catch (DbException e)
            {
                throw new InternalErrorException(e);
            }
        }
Exemplo n.º 11
0
        public HcoIntegranteVO create(DbConnection connection, DbTransaction transaction, HcoIntegranteVO hcoIntegranteVO)
        {
            try
            {
                DbCommand command = connection.CreateCommand();

                if (transaction != null)
                {
                    command.Transaction = transaction;
                }

                //vamos a obtener primero la version de integrante correcta

                command.CommandText = "SELECT max(version_integrante) from hco_integrante " +
                                      "WHERE cod_integrante=" + hcoIntegranteVO.Cod_Integrante;

                command.Connection = connection;
                command.Prepare();
                Int32        versionInt = 1;
                DbDataReader dataReader = null;

                dataReader = command.ExecuteReader();



                if (!dataReader.Read())
                {
                    versionInt = 1;
                }
                if (dataReader.GetValue(0) == DBNull.Value)
                {
                    versionInt = 1;
                }
                else
                {
                    versionInt = dataReader.GetInt32(0) + 1;
                }



                dataReader.Close();



                //realizamos ahora la insercion

                command = connection.CreateCommand();

                if (transaction != null)
                {
                    command.Transaction = transaction;
                }


                command.CommandText = "INSERT INTO Hco_Integrante (cod_Integrante,cod_Equipo,version_integrante,fecha_Inicio,fecha_Fin," +
                                      "fecha_Fin_Contrato, sueldo,dorsal) values (@cod_Int,@cod_Equipo,@version_integrante,@fecha_Inicio,@fecha_Fin," +
                                      "@fecha_Fin_Contrato,@sueldo,@dorsal)";

                DbParameter cod_IntParam = command.CreateParameter();
                cod_IntParam.ParameterName = "@cod_Int";
                cod_IntParam.DbType        = DbType.Int32;
                cod_IntParam.Value         = hcoIntegranteVO.Cod_Integrante;
                cod_IntParam.Size          = 20;
                command.Parameters.Add(cod_IntParam);


                DbParameter cod_EquipoParam = command.CreateParameter();
                cod_EquipoParam.ParameterName = "@cod_Equipo";
                cod_EquipoParam.DbType        = DbType.Int32;
                cod_EquipoParam.Value         = hcoIntegranteVO.Cod_Equipo;
                cod_EquipoParam.Size          = 20;
                command.Parameters.Add(cod_EquipoParam);



                DbParameter version_integranteParam = command.CreateParameter();
                version_integranteParam.ParameterName = "@version_integrante";
                version_integranteParam.DbType        = DbType.Int32;
                version_integranteParam.Value         = versionInt;
                version_integranteParam.Size          = 20;
                command.Parameters.Add(version_integranteParam);


                DbParameter fecha_InicioParam = command.CreateParameter();
                fecha_InicioParam.ParameterName = "@fecha_Inicio";
                fecha_InicioParam.DbType        = DbType.DateTime;
                fecha_InicioParam.Value         = hcoIntegranteVO.Fecha_Inicio;
                fecha_InicioParam.Size          = 100;
                command.Parameters.Add(fecha_InicioParam);


                DbParameter fecha_FinParam = command.CreateParameter();
                fecha_FinParam.ParameterName = "@fecha_Fin";
                fecha_FinParam.DbType        = DbType.DateTime;
                if (hcoIntegranteVO.Fecha_Fin == DateTime.MinValue)
                {
                    fecha_FinParam.Value = DBNull.Value;
                }
                else
                {
                    fecha_FinParam.Value = hcoIntegranteVO.Fecha_Fin;
                }
                fecha_FinParam.Size = 100;
                command.Parameters.Add(fecha_FinParam);


                DbParameter fecha_Fin_ContratoParam = command.CreateParameter();
                fecha_Fin_ContratoParam.ParameterName = "@fecha_Fin_Contrato";
                fecha_Fin_ContratoParam.DbType        = DbType.DateTime;
                fecha_Fin_ContratoParam.Value         = hcoIntegranteVO.Fecha_Fin_Contrato;
                fecha_Fin_ContratoParam.Size          = 100;
                command.Parameters.Add(fecha_Fin_ContratoParam);


                DbParameter sueldoParam = command.CreateParameter();
                sueldoParam.ParameterName = "@sueldo";
                sueldoParam.DbType        = DbType.Int32;
                sueldoParam.Value         = hcoIntegranteVO.Sueldo;
                sueldoParam.Size          = 20;
                command.Parameters.Add(sueldoParam);


                DbParameter dorsalParam = command.CreateParameter();
                dorsalParam.ParameterName = "@dorsal";
                dorsalParam.DbType        = DbType.Int32;
                dorsalParam.Value         = hcoIntegranteVO.Dorsal;
                dorsalParam.Size          = 20;
                command.Parameters.Add(dorsalParam);



                command.Prepare();

                int insertedRows = command.ExecuteNonQuery();



                if (insertedRows == 0)
                {
                    throw new SQLException("errorrrrrrr");
                }

                return(new HcoIntegranteVO(hcoIntegranteVO.Cod_Integrante, hcoIntegranteVO.Cod_Equipo,
                                           versionInt, hcoIntegranteVO.Fecha_Inicio, hcoIntegranteVO.Fecha_Fin,
                                           hcoIntegranteVO.Fecha_Fin_Contrato, hcoIntegranteVO.Sueldo, hcoIntegranteVO.Dorsal));
            }
            catch (DbException e)
            {
                throw new InternalErrorException(e);
            }
        }