Exemplo n.º 1
0
        public void executeModificar()
        {
            // Verificando la existencia de datos en el datagridview
            if (dataGridView.Rows.Count == 0)
            {
                MessageBox.Show("No hay un registro seleccionado", "Eliminar", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            int    index  = dataGridView.CurrentRow.Index;                                 // Identificando la fila actual del datagridview
            string codigo = Convert.ToString(dataGridView.Rows[index].Cells[0].Value);     // obteniedo el idCategoria del datagridview

            currentDatosDescuentosOfertas = listaDescuentos.Find(x => x.codigo == codigo); // Buscando la categoria en las lista de categorias



            if (currentDatosDescuentosOfertas.tipoDescuento == "Oferta")
            {
                FormOfertaNuevo formOfertaNuevo = new FormOfertaNuevo(currentDatosDescuentosOfertas);
                formOfertaNuevo.ShowDialog();
            }

            else
            {
                FormDescuentoNuevo formOfertaNuevo = new FormDescuentoNuevo(currentDatosDescuentosOfertas);
                formOfertaNuevo.ShowDialog();
            }
            // Mostrando el formulario de modificacion

            cargarRegistros(); // recargando loas registros en el datagridview
        }
Exemplo n.º 2
0
        private void btnOfertas_Click(object sender, EventArgs e)
        {
            FormOfertaNuevo formOferta = new FormOfertaNuevo();

            formOferta.ShowDialog();
            cargarRegistros();
        }