private void ProveedorMan03_Load(object sender, EventArgs e) { try { cboEquipo.DataSource = teamBL.ListTeams(); cboEquipo.ValueMember = "IdEquipo"; cboEquipo.DisplayMember = "NomEquipo"; jugadorBE = JugadorBL.ConsultarJugador(Codigo); txtApellido.Text = jugadorBE.ApeJugador; txtNombre.Text = jugadorBE.NomJugador; txtNick.Text = jugadorBE.NickJugador; txtEdad.Text = jugadorBE.EdadJugador.ToString(); txtPais.Text = jugadorBE.PaisJugador; if (jugadorBE.CapJugador == 'C') { chkCapitan.Checked = true; } cboRol.SelectedText = jugadorBE.RolJugador.ToString(); cboEquipo.SelectedValue = jugadorBE.IdEquipo; } catch (Exception ex) { MessageBox.Show("Error : " + ex.Message); } }
public JugadorBE ConsultarJugador(String JugadorId) { JugadorBE jugadorBE = new JugadorBE(); try { connection.ConnectionString = MiConexion.GetCnx(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "ConsultarJugador"; command.Parameters.AddWithValue("@IdJugador", JugadorId); connection.Open(); dataReader = command.ExecuteReader(); if (dataReader.HasRows) { dataReader.Read(); jugadorBE.IdJugador = Convert.ToInt32(dataReader["IdJugador"]); jugadorBE.ApeJugador = dataReader["ApeJugador"].ToString(); jugadorBE.NomJugador = dataReader["NomJugador"].ToString(); jugadorBE.NickJugador = dataReader["NickJugador"].ToString(); jugadorBE.EdadJugador = Convert.ToInt32(dataReader["EdadJugador"]); jugadorBE.PaisJugador = dataReader["PaisJugador"].ToString(); jugadorBE.CapJugador = Convert.ToChar(dataReader["CapJugador"]); jugadorBE.RolJugador = dataReader["RolJugador"].ToString(); jugadorBE.IdEquipo = Convert.ToInt32(dataReader["IdEquipo"]); } dataReader.Close(); } catch (SqlException ex) { throw new Exception(ex.Message); } finally { if (connection.State == ConnectionState.Open) { connection.Close(); } command.Parameters.Clear(); } return(jugadorBE); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { try { int row = Convert.ToInt16(e.CommandArgument); //chequea si se ha dado clic al buttonimage con el commando Editar if (e.CommandName == "Editar") { String IdJugador = GridView1.Rows[row].Cells[1].Text; jugadorBE = jugadorBL.ConsultarJugador(IdJugador); lblJugador.Text = jugadorBE.IdJugador.ToString(); txtNombre0.Text = jugadorBE.NomJugador; txtApellido0.Text = jugadorBE.ApeJugador; txtEdad0.Text = jugadorBE.EdadJugador.ToString(); txtNick0.Text = jugadorBE.NickJugador; txtPais0.Text = jugadorBE.PaisJugador; if (jugadorBE.CapJugador == 'X') { chkCapitan0.Checked = false; } else { chkCapitan0.Checked = true; } dropRol0.SelectedValue = jugadorBE.RolJugador; dropEquipo0.SelectedValue = jugadorBE.IdEquipo.ToString(); lblMensaje3.Text = ""; PopMant2.Show(); } } catch (Exception ex) { lblMensaje.Text = ex.Message; mpeMensaje.Show(); } }
public Boolean InsertarJugador(JugadorBE jugadorBE) { connection.ConnectionString = MiConexion.GetCnx(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "InsertarJugador"; command.Parameters.AddWithValue("@ApeJugador", jugadorBE.ApeJugador); command.Parameters.AddWithValue("@NomJugador", jugadorBE.NomJugador); command.Parameters.AddWithValue("@NickJugador", jugadorBE.NickJugador); command.Parameters.AddWithValue("@EdadJugador", jugadorBE.EdadJugador); command.Parameters.AddWithValue("@PaisJugador", jugadorBE.PaisJugador); command.Parameters.AddWithValue("@CapJugador", jugadorBE.CapJugador); command.Parameters.AddWithValue("@RolJugador", jugadorBE.RolJugador); command.Parameters.AddWithValue("@IdEquipo", jugadorBE.IdEquipo); try { connection.Open(); command.ExecuteNonQuery(); return(true); } catch (SqlException x) { throw new Exception(x.Message); return(false); } finally { if (connection.State == ConnectionState.Open) { connection.Close(); } command.Parameters.Clear(); } }
public Boolean ActualizarJugador(JugadorBE jugadorBE) { return(objJugadorADO.ActualizarJugador(jugadorBE)); }
public Boolean InsertarJugador(JugadorBE jugadorBE) { return(objJugadorADO.InsertarJugador(jugadorBE)); }