Ejemplo 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
        }
Ejemplo n.º 2
0
        private void decorationDataGridView()
        {
            //Verificando la existencia de datos en el datagridview
            if (dataGridView.Rows.Count == 0)
            {
                return;
            }

            foreach (DataGridViewRow row in dataGridView.Rows)
            {
                string codigo = Convert.ToString(row.Cells[0].Value);                                      // obteniedo el idCategoria del datagridview

                DatosDescuentosOfertas dDescuentosOfertas = listaDescuentos.Find(x => x.codigo == codigo); // Buscando la categoria en las lista de categorias
                if (dDescuentosOfertas != null)
                {
                    if (dDescuentosOfertas.estado == 0)
                    {
                        dataGridView.ClearSelection();
                        row.DefaultCellStyle.BackColor = Color.FromArgb(255, 224, 224);
                        row.DefaultCellStyle.ForeColor = Color.FromArgb(250, 5, 73);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public FormOfertaNuevo(DatosDescuentosOfertas currentOferta)
 {
     InitializeComponent();
     this.currentOferta = currentOferta;
     nuevo = false;
 }
Ejemplo n.º 4
0
 public FormDescuentoNuevo(DatosDescuentosOfertas currentDescuento)
 {
     InitializeComponent();
     this.currentDescuento = currentDescuento;
     nuevo = false;
 }