コード例 #1
0
        private void Eliminar_Click(object sender, EventArgs e)
        {
            Boolean    seleccion   = false;
            List <int> idProductos = new List <int>();

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                bool isSelected = Convert.ToBoolean(row.Cells["Cb"].Value);
                if (isSelected)
                {
                    seleccion = true;
                    int idProducto = Convert.ToInt32(row.Cells[1].Value);
                    idProductos.Add(idProducto);
                }
            }
            if (seleccion)
            {
                foreach (int idProducto in idProductos)
                {
                    controladorFachada.BajaProducto(idProducto);
                }
                MessageBox.Show("Se dieron de baja el/los producto/s seleccionado/s");
            }
            else
            {
                MessageBox.Show("Debe seleccionar al menos un producto");
            }
        }