Exemplo n.º 1
0
        //CAPTURA DATOS DEL JUGADOR

        void pc_capturar_datos_jugador()
        {
            //LISTA MANTIENE LOS DATOS
            List <Cls_Jugador> lista_datos_jug = new List <Cls_Jugador>();
            //VARIABLE CHECK
            CheckBox ch;

            foreach (GridViewRow item in tbl_jugadores.Rows)
            {
                Cls_Jugador _datos = new Cls_Jugador();
                ch = (CheckBox)item.Cells[4].FindControl("ch_seleccionar");
                if (ch.Checked == true)
                {
                    _datos.NumeroCedula  = item.Cells[0].Text;
                    _datos.idConsecutivo = Convert.ToInt32(dl_lista_equipos.SelectedValue);
                    lista_datos_jug.Add(_datos);
                }
            }

            //ENVIAMOS LOS DATOS
            if (_Jugador.pc_jug_x_equipo(lista_datos_jug) > 0)
            {
                pc_consultar_jugadores_activos();
            }
        }
        protected void btn_agregar_Click(object sender, EventArgs e)
        {
            Cls_Jugador _jugador = new Cls_Jugador(Convert.ToInt32(dl_lista_provincia.SelectedValue),
                                                   Convert.ToInt32(dl_lista_cantones.SelectedValue), Convert.ToInt32(dl_lista_distritos.SelectedValue));

            _jugador.NumeroCedula = txt_cedula.Text;
            if (rb_masculino.Checked == true)
            {
                _jugador.Genero = "M";
            }
            else
            {
                _jugador.Genero = "F";
            }
            _jugador.FechaNacimiento = txt_fecha_nacimiento.Text;
            _jugador.NumeroTelefono  = txt_telefono.Text;
            _jugador.Correo          = txt_correo.Text;
            _jugador.Nombre          = txt_nombre.Text;
            _jugador.Apellido1       = txt_apellido1.Text;
            _jugador.Apellido2       = txt_apellido2.Text;
            _jugador.DireccionCasa   = txt_direccion.Value;

            //HACEMOS LA VALIDACION SI SE REGISTRP EL JUGADOR
            switch (_jugador.pc_registrar_jugador())
            {
            case -100:
                lbl_mensaje.Text = "Ocurrio un error";
                break;

            default:
                lbl_mensaje.Text = "Jugador registrado";
                break;
            }
        }