Exemplo n.º 1
0
        private void addProductButton_Click(object sender, EventArgs e)
        {
            addProducts prd = new addProducts();

            prd.ShowDialog();
            List <Product_Display> list = new List <Product_Display>();

            list = Database.listProducts("products");
            gridView_products.DataSource = list;

            int val      = 0;
            int val_comp = 0;
            DataGridViewCell cell_aux = null;

            foreach (DataGridViewRow row in gridView_products.Rows)
            {
                foreach (DataGridViewCell cell in row.Cells)
                {
                    Console.WriteLine(cell.Value);
                    if (cell.ColumnIndex == 4)
                    {
                        cell_aux = cell;
                        val      = Convert.ToInt32(cell_aux.Value);
                    }
                    else
                    {
                        if (cell.ColumnIndex == 5)
                        {
                            val_comp = Convert.ToInt32(cell.Value);
                            if (val <= (val_comp / 10))
                            {
                                cell_aux.Style.BackColor = Color.Red;
                                val      = 0;
                                val_comp = 0;
                                cell_aux = null;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            addProducts prd = new addProducts();

            prd.Show();
        }