コード例 #1
0
        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();
            }
        }
コード例 #2
0
        protected void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                String idJugador = lblJugador.Text;


                if (jugadorBL.EliminarJugador(idJugador))
                {
                    CargarDatos();
                }
                else
                {
                    throw new Exception("No se eliminó correctamente el jugador.");
                }
            }
            catch (Exception ex)
            {
                lblMensaje3.Text = ex.Message;
                PopMant2.Show();
            }
        }
コード例 #3
0
        protected void btnGrabar2_Click(object sender, EventArgs e)
        {
            try
            {
                jugadorBE.IdJugador   = Convert.ToInt32(lblJugador.Text);
                jugadorBE.NomJugador  = txtNombre0.Text.Trim();
                jugadorBE.ApeJugador  = txtApellido0.Text.Trim();
                jugadorBE.EdadJugador = Convert.ToInt16(txtEdad0.Text.Trim());
                jugadorBE.NickJugador = txtNick0.Text.Trim();
                jugadorBE.PaisJugador = txtPais0.Text.Trim();
                jugadorBE.RolJugador  = dropRol0.SelectedValue.ToString();

                if (chkCapitan0.Checked)
                {
                    jugadorBE.CapJugador = 'C';
                }
                else
                {
                    jugadorBE.CapJugador = 'X';
                }

                jugadorBE.IdEquipo = Convert.ToInt32(dropEquipo0.SelectedValue);

                if (jugadorBL.ActualizarJugador(jugadorBE))
                {
                    CargarDatos();
                }
                else
                {
                    throw new Exception("No se actualizó correctamente el nuevo jugador.");
                }
            }
            catch (Exception ex)
            {
                lblMensaje3.Text = ex.Message;
                PopMant2.Show();
            }
        }