Beispiel #1
0
        private void produseView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            if (e.ColumnIndex == 6)
            {
                AddProdus adp = new AddProdus();
                adp.newEntry = false;
                adp.id       = Int32.Parse(produseView.Rows[e.RowIndex].Cells[0].Value.ToString());
                adp.usedStr  = Database.Value("SELECT materii FROM Produse WHERE id_produs = '" + adp.id + "'");
                adp.set(produseView.Rows[e.RowIndex].Cells[1].Value.ToString(), Decimal.Parse(produseView.Rows[e.RowIndex].Cells[2].Value.ToString()), Decimal.Parse(produseView.Rows[e.RowIndex].Cells[3].Value.ToString()));
                if (adp.ShowDialog() == DialogResult.OK)
                {
                    refreshProduse();
                    refreshData();
                }
            }

            if (e.ColumnIndex == 7)
            {
                int          id           = Int32.Parse(produseView.Rows[e.RowIndex].Cells[0].Value.ToString());
                string       name         = Database.Value("SELECT nume FROM Produse WHERE id_produs = '" + id + "'");
                DialogResult dialogResult = MessageBox.Show("Eliminati " + name + " din lista de produse?", "Eliminare - " + name, MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    Database.Execute("DELETE FROM Produse WHERE id_produs = '" + id + "'");
                    produseView.Rows.RemoveAt(e.RowIndex);
                }
            }
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            AddProdus adp = new AddProdus();

            if (adp.ShowDialog() == DialogResult.OK)
            {
                refreshProduse();
                refreshData();
                refreshProfit();
            }
        }