public PartidoCompletoCO(EquipoVO equipoLocal, EquipoVO equipoVisitante, PartidoVO partido, List <PartidoJugadoBasicoCO> jugadoresTitularesLocal, List <PartidoJugadoBasicoCO> jugadoresTitularesVisitante, List <PartidoJugadoBasicoCO> jugadoresNoTitularesLocal, List <PartidoJugadoBasicoCO> jugadoresNoTitularesVisitante, List <GolCO> golesLocal, List <GolCO> golesVisitante, List <TarjetaCO> tarjetasLocal, List <TarjetaCO> tarjetasVisitante, EstadioVO estadio, ArbitroVO arbitro, String cronica, List <CambioCO> cambiosLocal, List <CambioCO> cambiosVisitante) { this.EquipoLocal = equipoLocal; this.EquipoVisitante = equipoVisitante; this.Partido = partido; this.JugadoresTitularesLocal = jugadoresTitularesLocal; this.JugadoresTitularesVisitante = jugadoresTitularesVisitante; this.JugadoresNoTitularesLocal = jugadoresNoTitularesLocal; this.JugadoresNoTitularesVisitante = jugadoresNoTitularesVisitante; this.GolesLocal = golesLocal; this.GolesVisitante = golesVisitante; this.TarjetasLocal = tarjetasLocal; this.TarjetasVisitante = tarjetasVisitante; this.Arbitro = arbitro; this.Estadio = estadio; this.Cronica = cronica; this.CambiosLocal = cambiosLocal; this.CambiosVisitante = cambiosVisitante; }
public EquipoTotalCO(EquipoVO equipo, List <T> listaJugadores, List <EntrenadorCO> listaEntrenadoresCreate, List <EntrenadorPlantillaCO> listaEntrenadoresView, List <DirectivoCO> listaDirectivosCreate, List <DirectivoPlantillaCO> listaDirectivosView, EstadioVO estadio) { this.equipo = equipo; this.listaJugadores = listaJugadores; this.listaEntrenadoresCreate = listaEntrenadoresCreate; this.listaEntrenadoresView = listaEntrenadoresView; this._listaDirectivosCreate = listaDirectivosCreate; this._listaDirectivosView = listaDirectivosView; this.estadio = estadio; }
public EquipoVO create(DbConnection connection, DbTransaction transaction, EquipoVO equipoVO) { try { DbCommand command = connection.CreateCommand(); if (transaction != null) { command.Transaction = transaction; } command.CommandText = "INSERT INTO Equipo (localidad,nombre,cod_Estadio,foto_Escudo,foto_Plantilla) values " + "(@ciudad,@nombre,@cod_Estadio,@fotoEscudo,@fotoPlantilla)"; DbParameter ciudadParam = command.CreateParameter(); ciudadParam.ParameterName = "@ciudad"; ciudadParam.DbType = DbType.String; ciudadParam.Value = equipoVO.Ciudad; ciudadParam.Size = 20; command.Parameters.Add(ciudadParam); DbParameter nombreParam = command.CreateParameter(); nombreParam.ParameterName = "@nombre"; nombreParam.DbType = DbType.String; nombreParam.Value = equipoVO.Nombre; nombreParam.Size = 20; command.Parameters.Add(nombreParam); DbParameter cod_EstadioParam = command.CreateParameter(); cod_EstadioParam.ParameterName = "@cod_Estadio"; cod_EstadioParam.DbType = DbType.Int32; cod_EstadioParam.Size = 32; cod_EstadioParam.Value = equipoVO.Cd_Estadio; command.Parameters.Add(cod_EstadioParam); DbParameter fotoEscudoParam = command.CreateParameter(); fotoEscudoParam.ParameterName = "@fotoEscudo"; fotoEscudoParam.DbType = DbType.String; fotoEscudoParam.Size = 50; fotoEscudoParam.Value = equipoVO.FotoEscudo; command.Parameters.Add(fotoEscudoParam); DbParameter fotoPlantillaParam = command.CreateParameter(); fotoPlantillaParam.ParameterName = "@fotoPlantilla"; fotoPlantillaParam.DbType = DbType.String; fotoPlantillaParam.Size = 50; fotoPlantillaParam.Value = equipoVO.FotoPlantilla; command.Parameters.Add(fotoPlantillaParam); command.Prepare(); int insertedRows = command.ExecuteNonQuery(); if (insertedRows == 0) { throw new SQLException("errorrrrrrr"); } IEquipoIdentifierRetriever equipoIdentifierRetriever = EquipoIdentifierRetrieverFactory.GetRetriever(); Int64 equipoIdentifier = equipoIdentifierRetriever.GetGeneratedIdentifier(connection, transaction); return(new EquipoVO((int)equipoIdentifier, equipoVO.Nombre, equipoVO.Ciudad, equipoVO.Cd_Estadio, equipoVO.FotoEscudo, equipoVO.FotoPlantilla)); } catch (DbException e) { throw new InternalErrorException(e); } }
public object execute(DbConnection connection) { ArbitroVO arbitro; EstadioVO estadio; PartidoVO partido; List <CambioCO> listaCambiosLocal; List <CambioCO> listaCambiosVisitante; List <TarjetaCO> listaTarjetasLocal; List <TarjetaCO> listaTarjetasVisitante; //Obtenemos el VO del partido PartidoDAO partidoDAO = new PartidoDAO(); partido = partidoDAO.verPartido(connection, null, cod_Partido); EquipoDAO equipoDAO = new EquipoDAO(); PartidoJugadoDAO partidoJugadoDAO = new PartidoJugadoDAO(); GolDAO golDAO = new GolDAO(); CambioDAO cambioDAO = new CambioDAO(); TarjetaDAO tarjetaDAO = new TarjetaDAO(); //Obtenemos los VOs con los equipos que juegan el partido EquipoVO equipoLocal = equipoDAO.buscarEquipoId(connection, null, partido.Cod_Local); EquipoVO equipoVisitante = equipoDAO.buscarEquipoId(connection, null, partido.Cod_Visitante); //Obtenemos los jugadores titulares y suplentes de ambos equipos en el partido var titularesLocal = partidoJugadoDAO.buscarJugadoresTitularesEquipoPartido(connection, null, equipoLocal.Cd_Equipo, cod_Partido, "titular"); var titularesVisitante = partidoJugadoDAO.buscarJugadoresTitularesEquipoPartido(connection, null, equipoVisitante.Cd_Equipo, cod_Partido, "titular"); var suplentesLocal = partidoJugadoDAO.buscarJugadoresTitularesEquipoPartido(connection, null, equipoLocal.Cd_Equipo, cod_Partido, "suplente"); var suplentesVisitante = partidoJugadoDAO.buscarJugadoresTitularesEquipoPartido(connection, null, equipoVisitante.Cd_Equipo, cod_Partido, "suplente"); //Obtenemos los VOs del arbitro, estadio ArbitroDAO arbitroDAO = new ArbitroDAO(); EstadioDAO estadioDAO = new EstadioDAO(); arbitro = arbitroDAO.verArbitro(connection, null, partido.Cod_Arbitro); estadio = estadioDAO.buscarEstadioId(connection, null, partido.Cod_Estadio); //Obtenemos la lista de goles de ambos equipos var listaGolesLocal = golDAO.listarGolesEquipoPartido(connection, null, partido.Cod_Partido, partido.Cod_Local, 0, 2); var listaGolesVisitante = golDAO.listarGolesEquipoPartido(connection, null, partido.Cod_Partido, partido.Cod_Visitante, 0, 2); //obtenemos la lista de cambios de ambos equipos listaCambiosLocal = cambioDAO.listarCambiosPartidoEquipo(connection, null, partido.Cod_Partido, partido.Cod_Local, 0, 2); listaCambiosVisitante = cambioDAO.listarCambiosPartidoEquipo(connection, null, partido.Cod_Partido, partido.Cod_Visitante, 0, 2); //obtenemos la lista de tarjetas de ambos equipo listaTarjetasLocal = tarjetaDAO.listarTarjetasEquipoPartido(connection, null, partido.Cod_Local, partido.Cod_Partido, 0, 2); listaTarjetasVisitante = tarjetaDAO.listarTarjetasEquipoPartido(connection, null, partido.Cod_Visitante, partido.Cod_Partido, 0, 2); //Creamos el CO del partido completo PartidoCompletoCO partidoCompletoCO = new PartidoCompletoCO(equipoLocal, equipoVisitante, partido, titularesLocal, titularesVisitante, suplentesLocal, suplentesVisitante, listaGolesLocal, listaGolesVisitante, listaTarjetasLocal, listaTarjetasVisitante, estadio, arbitro, null, listaCambiosLocal, listaCambiosVisitante); return(partidoCompletoCO); }