protected override void IconButton_Delete_Click(object sender, EventArgs e) { int fila = DGV_Data.CurrentRow.Index; if (DGV_Data.Rows.Count != 0) { id = Convert.ToInt32(DGV_Data.Rows[fila].Cells[0].Value); if (obj == null) { obj = new Negocios.Producto(); } if (obj.ValidarRecord(id)) { if (MessageBox.Show("Deseas Eliminar este Registro?", "Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { obj.Eliminar(id); MessageBox.Show("Registro Eliminado correctamente"); MostrarTodoslosRegistrosCargados(); } } } }
protected override void IconButton_Guardar_Click(object sender, EventArgs e) { if (TB_Descripcion.Text != " Descripcion" && CB_NombreFabricante.Text != " Nombre del Fabricante" && TB_Costo.Text != " Costo" && TB_Precio.Text != " Precio" && TextBox_Cantidad.Text != " Cantidad en Inventario") { if (objNegocio == null) { objNegocio = new Negocios.Producto(); } var validar = objNegocio.ValidarRecord(id); if (validar) { Actualizar(); } else { Agregar(); } } else { ErrorData(); } }