コード例 #1
0
        private void dgParticipantes_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DialogResult res;
            res = MessageBox.Show("“¿Está seguro que desea eliminar el registro seleccionado?", "Confirmación",
                MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
            if (res == DialogResult.Yes)
            {
                try
                {
                    var documento = int.Parse(dgParticipantes.Rows[e.RowIndex].Cells[1].Value.ToString());
                    var gt = new GestorTorneo();
                    gt.Eliminar(documento);

                    //consulto luego de eliminar para refrescar la grilla
                    dgParticipantes.DataSource = gt.ConsultarDatos(id_deporte).Tables[0];
                    dgParticipantes.DataMember = "Torneos";
                }
                catch (Exception ex)
                {
                }
            }
        }
コード例 #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            var gt = new GestorTorneo();
            try
            {
                global.id_deporte_torneo = int.Parse(cmbDeportes.SelectedValue.ToString());

                id_torneo = int.Parse(cmbTorneos.SelectedValue.ToString());
                dgParticipantes.DataSource = gt.ConsultarDatos(id_torneo).Tables[0];
                listCarcteristicas.Items.Clear();
                listCarcteristicas.Items.Add("Descripcion: " + gt.ConsultarDescripcion(id_torneo).Tables[0].Rows[0][0]);
                var estado = gt.ConsultarEstado(id_torneo).Tables[0].Rows[0][0].ToString();
                listCarcteristicas.Items.Add("Estado: " + estado);

                if (estado == "finalizado")
                {
                    btnConfirmar.Enabled = false;
                }
                else
                {
                    btnConfirmar.Enabled = true;

                }
            }
            catch (Exception ex)
            {
                listCarcteristicas.Items.Clear();
            }

            try
            {
                if (dgParticipantes.Rows[0].Cells[2].Value != null)
                    global.p1 = dgParticipantes.Rows[0].Cells[2].Value.ToString();

                if (dgParticipantes.Rows[1].Cells[2].Value != null)
                    global.p2 = dgParticipantes.Rows[1].Cells[2].Value.ToString();

                if (dgParticipantes.Rows[2].Cells[2].Value != null)
                    global.p3 = dgParticipantes.Rows[2].Cells[2].Value.ToString();

                if (dgParticipantes.Rows[3].Cells[2].Value != null)
                    global.p4 = dgParticipantes.Rows[3].Cells[2].Value.ToString();

                if (dgParticipantes.Rows[4].Cells[2].Value != null)
                    global.p5 = dgParticipantes.Rows[4].Cells[2].Value.ToString();

                if (dgParticipantes.Rows[5].Cells[2].Value != null)
                    global.p6 = dgParticipantes.Rows[5].Cells[2].Value.ToString();

                if (dgParticipantes.Rows[6].Cells[2].Value != null)
                    global.p7 = dgParticipantes.Rows[6].Cells[2].Value.ToString();

                if (dgParticipantes.Rows[7].Cells[2].Value != null)
                    global.p8 = dgParticipantes.Rows[7].Cells[2].Value.ToString();
            }
            catch (Exception ex)
            {
            }

            try
            {
                if (dgParticipantes.Rows[0].Cells[1].Value != null)
                    global.docp1 = int.Parse(dgParticipantes.Rows[0].Cells[1].Value.ToString());

                if (dgParticipantes.Rows[1].Cells[1].Value != null)
                    global.docp2 = int.Parse(dgParticipantes.Rows[1].Cells[1].Value.ToString());

                if (dgParticipantes.Rows[2].Cells[1].Value != null)
                    global.docp3 = int.Parse(dgParticipantes.Rows[2].Cells[1].Value.ToString());

                if (dgParticipantes.Rows[3].Cells[1].Value != null)
                    global.docp4 = int.Parse(dgParticipantes.Rows[3].Cells[1].Value.ToString());

                if (dgParticipantes.Rows[4].Cells[1].Value != null)
                    global.docp5 = int.Parse(dgParticipantes.Rows[4].Cells[1].Value.ToString());

                if (dgParticipantes.Rows[5].Cells[1].Value != null)
                    global.docp6 = int.Parse(dgParticipantes.Rows[5].Cells[1].Value.ToString());

                if (dgParticipantes.Rows[6].Cells[1].Value != null)
                    global.docp7 = int.Parse(dgParticipantes.Rows[6].Cells[1].Value.ToString());

                if (dgParticipantes.Rows[7].Cells[1].Value != null)
                    global.docp8 = int.Parse(dgParticipantes.Rows[7].Cells[1].Value.ToString());
            }
            catch (Exception ex)
            {
            }

            //Comienzo por Pablo
            int cantInscrip = 0;
            txtMaxCantPart.Text = Convert.ToString(tt.Cantidad_participantes);
            if (dgParticipantes.RowCount != 0)
            {
                cantInscrip = dgParticipantes.RowCount;
                txtCantInsc.Text = Convert.ToString(cantInscrip);
            }
            else
                txtCantInsc.Text = Convert.ToString(cantInscrip);
            if (cantInscrip <= tt.Cantidad_participantes)//Agregar la condición de si estado del torneo es igual a reservado
            {
                cargarListaParticipantes();
                cargarListaParticipantes2();
            }
            //Fin Pablo
        }